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
Loot
Débuté par
Madasahatter
, oct. 27 2010 06:30
#1
Posté 27 octobre 2010 - 06:30
#2
Posté 27 octobre 2010 - 01:30
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
Posté 27 octobre 2010 - 03:54
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
Posté 27 octobre 2010 - 04:05
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
Posté 27 octobre 2010 - 05:10
at the moment my test mod is using standard ondeath script
void main()
{
ExecuteScript("nw_c2_default7", OBJECT_SELF);
}
void main()
{
ExecuteScript("nw_c2_default7", OBJECT_SELF);
}
Modifié par Madasahatter, 27 octobre 2010 - 05:12 .
#6
Posté 27 octobre 2010 - 05:12
sry posted twice
Modifié par Madasahatter, 27 octobre 2010 - 05:13 .
#7
Posté 27 octobre 2010 - 06:12
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
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
Posté 27 octobre 2010 - 06:35
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
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
Posté 27 octobre 2010 - 08:02
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
Posté 29 octobre 2010 - 07:31
thanks for all your help guy's, working great





Retour en haut






