

Muadjin
Member-
Content Count
12 -
Joined
-
Last visited
-
Medals
Community Reputation
1 NeutralAbout Muadjin
-
Rank
Private First Class
-
local and global space ?
Muadjin replied to Muadjin's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
All works fine now, thanks for the help. I 'm using squint now as editor (before 'ArmaEdit') wich is making my coding a lot easier tho it has its disadvantages too. a combo of arma edit and squint would be nice. You know a good editor or plugin for eclipse or visual studio to work with Arma scripts and functions etc. ? -
local and global space ?
Muadjin replied to Muadjin's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Wow, this is a good and complete answer ! Thanks a bunch. I did make a whole series of stupid mistakes tho -> its late here too : almost 2am I guess I have to spend more time on the wiki pages, so overwhelming tho I 'll post back the results later tonight -
local and global space ?
Muadjin replied to Muadjin's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Ok so _test is local. How can make it global (best practice) or pass the value into the function? I tried using access modifiers in the field, but it won't let me. -
Hi, In the onAct field of my script I have this : Dummy1, dummy2 and pvt_patrol are just some npc's. _test = compile preprocessFileLineNumbers "GetPosAlivePlayer.sqf" ; procHandler = [pvt_patrol, ([uS_Dummy1, US_Dummy2] call _test)] execVM "DeleteWPAndCreateAttackWP.sqf"; This script is supposed to return the pos of the first alive player in the array of players that is passed into it. GetPosAlivePlayer.sqf : _grp = _this select 0; _posAlivePlayer; ScopeName main for [{_ix=0},{_ix < (count(_grp))},{_ix=_ix+1}] do { if (alive [_grp,_ix]) then { _posAlivePlayer = GetPos ([_grp, _ix]); breakOut "main"; } } _posaliveplayer; I 'm new to scripting, so the script might not be up to standards or even working properly :). But when I try to pass in the result of the function into the 'DeleteAndCreateAttackWP.sqf' (this script works fine) I get a message (this message pops up when I try to press ok on the trigger window): local variable in global space wich is refering to _test handler I presume. As I understand global, local and public spaces are one way to ensure encapsulation tru access modifiers. But how can I apply it here? And what exactly is going wrong ? function is global right ? _test is a function handler ? -> global ? :eek:
-
Make unit stop immediatly and delete all waypoints!
Muadjin replied to Muadjin's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
The probable downer with my method is that there is a new group made, wich might affect the rest of the logic ( internal group names differ or something?!) .. but that is out of my reach to even start thinkin about that atm :) -
Make unit stop immediatly and delete all waypoints!
Muadjin replied to Muadjin's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
testqsdqsd ---------- Post added at 12:01 AM ---------- Previous post was Yesterday at 11:54 PM ---------- Thanks this works, but I 've told you that already in pm :) since I wasn't allowed to post on the forums anymore. Since I 've noticed I can post again, I 'll post here what I 've found as well : http://community.bistudio.com/wiki/deleteWaypoint : Solution : // bot is the npc object I pass in the function _bot = _this select 0; // player object _play =_this select 1; _i = 0; _bot2Grp = createGroup WEST; {[_x] joinSilent _bot2Grp} forEach (units _bot); _bot2Grp addWaypoint [getPos _play, 1]; -
Make unit stop immediatly and delete all waypoints!
Muadjin replied to Muadjin's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
**I posted a reply twice already as I had found another solution, but they don't seem to reach the thread :s Thank you for taking the time tho, I 'll look into your solution** Just got the script working. http://community.bistudio.com/wiki/deleteWaypoint : Solution : // bot is the npc object I pass in the function _bot = _this select 0; // player object _play =_this select 1; _i = 0; _bot2Grp = createGroup WEST; {[_x] joinSilent _bot2Grp} forEach (units _bot); _bot2Grp addWaypoint [getPos _play, 1]; -
Make unit stop immediatly and delete all waypoints!
Muadjin replied to Muadjin's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Yay, I just found another good tip on the wiki of deletewaypoint wich seems to work fine. http://community.bistudio.com/wiki/deleteWaypoint : Solution : // bot is the npc object I pass in the function _bot = _this select 0; // player object _play =_this select 1; _i = 0; _botGrp = createGroup WEST; {[_x] joinSilent _bot2Grp} forEach (units _bot); _botGrp addWaypoint [getPos _play, 1]; -
Make unit stop immediatly and delete all waypoints!
Muadjin replied to Muadjin's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Thats what I just did in the previous code example mate :) Tho it doesn't seem to work either. The unit just stops and turns around now and then -
Make unit stop immediatly and delete all waypoints!
Muadjin replied to Muadjin's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Thanks, DoStop does make him stop... tho now I can't seem to move him anymore, weird.. perhaps its a little to drastic, cuz it does seem to say in the comments that the unit doesn't move untill the group is engaging an enemy or he gets a command from group leader or something.. all very confusing :) _bot = _this select 0; _play =_this select 1; _i = 0; doStop _bot; while {(count(waypoints _bot))>0} do { deletewaypoint ((waypoints _bot) select 0); } _bot doMove (postion _play); //[group _bot, 0] addWaypoint [position _play, 0]; -
Make unit stop immediatly and delete all waypoints!
Muadjin replied to Muadjin's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Just tested and it doesn't work. Why would you setWaypointPosition after you deleted all the waypoints ? And deleting is not really the problem, and I don't want to add a waypoint(yet), I just want the npc to stop immediatly on his route to the current waypoint. In this case the npc runs all the way to the current waypoint THEN stops and deletes all his waypoints instead of doing it exactly when the trigger activates and the script has run. -
Make unit stop immediatly and delete all waypoints!
Muadjin posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hi, On a trigger activation I pass in an npc into the below function : [pvt_patrol] execVM "Deletewaypoints.sqf"; I want the npc to stop immediatly without finishing his current waypoint(first while lloop) and delete every waypoint (second while loop) What is wrong with my first do/while loop ? Is there any other way to make him stop immediatly and delete his waypoints ? I 'm totaly new to scripting, so this prolly is a silly question, any help is appreciated tho. // bot is the npc object I pass in the function _bot = _this select 0; _i = 0; // Iterate over all the waypoints and set the position of each to the current pos of _bot // so the npc stops moving immediatly -> NOT WORKING while {_i<(count(waypoints _bot))} do { _wp = ((waypoints _bot) select _i); _wp setWPPos [(getPos _bot),0]; _i=_i+1; //sleep 0.125; } // Delete all the waypoints while {(count(waypoints _bot))>0} do { deletewaypoint ((waypoints _bot) select 0); }