Home   Help Search Login Register  

Author Topic: WP limit?  (Read 2083 times)

0 Members and 1 Guest are viewing this topic.

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:WP limit?
« Reply #15 on: 04 Jan 2006, 13:13:50 »
Well, like I said:

a) YOU CAN'T PV ARRAYS. That's why you make an object and PV that.
b) The pathfinding routine _does_ time out and give up at a certain distance. Either calculate intermediate waypoints, or give an error and force the user to select a closer waypoint..
« Last Edit: 04 Jan 2006, 13:19:31 by Dinger »
Dinger/Cfit

Offline Roni

  • Members
  • *
  • Play the Game !
Re:WP limit?
« Reply #16 on: 15 Jan 2006, 04:03:55 »
Hi SG

I don't know if this helps but I just finished (after LOTS of effort !) a hunt and seek script that continuously sends a hunting group towards the last known position of a target group.  It sounds like it is similar to what you are looking to do.

The script itself is kind of complex (since I have the hunting group stop for lunch, set up camp at night, play sounds audible clues as it closes in on its target etc), but the hunting routine is pretty straightforward.

All I've done is give the hunting group one single waypoint, then in the script defined the hunting unit and its group and the target unit and its group and then set _commander lockWP true.  I then keep moving that waypoint whenever the hunting group reaches it or any of the other defined situations occur.  The main loop therefore looks something like this -

;      If commander team has been wiped out then exit
? _headCount < 1 : titleText[format["Team %1 has been wiped out !", _commanderName], "Plain"], exit


;      If head count < rout number then go to rout routine
? _headCount < _routNumber : goto "routRoutine"


;      If head count back to rout number then reset waypoint position
? (_headCount == _routNumber)  && _routing   : hint format ["Team %1 is back in action!", _commanderName]


;      If waypoint < 50m away then reset waypoint position
_distanceToWaypoint = sqrt((((_wayPointPos select 0) - (_commanderPos select 0))^2) + (((_wayPointPos select 1) - (_commanderPos select 1))^2))
? _distanceToWaypoint < 50 : goto "huntRoutine"


;      If confidence is high then reset waypoint position
? _commander knowsAbout _targetUnit > 3 : goto "huntRoutine"


;      If group is not elite and time is after 12PM then stop for lunch
? (daytime > 12) and (daytime < 13) and !(_elite)   : goto "lunchRoutine"


;      If group is not elite and time is after 7PM then set up camp
? (daytime > 19) and !(_elite) : goto "campRoutine"


;      If hunter is not elite then give players a clue as to the range to their pursuers, continue loop
? _elite : goto "loop"

Etc



I use the script with a separate respawn script that keeps restocking the hunting group as it takes casualties.  Different groups have different respawn rates and types so that some spawn quickly but produce crap (eg conscript groups), some spawn slowly but take almost 100% casualties to get off your back (elite groups), some are cowardly but come back quickly (eg recon groups).  That way you can drive the hunters away for a while, but unless you kill off every last unit it will eventually come back and track you down !

It sounds like all you need is the above lockWP true command and some way of updating the waypoint on player input (eg onMapSingleClick).

Hope that this helps.

Cheers



Roni