Poison 10 Posted June 29, 2013 (edited) *donpcevent "<NPC object name>::<event label>"; This command invokes the event label code within an another NPC or NPCs. It starts a separate instance of execution, and the invoking NPC will resume execution its immediately. How about adding argument options for this script command? What do you think guys? *donpcevent "<NPC object name>::<event label>",{<argument1>,<argument2>,...}; Script Example: place,100,100,1%TAB%script%TAB%NPC%TAB%53,{ .@i = rand(1,2); if (.@i == 1) { donpcevent "NPC2::OnEmote",1; } if (.@i == 2) { donpcevent "NPC2::OnEmote",2; } end; } place,102,100,1%TAB%script%TAB%NPC2%TAB%53,{ end; OnEmote: if (getarg(0) == 1) { emotion 1; } if (getarg(0) == 2) { emotion 2; } end; } Edited June 29, 2013 by Poison 1 KeiKun reacted to this Quote Share this post Link to post Share on other sites
jaBote 438 Posted June 29, 2013 This piece of code can already do what you want: set getvariableofnpc(.arg0,"TargetNPC"),1;set getvariableofnpc(.arg1,"TargetNPC"),3;donpcevent("TargetNPC::OnDoFunction");//-----------------------------------// On the other NPCOnDoFunction:callsub "S_Function",.arg0,.arg1; Anyways, I agree your script is way easier. Quote Share this post Link to post Share on other sites
Poison 10 Posted June 29, 2013 (edited) Can these script lines change a variable of an npc remotely? set getvariableofnpc(.arg0,"TargetNPC"),1;set getvariableofnpc(.arg1,"TargetNPC"),3; Would it not be setting the variable of the current npc? .arg0 = 1; .arg1 = 3; Thanks! Edited June 29, 2013 by Poison Quote Share this post Link to post Share on other sites
jaBote 438 Posted June 29, 2013 You could use that for setting variables of the current NPC if you want. However, I think that's overkill since you can set your current NPC variables like this: set .variable, value; For setting an NPC variable with getvariableofnpc, you could use any of these two sentences (but hey, don't do that, you're about to do quite an overkill!): set getvariableofnpc(.var, "Current NPC name"), value;set getvariableofnpc(.var, strnpcinfo(3)), value; However, 'getvariableofnpc' script command is made for getting another NPC's variable and even setting it, just in case you need it. Check out what the doc/script_commands.txt has to say about the 'getvariableofnpc' command: *getvariableofnpc(<variable>,"<npc name>") Returns a reference to a NPC variable (. prefix) from the target NPC. This can only be used to get . variables. Examples: //This will return the value of .var, note that this can't be used, since //the value isn't caught. getvariableofnpc(.var,"TargetNPC"); //This will set the .v variable to the value of the TargetNPC's .var //variable. set .v,getvariableofnpc(.var,"TargetNPC"); //This will set the .var variable of TargetNPC to 1. set getvariableofnpc(.var,"TargetNPC"),1; Note: even though function objects can have .variables, getvariableofnpc will not work on them. Anyways, I agree the structure I've put before is a bit complicated, so I also support your suggestion. Quote Share this post Link to post Share on other sites
Poison 10 Posted June 30, 2013 Okay now its clearer. I would hope that Hercules can implement this suggestion so that scripts can have more flexibility and higher performance. //This will set the .var variable of TargetNPC to 1. set getvariableofnpc(.var,"TargetNPC"),1; Thank you for your support! Quote Share this post Link to post Share on other sites
KeiKun 8 Posted July 5, 2013 me likes this~waiting for herc Quote Share this post Link to post Share on other sites
jaBote 438 Posted November 8, 2013 I've just stumbled upon a situation in which this would be extremely useful. Quote Share this post Link to post Share on other sites