On the OnSpawn script of the creature, I have a call to a function
Loot()
I'm trying to have control over what loot drops off of some creatures. Here is what I'm trying to use to spawn loot on the creature during spawn.
string ADROP1 = GetLocalString(OBJECT_SELF, "ADROP1"); string ADROP2 = GetLocalString(OBJECT_SELF, "ADROP2"); string ADROP3 = GetLocalString(OBJECT_SELF, "ADROP3");
CreateItemOnObject(ADROP1); CreateItemOnObject(ADROP2); CreateItemOnObject(ADROP3);
I have the creature death loot set to Leave Lootable Corpse. But no items drop on the creature. What am I doing wrong?
OnSpawn - create item
Débuté par
Buddywarrior
, juil. 16 2012 04:11
#1
Posté 16 juillet 2012 - 04:11
#2
Posté 16 juillet 2012 - 04:29
Could add some lines to your OnSpawn script kinda like so for testing. See if the problem is somewhere there first:
void main()
{
string ADROP1 = GetLocalString(OBJECT_SELF, "ADROP1");
string ADROP2 = GetLocalString(OBJECT_SELF, "ADROP2");
string ADROP3 = GetLocalString(OBJECT_SELF, "ADROP3");
object oItem1 = CreateItemOnObject(ADROP1);
object oItem2 = CreateItemOnObject(ADROP2);
object oItem3 = CreateItemOnObject(ADROP3);
SendMessageToPC(GetFirstPC(), "OnSpawn test is running.");
if (GetIsObjectValid(oItem1))
SendMessageToPC(GetFirstPC(), "Item1 created successfully.");
if (GetIsObjectValid(oItem2))
SendMessageToPC(GetFirstPC(), "Item2 created successfully.");
if (GetIsObjectValid(oItem3))
SendMessageToPC(GetFirstPC(), "Item3 created successfully.");
}
If you don't see the first line then your OnSpawn might not be on the creature?
If you don't see the item lines then maybe its the res refs (string variables) set on the creatures?
void main()
{
string ADROP1 = GetLocalString(OBJECT_SELF, "ADROP1");
string ADROP2 = GetLocalString(OBJECT_SELF, "ADROP2");
string ADROP3 = GetLocalString(OBJECT_SELF, "ADROP3");
object oItem1 = CreateItemOnObject(ADROP1);
object oItem2 = CreateItemOnObject(ADROP2);
object oItem3 = CreateItemOnObject(ADROP3);
SendMessageToPC(GetFirstPC(), "OnSpawn test is running.");
if (GetIsObjectValid(oItem1))
SendMessageToPC(GetFirstPC(), "Item1 created successfully.");
if (GetIsObjectValid(oItem2))
SendMessageToPC(GetFirstPC(), "Item2 created successfully.");
if (GetIsObjectValid(oItem3))
SendMessageToPC(GetFirstPC(), "Item3 created successfully.");
}
If you don't see the first line then your OnSpawn might not be on the creature?
If you don't see the item lines then maybe its the res refs (string variables) set on the creatures?
#3
Posté 16 juillet 2012 - 04:51
also consider spawning loot in OnDeath event, creature's AI might use the loot for his own benefits (scrolls, potions...)
#4
Posté 16 juillet 2012 - 05:33
Make sure the droppable flag is set:
SetDroppableFlag(CreateItemOnObject(ADROP1),TRUE);
SetDroppableFlag(CreateItemOnObject(ADROP1),TRUE);
#5
Posté 16 juillet 2012 - 05:47
no need to actually, items created by script on NPC are automatically droppableLightfoot8 wrote...
Make sure the droppable flag is set:
SetDroppableFlag(CreateItemOnObject(ADROP1),TRUE);
#6
Posté 16 juillet 2012 - 06:16
it seams to be working just fine if the treasure model is set to body/pouch, but not as a lootable corpse. hmm..
#7
Posté 18 juillet 2012 - 04:21
Maybe:
SetLootable(object, int)
Sets whether a creature leaves a lootable corpse upon death
void SetLootable(
object oCreature,
int bLootable
);
Parameters
oCreature
NPC to set as lootable or not
bLootable
TRUE or FALSE
Description
Sets the lootable state of a *living* NPC creature.
This function will *not* work on players or dead creatures.
Remarks
This corresponds to the "leaves lootable corpse" NPC property (under advanced in the NPC's properties).
Only NPCs can be lootable, and their lootable state must be set BEFORE they die.
Known Bugs
Simply calling SetLootable doesn't appear to be sufficient to have the NPC leave a lootable corpse. The corpse left behind isn't selectable. To make a corpse lootable, add the two lines of code below to the end of the NPC's OnSpawn script:
Version
1.61
Example
SetIsDestroyable(TRUE, FALSE, TRUE);
DelayCommand(1.0, SetLootable(OBJECT_SELF, TRUE));
See Also
functions: GetLootable
categories: Inventory Functions
SetLootable(object, int)
Sets whether a creature leaves a lootable corpse upon death
void SetLootable(
object oCreature,
int bLootable
);
Parameters
oCreature
NPC to set as lootable or not
bLootable
TRUE or FALSE
Description
Sets the lootable state of a *living* NPC creature.
This function will *not* work on players or dead creatures.
Remarks
This corresponds to the "leaves lootable corpse" NPC property (under advanced in the NPC's properties).
Only NPCs can be lootable, and their lootable state must be set BEFORE they die.
Known Bugs
Simply calling SetLootable doesn't appear to be sufficient to have the NPC leave a lootable corpse. The corpse left behind isn't selectable. To make a corpse lootable, add the two lines of code below to the end of the NPC's OnSpawn script:
Version
1.61
Example
SetIsDestroyable(TRUE, FALSE, TRUE);
DelayCommand(1.0, SetLootable(OBJECT_SELF, TRUE));
See Also
functions: GetLootable
categories: Inventory Functions
#8
Posté 18 juillet 2012 - 05:00
have you triedd to move spawning items into OnDeath as I suggested? Im doing it like this and while I rarely use lootable corpses (there are few bugs with that) it worked for me.Buddywarrior wrote...
it seams to be working just fine if the treasure model is set to body/pouch, but not as a lootable corpse. hmm..
#9
Posté 18 juillet 2012 - 02:55
I haven't. I've talked myself into thinking that leaving a little bag of treasure looks better on these rare creatures. Truth is that it's a path of least resistance and the player wont notice and/or care.





Retour en haut






