Home   Help Search Login Register  

Author Topic: Convoy script  (Read 1804 times)

0 Members and 1 Guest are viewing this topic.

Stalker

  • Guest
Convoy script
« on: 26 Oct 2002, 17:09:20 »
I need a convoy script in which every vehicle will follow the road and will be in order I command them to be. Not just when you group drivers in one group and tanks just go straight forgeting about the road. I tried this script but it doesn't seem to work. Some error.
Quote
_car1 = _select0
_car2 = _select1
_car3 = _select2
_car4 = _select3
_car5 = _select4
_car6 = _select5
_car7 = _select6
_car8 = _select7
_car9 = _select8
_car10 = _select9
_car11 = _select10
_car12 = _select11

_stdis = 15
_limdis = 25

#start

?(_car1 distance _car2 < _limdis):goto "_car2"
_car2 stop false
_car2 SetSpeedMode "normal"
#_car2_e

?(_car2 distance _car3 < _limdis):goto "_car3"
_car3 stop false
_car3 SetSpeedMode "normal"
#_car3_e

?(_car3 distance _car4 < _limdis):goto "_car4"
_car4 stop false
_car4 SetSpeedMode "normal"
#_car4_e

?(_car4 distance _car5 < _limdis):goto "_car5"
_car5 stop false
_car5 SetSpeedMode "normal"
#_car5_e

?(_car5 distance _car6 < _limdis):goto "_car6"
_car6 stop false
_car6 SetSpeedMode "normal"
#_car6_e

?(_car6 distance _car7 < _limdis):goto "_car7"
_car7 stop false
_car7 SetSpeedMode "normal"
#_car7_e

?(_car7 distance _car8 < _limdis):goto "_car8"
_car8 stop false
_car8 SetSpeedMode "normal"
#_car8_e

?(_car8 distance _car9 < _limdis):goto "_car9"
_car9 stop false
_car9 SetSpeedMode "normal"
#_car9_e

?(_car9 distance _car10 < _limdis):goto "_car10"
_car10 stop false
_car10 SetSpeedMode "normal"
#_car10_e

?(_car10 distance _car11 < _limdis):goto "_car11"
_car11 stop false
_car11 SetSpeedMode "normal"
#_car11_e

?(_car11 distance _car12 < _limdis):goto "_car12"
_car12 stop false
_car12 SetSpeedMode "normal"
#_car12_e

~5

goto "start"


;//_car2
#_car2
?(_car1 distance _car2 < _stdis):goto "_car2_2"
_car2 stop false
_car2 Setspeedmode "limited"
goto "_car2_e"

#_car2_2
_car2 stop true
goto "_car2_e"

;//_car3
#_car3
?(_car2 distance _car3 < _stdis):goto "_car3_2"
_car3 stop false
_car3 Setspeedmode "limited"
goto "_car3_e"

#_car3_2
_car3 stop true
goto "_car3_e"

;//_car4
#_car4
?(_car3 distance _car4 < _stdis):goto "_car4_2"
_car4 stop false
_car4 Setspeedmode "limited"
goto "_car4_e"

#_car4_2
_car4 stop true
goto "_car4_e"

;//_car5
#_car5
?(_car4 distance _car5 < _stdis):goto "_car5_2"
_car5 stop false
_car5 Setspeedmode "limited"
goto "_car5_e"

#_car5_2
_car5 stop true
goto "_car5_e"

;//_car6
#_car6
?(_car5 distance _car6 < _stdis):goto "_car6_2"
_car6 stop false
_car6 Setspeedmode "limited"
goto "_car6_e"

#_car6_2
_car6 stop true
goto "_car6_e"

;//_car7
#_car7
?(_car6 distance _car7 < _stdis):goto "_car7_2"
_car7 stop false
_car7 Setspeedmode "limited"
goto "_car7_e"

#_car7_2
_car7 stop true
goto "_car7_e"

;//_car8
#_car8
?(_car7 distance _car8 < _stdis):goto "_car8_2"
_car8 stop false
_car8 Setspeedmode "limited"
goto "_car8_e"

#_car8_2
_car8 stop true
goto "_car8_e"

;//_car9
#_car9
?(_car8 distance _car9 < _stdis):goto "_car9_2"
_car9 stop false
_car9 Setspeedmode "limited"
goto "_car9_e"

#_car9_2
_car9 stop true
goto "_car9_e"

