Okay, here is a script I made using LilacSoul's Script Generator, v. TK.0. This script is not attached anywhere and I have double checked that the name of the script (smnbaristhenes) is the same as the item I made.
/* * Script generated by LS Script Generator, v.TK.0 * * For download info, please visit: *
http://nwvault.ign.c...tail&id=1502 */
//Created On: 10/03/2013
void OnActivate(object oEventItem, object oActTarget, location lActTarget, object oActivator){ object oSpawn; effect eVFX; object oPC = oActivator;
// This item must target a location (not an object). if ( GetIsObjectValid(oActTarget) ) { SendMessageToPC(oActivator, "Improper use of this item!"); return; }
// Spawn "baristhenes". eVFX = EffectVisualEffect(471); oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "baristhenes", lActTarget); DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSpawn));}
When testing the PC makes the motions like he is activating the item but nothing happens. I just tested my My Stone of Recall and works without any problem (and it is using tab-based scripting to work). Because the Stone of Recall works this leads me to believe the problem is in the script I posted above.
What is supposed to happen is that upon activation, the PC summons a creature named Baristhenes. Once I get the summoning part working I'll add in the scripting to make the summond creature join the PC's party.
Any help to fix my script would be appreciated. By the way, how do you properly post scripting code on these forums so it shows correctly?
Thanks!
Here is the script that is in the OnActivate event handler on my module:
#include "69_hench_lib"void main()//******************************************//Added in ExecuteScript( "x2_mod_def_act", OBJECT_SELF); to activate tag-based scripting//*******************************************{ExecuteScript( "x2_mod_def_act", OBJECT_SELF); object oPC = GetItemActivator(); object oTarget = GetItemActivatedTarget(); string sTag = GetTag(oTarget); object oItem = GetItemActivated(); string sItem = GetTag(oItem); object oArea = GetArea(oTarget);
if(sItem == "HenchmanHealKit") { if(GetIsHenchmanDying(oTarget)) { SendMessageToPC(oPC, "Healing Kit Used"); ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_HEALING_S, FALSE), oTarget); SetLocalInt(oArea, "nCHP" +sTag, 2); } else SendMessageToPC(oPC, "This henchman is not dying"); }
if(sItem == "HenchmanLevelupTool") { if(HenchmanCheck69(oTarget, oPC)) { int nHenchXP = GetLocalInt(oTarget, "HENCH_XP"); SetLocalInt(oTarget, "HENCH_XP", nHenchXP + 2000); nHenchXP = GetLocalInt(oTarget, "HENCH_XP"); string sHenchXP = IntToString(nHenchXP); string sHenchName = GetName(oTarget); SendMessageToPC(oPC, sHenchName + " received 2000 experience points."); SendMessageToPC(oPC, sHenchName + " has " + sHenchXP + " experience points."); if(HenchXPCheck69(oTarget)) { LevelUpHenchman69(oTarget, oPC); } } else SendMessageToPC(oPC, "This is not your henchman."); }
}