Home   Help Search Login Register  

Author Topic: Triggering AI to move?  (Read 1580 times)

0 Members and 1 Guest are viewing this topic.

Offline Absolution

  • Members
  • *
Triggering AI to move?
« 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:
Code: [Select]
//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?

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Triggering AI to move?
« Reply #1 on: 16 Jun 2010, 11:28:19 »
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:

Code: [Select]
_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
« Last Edit: 16 Jun 2010, 11:30:06 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Absolution

  • Members
  • *
Re: Triggering AI to move?
« Reply #2 on: 17 Jun 2010, 03:17:51 »
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?

Code: [Select]
//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";

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Triggering AI to move?
« Reply #3 on: 17 Jun 2010, 13:29:27 »
Yes  :)
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline Inkompetent

  • Members
  • *
Re: Triggering AI to move?
« Reply #4 on: 18 Jun 2010, 19:27:30 »
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:

Code: [Select]
_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";