;//_car10
#_car10
?(_car9 distance _car10 < _stdis):goto "_car10_2"
_car10 stop false
_car10 Setspeedmode "limited"
goto "_car10_e"

#_car10_2
_car10 stop true
goto "_car10_e"

;//_car11
#_car11
?(_car10 distance _car11 < _stdis):goto "_car11_2"
_car11 stop false
_car11 Setspeedmode "limited"
goto "_car11_e"

#_car11_2
_car11 stop true
goto "_car11_e"

;//_car12
#_car12
?(_car11 distance _car12 < _stdis):goto "_car12_2"
_car12 stop false
_car12 Setspeedmode "limited"
goto "_car12_e"

#_car12_2
_car12 stop true
goto "_car12_e"

CareyBear

  • Guest
Re:Convoy script
« Reply #1 on: 27 Oct 2002, 11:10:56 »
"Some error or other" isn't really very helpful. I had a play with that script, and it worked fine once I replaced all the < entries with the less than sign (<) - < is what you put in web page source code to create a <, since < is a reserved character in html.
Anyway, to get that script to do anything I had to assign all 12 vehicles to the same squad and place them in column formation.. so that kind of defeats the purpose of using it to avoid having them all in the same group.

You might know this stuff but:

1) All wheeled vehicles in OFP will follow roads to their destinations if they can. The system OFP uses for finding the best path takes surfaces into account. Plonk a jeep at Vernon and a waypoint at Lamentin (eg), then moveInCargo yourself to see it work. The jeep will drive all the way there on the road (though they do sometimes hit trees etc.. I wouldn't give the AI a driver's license)

2) Tracked vehicles will go wherever the hell they feel like, and there's not a lot you can do about it.. I've tried. The best you can do to include tracked vehicles is to put the leader in a soft vehicle, and with column formation they at least go *close* to on the road.

3) All units in a squad will wait for other units if set to 'normal' speed mode. They usually hold a distance of about 20-30 meters for soft vehicles like jeeps or trucks, a little more for armoured vehicles.. it depends. So, if you try the trick in (1) with four or five jeeps / trucks in the group, set them to column formation and normal or limited speed, they will all drive all the way in formation, and will automatically wait for each other.

So I don't really know what that script is meant to achieve... it contains no system for moving the cars that I can see, just for telling them to wait for the one behind if it's lagging. You'd need a ton of waypoints to make this work to get what you want.

If the order of the vehicles is desperately important, then create them in the editor as being in their own groups, then add them to the group of the first vehicle in the order you want them to be in using the join command in a script. Whatever order you add them in will be the order of the column.

IE: when you want to make the convoy, put them all into that group, then when you get there, split them apart again.

The only other way to do it is some kind of _car1 domove (getpos _car2); _car2 domove (getpos _car3... etc etc  in there as well, but a scripting solution will have to be pretty well written to cope with all the possible problems.. like.. what if one vehicle gets destroyed? Or damaged? Now all of a sudden you've got a guy on foot, so the whole convoy goes at his speed..

Basically, my advice would be to use the built-in stuff for group manuvering. It may suck, but it's a hell of a lot easier than coding an alternative yourself. Try and work with the game's systems, rather than against them.. it's a lot easier, and OFP copes better.

Cheers

CareyBear
« Last Edit: 27 Oct 2002, 11:19:49 by CareyBear »

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Convoy script
« Reply #2 on: 27 Oct 2002, 14:22:56 »
Quote
Tracked vehicles will go wherever the hell they feel like, and there's not a lot you can do about it.. I've tried. The best you can do to include tracked vehicles is to put the leader in a soft vehicle, and with column formation they at least go *close* to on the road.

not exactly  :P put em on safe mod nd dey will drive on da road  ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

The_Milky_Bar_Kid

  • Guest
Re:Convoy script
« Reply #3 on: 27 Oct 2002, 23:35:12 »
A convoy doesn't actually need a script (unless there are more than 12 units in the convoy).  Simply group all the units together, create a waypoint for where you want them to go and set:

Behaviour= Safe
Formation= Column

Hope that helps.

Stalker

  • Guest
Re:Convoy script
« Reply #4 on: 28 Oct 2002, 09:26:14 »
There IS more than 12 people in the convoy. And it is not mine script. I said that I have used it to make a convoy but it doesn't work. And when I use join command tanks goes first. Everytime !