Hyroshima Posted July 27, 2019 Share Posted July 27, 2019 (edited) hlw, would anyone tell me how to execute a callfunc "func", param1,param2; in src (função de npc script existente!) ? one skill will call callfunc "func", 1, skill_id; I need to pass param1 = 1, param2 = skil_level Edited July 27, 2019 by Hyroshima Quote Link to comment Share on other sites More sharing options...
0 Tokei Posted July 28, 2019 Share Posted July 28, 2019 Heya, You can't do that (not without major changes anyway). I presume the goal here is to run a script in the source (which is a bad idea), but the easy solution here would simply be to set your variables as temporary global variables and then run an event label: In the source, you would use something like: #include "mapreg.h" #include "npc.h" [...] mapreg_setreg(reference_uid(add_str("[email protected]"), 0), MG_SAFETYWALL); mapreg_setreg(reference_uid(add_str("[email protected]"), 0), skill_id); mapreg_setregstr(reference_uid(add_str("[email protected]$"), 0), "a string"); npc_event_do_id("MyScript::OnCalled", sd->bl.id); And in the script: function script myfunction { announce "arg1: " + getarg(0) + ", arg2: " + getarg(1) + ", arg3: " + getarg(2); return; } - script MyScript -1,{ end; OnCalled: callfunc("myfunction", [email protected], [email protected], [email protected]$); end; } It would be much easier to do the code in the source directly instead though. 1 1 Quote Link to comment Share on other sites More sharing options...
0 Naruto Posted July 27, 2019 Share Posted July 27, 2019 try using the code it was written with DUHHHHHHHHHHHH check your script.c Quote Link to comment Share on other sites More sharing options...
hlw, would anyone tell me how to execute a
callfunc "func", param1,param2;in src (função de npc script existente!) ?
one skill will call callfunc "func", 1, skill_id;
I need to pass param1 = 1, param2 = skil_level
Edited by HyroshimaLink to comment
Share on other sites