OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: Absolution on 16 Jun 2010, 05:24:48
-
Scenario: When any BLUFOR player enters a trigger it causes a group of OPFOR to spawn and follow a set of waypoints.
Problem: OPFOR spawn okay but then they just stand there looking lost.
Set up: I created a trigger that activates an SQS and placed 3 markers on the map. One marker is the spawn point. The other two markers are waypoints 1 and 2.
Code:
//create the group
grpe1 = Creategroup east
//create the units in the group
"RU_Soldier" createUnit [getMarkerPos"wr1",grpe1,"",1,"Corporal"];
"RU_Soldier" createUnit [getMarkerPos"wr1",grpe1,"",1,"Corporal"];
"RU_Soldier" createUnit [getMarkerPos"wr1",grpe1,"",1,"Corporal"];
//set the variable
_group1 = grpe1;
//add waypoint 1
[_group1,1] addwaypoint[getmarkerpos"wp1",0];
[_group1,1] setwaypointtype "MOVE";
//add waypoint 2
[_group1,2] addwaypoint[getmarkerpos"wp2",0];
[_group1,2] setwaypointtype "CYCLE";
exit
In Addition: Assuming I can get them to move where I want how do I make them move there a certain way? Specifically, I want them to move at a walking pace.
Anyone see the issue?
-
Don't know if it really matters, but scripted WPs have more specific details.
I would guess the WP statement "true" is at least needed.
Try:
_wp1 = _group1 addWaypoint [getmarkerpos "wp1", 0];
[_group1, 1] setWaypointStatements ["true", ""];
[_group1, 1] setWaypointTimeout [0, 0, 0];
[_group1, 1] setWaypointBehaviour "AWARE";
[_group1, 1] setWaypointCombatMode "RED";
[_group1, 1] showWaypoint "NEVER";
[_group1, 1] setWaypointSpeed "NORMAL";
[_group1, 1] setWaypointType "MOVE";
If in MP, only execute the script on the server.
Laggy
-
Thanks that fixed the first issue but now I got a new one... they go to wp1 but then stop and do not continue to wp2. Should be as simple as adding in a new waypoint the same way as before and naming it something else, right?
//add waypoint 1
_wp1 = _group1 addWaypoint [getmarkerpos "wp1", 0];
[_group1, 1] setWaypointStatements ["true", ""];
[_group1, 1] setWaypointTimeout [0, 0, 0];
[_group1, 1] setWaypointBehaviour "AWARE";
[_group1, 1] setWaypointCombatMode "RED";
[_group1, 1] showWaypoint "NEVER";
[_group1, 1] setWaypointSpeed "LIMITED";
[_group1, 1] setWaypointType "MOVE";
//add waypoint 2
_wp2 = _group1 addWaypoint [getmarkerpos "wp2", 0];
[_group1, 2] setWaypointStatements ["true", ""];
[_group1, 2] setWaypointTimeout [0, 0, 0];
[_group1, 2] setWaypointBehaviour "AWARE";
[_group1, 2] setWaypointCombatMode "RED";
[_group1, 2] showWaypoint "NEVER";
[_group1, 2] setWaypointSpeed "UNCHANGED";
[_group1, 2] setWaypointType "CYCLE";
-
Yes :)
-
I actually think that [group1,2] refers to a nonexisting waypoint (their 3rd waypoint. Scripted units probably don't have their index zero waypoint where they start, although I'm not 100% on this) so that there's some oddity with indexing. Although I'm not really sure how one set of wp-definitions should work and not the other o0
Non the less, this is what I usually do and it works like a charm for me; I use the variable name:
_wp1 = _group1 addWaypoint [getmarkerpos "wp1", 0];
_wp1 setWaypointStatements ["true", ""];
_wp1 setWaypointTimeout [0, 0, 0];
_wp1 setWaypointBehaviour "AWARE";
_wp1 setWaypointCombatMode "RED";
_wp1 showWaypoint "NEVER";
_wp1 setWaypointSpeed "LIMITED";
_wp1 setWaypointType "MOVE";