Home   Help Search Login Register  

Author Topic: vehicle question  (Read 1093 times)

0 Members and 1 Guest are viewing this topic.

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
vehicle question
« on: 06 Feb 2005, 16:13:48 »
I need a script that will detect whether a tank or APC is manned by 2 (or 3) players.  I want to force players in an MP game to man a tank as gunner and driver, so if someone just jumps in the drivers seat, the tank won't go unless a player jumps in as gunner, and vice versa.  Seems an application of the crew command, but can't figure out what to do next.
  Another twist is, once a tank is manned and entered in to combat, sometimes one but not all crew members will be killed, so the tank needs to be useable for the survivor.  Hope this makes sense...............

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:vehicle question
« Reply #1 on: 06 Feb 2005, 18:58:16 »
Ideas you could implement that would help you achieve your goals


1) remove and when ready add fuel to the vehicle

... xx setfuel 0
... xx setfuel 1

2) Run a "getin" and "getout"eventhandler on the vehicle
... makes for an easy and efficient way to monitor your crew count
... eg getin activates script that:
..... checks crew count
..... adds fuel to vehicle if crewcount >1
..... locks the  vehicle if crewcount >1, so they cant get out

... eg "getout" activates script that:
..... checks crew count
..... removes fuel from vehicle if crewcount <2

3) runs a "hit" eventhandler on the vehicle
... runs a script that:
.....checks to see damage
.......... if damage is bad, unlocks vehicle so crew can escape
.......... runs a crew count check, if <2 removes fuel



hope that gives you an idea how to approach your problem
« Last Edit: 06 Feb 2005, 18:59:50 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Zombie

  • Members
  • *
  • Beware the night, the zombie walks among you
    • USI
Re:vehicle question
« Reply #2 on: 09 Feb 2005, 23:39:16 »
couldn't figure out eventhandlers, so I use this script:
Code: [Select]
#start
_vcl = _this select 0
? (getdammage _vcl) => .5 :goto "end"
? count crew _vcl == 1 :goto "warn"
goto "start"
#warn
player groupchat "Damn, I need another crewmember, I better call one"
_vcl setfuel 0
@count crew _vcl ==2
_vcl lock true
player groupchat "That's better, let's go"
_vcl setfuel 1
@ (getdammage _vcl) => .5: _vcl lock false
#end
exit

problem is, the getdammage lines return unknown operator..I know I am missing something simple....anyone see it?

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:vehicle question
« Reply #3 on: 10 Feb 2005, 01:06:30 »
#start
~1
_vcl = _this select 0
? (getdammage _vcl) > 0.49 :goto "end"
? count crew _vcl == 1 :goto "warn"
goto "start"
#warn
player groupchat "d**n, I need another crewmember, I better call one"
_vcl setfuel 0
@count crew _vcl >1
_vcl lock true
player groupchat "That's better, let's go"
_vcl setfuel 1
@ (getdammage _vcl) >0.49: _vcl lock false
#end
exit

***************************************************

how to use eventhandlers.

Place the following lines in the init field of the vehicle
(remember to use a ; between each line

this addEventHandler ["Getin", {_this exec "myGetin.sqs"}]
this addEventHandler ["GetOut", {_this exec "myGetout.sqs"}]
this addEventHandler ["Hit", {_this exec "myHit.sqs"}]

and then just run what scripts are needed for each event

Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123