PDA

View Full Version : Adding marker of something with addAction



zukas3
Jul 9 2012, 10:26
Hello everyone, As I got deeper into SQF scripting I thinked il try out to make something more with addAction, and I seem to fail with making a marker to appear on location where addAction has been used.
For example I made stash that spawns in random places and when you find it you can come to it and do addAction (locate) which will make a marker on map so everyone could see on the map but I seem to fail,
here is what SQF looks like, please ignore everything else I made in the script but note me what I did wrong, Thank you for your time.


_actHad = _this select 0;
_actUsed = _this select 1;
_actID = _this select 2;
_myXpos = (getPos _actUsed) select 3;
_myYpos = (getPos _actUsed) select 4;
_actHad removeaction _actID;
_actUsed sidechat "I found the stash!";
titleText ["Stash has been found!","PLAIN DOWN"];
_markerstr = createMarker["stashHere",[_Xpos,_Ypos]];
_markerstr setMarkerShape "ICON";
"stashHere" setMarkerType "DOT";

cuel
Jul 9 2012, 10:39
_myXpos = (getPos _actUsed) select 3;
_myYpos = (getPos _actUsed) select 4;


This isn't valid. getPos returns [xPos,yPos,zPos] so you can't select 3 and 4. That's outside the array size.
To get the xpos/ypos use this


_myXpos = (getPos _actUsed) select 0;
_myYpos = (getPos _actUsed) select 1;


And you're not using the variables that you declared above down here:



_markerstr = createMarker["stashHere",[_Xpos,_Ypos]];


You can also use _markerstr instead of using the actual marker name.



//"stashHere" setMarkerType "DOT";
_markerstr setMarkerType "DOT";


Look at this:
http://forums.bistudio.com/showthread.php?121163-Script-not-working-Use-the-showScriptErrors-parameter!

zukas3
Jul 9 2012, 11:18
Thanks for the response il try this out and say how it turned out, also I have tried -showScriptErrors before but it made my game crash on bad scripts :(

Edit: Thanks it all worked, just -showScriptErrors still becomes unknown reason.. Thanks again!