Home   Help Search Login Register  

Author Topic: setCurrentWaypoint not working well in MP  (Read 1352 times)

0 Members and 1 Guest are viewing this topic.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
setCurrentWaypoint not working well in MP
« on: 03 Apr 2009, 00:41:54 »
In a script I want some AI groups to move to a spot based on a detected trigger and the solution works super well in editor, but not in MP and I have no idea why. I believe I've executed the scripts correctly.

The groups consist of 1 MI17 and 15 Especas that should get in (load waypoint), be flown away, dropped off, seek and destroy, get in again, be flown home.

The groups have 5 WPs set in editor and the WPs are moved based on the trigger.

The WPs are:

0 Neglected since it is created at start position.
1 LOAD
2 UNLOAD
3 SEEK AND DESTROY
4 LOAD
5 UNLOAD (vehicle this land "land") - placed from the start at heli's position, so no distance.

PROBLEM: On a dedi they usually start right away from mission start even though they shouldn't and sometimes they don't move to where they should at all.

init.sqs
Code: [Select]
? isServer : group mi1 setCurrentWaypoint [group mi1, 5]
? isServer : group mi2 setCurrentWaypoint [group mi2, 5]
? isServer : group mi3 setCurrentWaypoint [group mi3, 5]
? isServer : group mi4 setCurrentWaypoint [group mi4, 5]
? isServer : group mi5 setCurrentWaypoint [group mi5, 5]

heliinsertion.sqs
Code: [Select]
if (! isServer) then {exit}


_hunthelo = _this select 0
_prey = _this select 1
_home = _this select 2
_hunters = group _hunthelo

{_x setbehaviour "AWARE"} foreach units _hunters

~ 1

? _prey distance formationLeader _hunthelo <= 500 OR ! alive _hunthelo OR ! canMove _hunthelo : goto "ver2"



#ver1

[_hunters, 1] setWaypointPosition [position formationLeader _hunthelo, 0]
[_hunters, 2] setWaypointPosition [position _prey, 300]
[_hunters, 3] setWaypointPosition [position _prey, 0]
[_hunters, 4] setWaypointPosition [position _prey, 300]
[_hunters, 5] setWaypointPosition [position _home, 0]

_hunters setCurrentWaypoint [_hunters, 1]

exit



#ver2

[_hunters, 1] setWaypointPosition [position formationLeader _hunthelo, 0]
[_hunters, 2] setWaypointPosition [position _prey, 300]
[_hunters, 3] setWaypointPosition [position _prey, 0]
[_hunters, 4] setWaypointPosition [position _prey, 300]
[_hunters, 5] setWaypointPosition [position _home, 0]

_hunters setCurrentWaypoint [_hunters, 2]

exit


_prey is a unit detected in the trigger and chosen by: spotted = thislist select 0
_home is an empty H

Grateful for advice.

Laggy
« Last Edit: 03 Apr 2009, 00:53:08 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.