Author Topic: Loot  (Read 479 times)

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Loot
« on: October 27, 2010, 07:30:55 am »


               Hi,

I am currently using Silicon Scouts Treasure System and is doing a great job, problem is i want it to drop loot to players inventory instead of loot bags is this possible and if so can someone please help.

thanx in advance
               
               

               
            

Legacy_NorthWolf

  • Full Member
  • ***
  • Posts: 143
  • Karma: +0/-0
Loot
« Reply #1 on: October 27, 2010, 02:30:12 pm »


               You should be able to use the NPC's OnDeath event to do this. Take whatever treasure was going to spawn to the loot bag and instead use GetLastKiller() to find out who killed the NPC. If the killer was a PC, spawn the loot on them instead. In the case of summons, etc. striking the final blow you'd have to figure out their associated PC with GetMaster().
               
               

               
            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Loot
« Reply #2 on: October 27, 2010, 04:54:01 pm »


               Hey thanks for your help NothWolf, i will take a look, im no good at scripting but will give it a try, was hoping for a little more help '<img'>
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Loot
« Reply #3 on: October 27, 2010, 05:05:36 pm »


               

Madasahatter wrote...

Hey thanks for your help NothWolf, i will take a look, im no good at scripting but will give it a try, was hoping for a little more help '<img'>


You'll need to post the OnDeath Event script you use for a cut and paste solution here.
               
               

               
            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Loot
« Reply #4 on: October 27, 2010, 06:10:42 pm »


               at the moment my test mod is using standard ondeath script



void main()

{

   ExecuteScript("nw_c2_default7", OBJECT_SELF);

}
               
               

               


                     Modifié par Madasahatter, 27 octobre 2010 - 05:12 .
                     
                  


            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Loot
« Reply #5 on: October 27, 2010, 06:12:14 pm »


               sry posted twice '<img'>
               
               

               


                     Modifié par Madasahatter, 27 octobre 2010 - 05:13 .
                     
                  


            

Legacy_420

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Loot
« Reply #6 on: October 27, 2010, 07:12:36 pm »


               Here you go:
void main()
{
object oPC = GetLastKiller();
if(!GetIsPC(oPC)) oPC = GetMaster(oPC);
if(GetIsObjectValid(oPC))
    {
    int nCounter;
    object oItem;
    //Get items in slots
    for (nCounter = 0; nCounter <= NUM_INVENTORY_SLOTS; nCounter++)
        {
        //Skip creature items
        if(nCounter != INVENTORY_SLOT_CARMOUR &&
           nCounter != INVENTORY_SLOT_CWEAPON_B &&
           nCounter != INVENTORY_SLOT_CWEAPON_L &&
           nCounter != INVENTORY_SLOT_CWEAPON_R)
           {
            oItem = GetItemInSlot(nCounter, OBJECT_SELF);
            if(GetIsObjectValid(oItem))
                {
                ActionGiveItem(oItem, oPC);
                }
           }

        }
    //Get items in inventory
    oItem = GetFirstItemInInventory();
    while(GetIsObjectValid(oItem))
        {
        ActionGiveItem(oItem, oPC);
        oItem = GetNextItemInInventory();
        }
    }

ExecuteScript("nw_c2_default7", OBJECT_SELF);
}

-420
               
               

               


                     Modifié par 420, 27 octobre 2010 - 06:13 .
                     
                  


            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Loot
« Reply #7 on: October 27, 2010, 07:35:52 pm »


               Hey 420 that works like a charm thanks,

Now i need some floating txt and maybe a vfx to let players know they have recieved and item. and only when they receive an item
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Loot
« Reply #8 on: October 27, 2010, 09:02:12 pm »


                

void main()
{
object oPC = GetLastKiller();
if(!GetIsPC(oPC)) oPC = GetMaster(oPC);
if(GetIsObjectValid(oPC))
    {
    int nCounter;
    object oItem;
    //Get items in slots
    for (nCounter = 0; nCounter <= NUM_INVENTORY_SLOTS; nCounter++)
        {
        //Skip creature items
        if(nCounter != INVENTORY_SLOT_CARMOUR &&
           nCounter != INVENTORY_SLOT_CWEAPON_B &&
           nCounter != INVENTORY_SLOT_CWEAPON_L &&
           nCounter != INVENTORY_SLOT_CWEAPON_R)
           {
            oItem = GetItemInSlot(nCounter, OBJECT_SELF);
            if(GetIsObjectValid(oItem))
                {
                    if (GetDroppableFlag(oItem))
                    {
                           ActionGiveItem(oItem, oPC);
                           FloatingTextStringOnCreature("You have looted a "
                                                                            +GetName(oItem)
                                                                              +" from "+GetName(OBJECT_SELF)
                                                                               ,oPC,FALSE);
                    }        

                }
           }

        }
    //Get items in inventory
    oItem = GetFirstItemInInventory();
    while(GetIsObjectValid(oItem))
        {
             if (GetDroppableFlag(oItem))
            {
              ActionGiveItem(oItem, oPC);
              FloatingTextStringOnCreature("You have looted a "+GetName(oItem)+" from "+GetName(OBJECT_SELF)
                                                              ,oPC,FALSE);
             }        
        oItem = GetNextItemInInventory();
        }
    }

ExecuteScript("nw_c2_default7", OBJECT_SELF);
}

 
               
               

               
            

Legacy_Madasahatter

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Loot
« Reply #9 on: October 29, 2010, 08:31:10 pm »


               thanks for all your help guy's, working great '<img'>