Home   Help Search Login Register  

Author Topic: Convoy problem  (Read 959 times)

0 Members and 2 Guests are viewing this topic.

Wolf

  • Guest
Convoy problem
« on: 26 Jun 2003, 19:47:49 »
Alright, I have a small convoy problem, I have a bunch of vehicles grouped together, and some have seperate squads in them. Now, the player is to ambush this convoy, but the exact location of where a human player will decide to ambush this convoy is unknown to me, so I need to have the ability to have the convoy travel along, and if ambushed at any location, stop, and unload its troops to engage the ambushers. How would I go about this?
Thanks.

MadFred

  • Guest
Re:Convoy problem
« Reply #1 on: 26 Jun 2003, 20:20:33 »
Hi

I could be totally off as you perhaps WANT a solution that guarantees you the correct outcome, but whenever I use ambushes in missions, I never include something special to make the defenders attack, as usually when they are engaged the men get out of their trucks and engage their attackers. (unless on careless of course) and tanks or APC's also turn against the attackers when fired upon.


Kaliyuga

  • Guest
Re:Convoy problem
« Reply #2 on: 26 Jun 2003, 20:52:54 »
 Well.. I'm crap with syntax and such.. but here's the theory.


A getdammage trigger for the convoy with just a small amount of damage needed to set it off, and a whole mess of unassign vehicle,and eject kinda stuff for the dudes riding along in the vehicles.

deaddog

  • Guest
Re:Convoy problem
« Reply #3 on: 26 Jun 2003, 21:19:33 »
You could use a "hit" event handler on each truck.  When it is hit the group inside can be "ejected" and then a "hunting" script could be executed.

truck1 addeventhandler ["hit",{_this exec "hit.sqs}]
do this for every truck

;hit.sqs:

_truck=_this select 0
_truck removealleventhandlers "hit"

_truck setfuel 0
@speed _truck==0

_cargo=crew _truck - driver _truck ( or possibly [driver _truck] )
_cargogroup=group(_cargo select 0)

?count _cargo==0:exit

_i=0

#getout
_u=_cargo select _i
_u action ["eject",_truck]
unassignvehicle _u

~1
_i=_i+1
?_i<count _cargo:goto "getout"

[_cargogroup] exec "hunt.sqs" (use whatever group hunting script you can find or write)

exit

This could be one way to do it without having to worry about the groupnames of the units in the trucks.

« Last Edit: 26 Jun 2003, 21:44:22 by deaddog »

Wolf

  • Guest
Re:Convoy problem
« Reply #4 on: 26 Jun 2003, 21:40:24 »
Hmmm, well Madfred, you are right, I would like a more reliable solution, and I need the troops to move and engage the ambushers too.

I don't know if that would work, the convoy seems to be moving fairly quickly, and if I eject them, there more likely to die from the speed of the convoy, and if they even managed to survive the ejection, would likely get themselves run over but the following armored vehicles.

I will try what is suggested here, but I think a more reliable means will be nessasery.

deaddog

  • Guest
Re:Convoy problem
« Reply #5 on: 26 Jun 2003, 21:43:16 »
@Wolf

I think you could stop the convoy easily by setting the fuel state on all vehicles to 0.  At least until the infantry are out of the way.

I added that to the code above.  May have to play with it a little to get it to look right.
« Last Edit: 26 Jun 2003, 21:45:00 by deaddog »

Wolf

  • Guest
Re:Convoy problem
« Reply #6 on: 26 Jun 2003, 21:47:31 »
ok, You edited that while I posted my reply, darn you. ;D
I'll give this a try, thanks.

deaddog

  • Guest
Re:Convoy problem
« Reply #7 on: 26 Jun 2003, 21:49:13 »
I was hoping I would be finished editing my last post before you read it  ;D ;D

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re:Convoy problem
« Reply #8 on: 27 Jun 2003, 01:08:50 »
Where is LCD when you need him? I lifted this script from one of his replies to this same type of question. I was going to modify the UAZ reference and try to use it a mission I am working on. Take a look!

Code: [Select]
;make detection triger name it (in da name field - not da text field) - make da trig bout 50-50 size nd put ;in it UAZ_DETECT = true


;exec it
;[nameoftriger,nameofvehicle] exec "scriptname.sqs"

;now make da next script by LCD


;Code:


_trig = _this select 0
_UAZ = _this select 1
#loop
_trig setpos getpos _UAZ
~1
? UAZ_DETECT : goto "engage"
goto "loop"

#engage
_ppl = crew _UAZ
"unassignvehicle _X" foreach _ppl
"[_X] order getin false" foreach _ppl
"_X setcombatmode {red}" foreach _ppl
"_X setbehaviour {danger}" foreach _ppl
@ "_X in _UAZ" count _ppl < 1
~1
"_X reveal (_trig select 0)" foreach _ppl
exit

A little simpler for my skill level and but I have not tested it yet. It lacks a stopping method also so it would need that inserted I suppose. Now I have a choice in scripts!

                                              Wadmann
Check out my Camouflage Collection! New items added 31 July 2005.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Convoy problem
« Reply #9 on: 27 Jun 2003, 01:14:53 »
LCD is alwayz around :P ;D

but im just 2 lazy @ 2 am 2 right ythin (but it usualy pass in 2-3 mins ::))

nywayz its kool u found dat 1 - at last som1 uses da search  8) :wow:

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

rancor_man67

  • Guest
Re:Convoy problem
« Reply #10 on: 27 Jun 2003, 02:20:16 »
How did they do it in the single player mission?? That was a fixed location though, wasn't it??



Rancor.

deaddog

  • Guest
Re:Convoy problem
« Reply #11 on: 27 Jun 2003, 02:47:30 »
I did some experimenting.  You don't need any scripts to make a group get out of a truck under fire.

Shoot at the truck, the truck stops, the infantry gets out and the truck keeps going.  I found this out because the "hit" event handler does not seem to work for trucks.

The main problem here is that I would imagine only the group under fire will disembark, not all groups in all trucks.  You can solve this by monitoring the leader of each infantry group.  If any leader gets out during transit, then eject all of the groups and set the fuel state of all trucks to 0.
« Last Edit: 27 Jun 2003, 02:58:29 by deaddog »

deaddog

  • Guest
Re:Convoy problem
« Reply #12 on: 27 Jun 2003, 15:20:13 »
Wolf,

I put together a little demo mission.  Three trucks with three infantry (4 man) squads.  Shoot any truck and the infantry will get out and hunt you down.

Wolf

  • Guest
Re:Convoy problem
« Reply #13 on: 27 Jun 2003, 18:51:36 »
Thanks, I'll try this.
I've been fooling around with the first script there some.
Trying to figure out how to get it to work.
Btw, I suppose I should have mentioned this, all the vehicles in the convoy are armored vehicles, some armed, some not, will this still work with them?

deaddog

  • Guest
Re:Convoy problem
« Reply #14 on: 27 Jun 2003, 21:28:12 »
Quote
Btw, I suppose I should have mentioned this, all the vehicles in the convoy are armored vehicles, some armed, some not, will this still work with them

I didn't try that.  I don't know if they will automatically exit from anything other than a truck.

Maybe we could turn the approach around.  Have a "fired" event handler attached to the player.  When he shoots and is within a certain distance from the convoy, they will exit their vehicles.  You can say that they "hear" the shot and want to investigate.