Aller au contenu

Photo

Loot


  • Veuillez vous connecter pour répondre
9 réponses à ce sujet

#1
Madasahatter

Madasahatter
  • Members
  • 111 messages
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

#2
NorthWolf

NorthWolf
  • Members
  • 86 messages
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().

#3
Madasahatter

Madasahatter
  • Members
  • 111 messages
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 :)

#4
kalbaern

kalbaern
  • Members
  • 824 messages

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 :)


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

#5
Madasahatter

Madasahatter
  • Members
  • 111 messages
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 .


#6
Madasahatter

Madasahatter
  • Members
  • 111 messages
sry posted twice :)

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


#7
420

420
  • Members
  • 190 messages
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 .


#8
Madasahatter

Madasahatter
  • Members
  • 111 messages
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

#9
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
 

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);
}

 

#10
Madasahatter

Madasahatter
  • Members
  • 111 messages
thanks for all your help guy's, working great :)