Use item to spawn placeable at targeted location ERROR
CyrusJV
Member Posts: 36
I have an item tagged pkegit, and a script named pkegit.
When using the item it should spawn 1 pkegplc, however it spawns multiple pkegplc at once at the same location. What am I doing wrong?
void OnActivate(object oEventItem, object oActTarget, location lActTarget, object oActivator)
{
object oSpawn;
object oPC = oActivator;
// This item must target a location (not an object).
if ( GetIsObjectValid(oActTarget) )
return;
// Spawn "pkegplc".
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "pkegplc", lActTarget);
}
When using the item it should spawn 1 pkegplc, however it spawns multiple pkegplc at once at the same location. What am I doing wrong?
void OnActivate(object oEventItem, object oActTarget, location lActTarget, object oActivator)
{
object oSpawn;
object oPC = oActivator;
// This item must target a location (not an object).
if ( GetIsObjectValid(oActTarget) )
return;
// Spawn "pkegplc".
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "pkegplc", lActTarget);
}
0
Comments
https://nwnlexicon.com/index.php/Grimlar_-_Introduction_To_Tag_Based_Scripting
Using non-tag scripting, I came up with a multi-use tool (which was mainly for DMs) and which uses the OnActivateItem event to trigger one of five or six conversations, depending on how the tool was used. The script also stores important parameters on the tool so that a conversation script can find out what it needs to know.
Using tag-based scripting, I doubt I could have implemented the tool as easily as I did.