Espectro (DayZ) 0 Posted December 28, 2006 Hi there I can't make the following command work using dedicated server: onmapsingleclick "grp move _pos" It works fine when I just preview in the editor... But for some reason nothing happends when I connect to my server. Any known issues with this? Cheers Share this post Link to post Share on other sites
sickboy 13 Posted December 28, 2006 onmapsingleclick is only ran local, so you will need a system that sends the position to the server while the server executes the move to pos I think, as the command need to be executed on the pc where the units are local... You could try using my network services lite for that: http://www.flashpoint1985.com/cgi-bin....t=56464 If you have questions about the package though... please use that thread, thank you Share this post Link to post Share on other sites
raedor 8 Posted December 28, 2006 OMSC is executed locally. If group is AI, it is local on server and "move" probably only works on local units. Share this post Link to post Share on other sites
sickboy 13 Posted December 28, 2006 Solution that should work (with the NS-Lite): Â In some init script, mission, later scripting moment: unit_that_needs_the_action Addaction ["Move Group", "scripts\mapclick.sqf"]; scripts\mapclick.sqf:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">onMapSingleClick "[_pos,nameoftheunit] exec ""scripts\sendmapclick.sqs"""; scripts\sendmapclick.sqs:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">call compile format["[0,""[%1,%2] execVM """"scripts\moveunit.sqf""""""] call six_fn_Netsend",_this select 0,_this select 1]; scripts\moveunit.sqf:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(_this select 1) domove (_this select 0); To execute the script on server and client, change the [0, Â to [2, and use the six_isServer boolean in the moveunit.sqf script to determine if it should execute the move, or in case of client... don't execute the move but do a hint of somesorts You can also remove the moveunit.sqf and make scripts\sendmapclick.sqs:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">call compile format["[0,""%2 doMove %1""] call six_fn_Netsend",_this select 0,_this select 1];. But then ur missing an easy and readable possibility to execute different things on client and server if you wish Please let me know if it works btw as it's written from mind without test Share this post Link to post Share on other sites
raedor 8 Posted December 28, 2006 call format should be call compile format. My solution: grpMove.sqf:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (local (leader _this)) then { while {true} do { MoveToPos = ""; waitUntil {MoveToPos != ""}; _this move call compile MoveToPos; };} init.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">grp execVM "grpMove.sqf"; onMapSingleClick 'MoveToPos = str(_pos); publicVariable MoveToPos' But also untested. Share this post Link to post Share on other sites
sickboy 13 Posted December 28, 2006 call format should be call compile format. Already edited that one out a few mins ago ) But nice and compact btw Nice way to 'pack' and 'unpack' arrays into strings and visa versa btw you write init.sqf... I simply thought there would not be a init.sqf as the missions still work on init.sqs, nice if you can also use the init.sqf! Share this post Link to post Share on other sites
raedor 8 Posted December 28, 2006 Nice way to 'pack' and 'unpack' arrays into strings and visa versa Yep, but you have to take care, as the strings can get pretty long very fast. In this case you could eg remove all digits after the comma, as it is absolutely useless bandwidth useage Share this post Link to post Share on other sites
sickboy 13 Posted December 28, 2006 Nice way to 'pack' and 'unpack' arrays into strings and visa versa Yep, but you have to take care, as the strings can get pretty long very fast. In this case you could eg remove all digits after the comma, as it is absolutely useless bandwidth useage Thanks, that init.sqf was not a typo, yes? BTW just figured out that execVM is not allowed within onmapsingleclick... haven't seen that in the BIKI yet, guess I should get into BIKI-editing Share this post Link to post Share on other sites
raedor 8 Posted December 28, 2006 Nice way to 'pack' and 'unpack' arrays into strings and visa versa Yep, but you have to take care, as the strings can get pretty long very fast. In this case you could eg remove all digits after the comma, as it is absolutely useless bandwidth useage Thanks, that init.sqf was not a typo, yes? BTW just figured out that execVM is not allowed within onmapsingleclick... haven't seen that in the BIKI yet, guess I should get into BIKI-editing Yep, it was not a typo. Why is execVM not allowed? Did you try<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">dummy = [...] execVM ...As execVM returns the script handle... Share this post Link to post Share on other sites
sickboy 13 Posted December 28, 2006 Why is execVM not allowed? Did you try<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">dummy = [...] execVM ...As execVM returns the script handle...It gave: Type script, expected bool... I wasn't able to check it myself yet, will do tonight Share this post Link to post Share on other sites