Home   Help Search Login Register  

Author Topic: Activating script with getdamage  (Read 2001 times)

0 Members and 1 Guest are viewing this topic.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Activating script with getdamage
« on: 30 Jan 2003, 21:24:38 »
getdammage  >= 0.2


I want a vehicle, a helicopter in this case to execute a script, when its damage is say for instance

getdammage >= 0.2 AND getdammage <= 0.6

There is a vehicle respawn script running in the background that checks for damage, that I could put the exec lines into
But my syntax seems to fail
Example
 ?(getdammage _vcl >= 0.2):goto "rotorfailure"
 
#rotorfailure
Hint "Tail rotor dead"
[]exec "tailrotor.sqs"

I put a hint message in to debug and it isnt activated, so it isnt even getting that far



An other alternative is to put the argument and exec "tailrotor.sqs" into the "INIT" field of the chopper itself.
I have tried various statements but cant seem to get it right.


Here is the vehicle script
Quote
;Chopper respawn no ammo
 ~1
 ?!(local Server): exit  
 _vcl = _this select 0
 _class = _this select 1
 _rspn = _this select 2
 _azimut = _this select 3  
 #start0
 _vcl lock False
 ~5
;; ?(getdammage _vcl >= 0.2):goto "rotorfailure"
 ?(getdammage _vcl > .01):goto "Lost"
 ~2
 ?(count crew _vcl > 0):goto "start1"  
 ~5
 goto "start0"
 ;*************************************************************
 #start1
 ?!(Alive _vcl):goto "end"
 ?(count crew _vcl == 0):goto "Lost"
 ~10
 goto "start1"
 ;*************************************************************
 #Lost  
 ~5
 ?!(Alive _vcl):goto "end"
 ~30
 ?!(Alive _vcl):goto "end"  
 ~30
 ?!(Alive _vcl):goto "end"
 ?(count crew _vcl == 0):goto "end"
 ?(count crew _vcl > 0):goto "start1"
 ;goto "start0"
 ;*************************************************************
 #end
~30
 _vcl setfuel 0
 ~1
 _vcl setdammage 1
 deleteVehicle _vcl
 ~10
 _vcl = _class createVehicle getpos _rspn
 _vcl setdir _azimut
 _vcl lock False  
?(_class == "sebuh_1gs"): _vcl removeweapon "sebuh1zuni48"
?(_class == "sebah_1j"): _vcl removeweapon "sebah1towlauncher"
?(_class == "sebah_1j"): _vcl removeweapon "sebah1zuni38"
?(_class == "sebuh_1guns"): _vcl removeweapon "sebah1zuni14"
?(_class == "sebah_1a"): _vcl removeweapon "sebah1zuni76"


 goto "start0"
 
#rotorfailure
Hint "Tail rotor dead"
;;[]exec "tailrotor.sqs"
;;if (Player in thisList) then { vehicleRadio [format["Mayday!\n Mayday\n"We lost the tail rotor\nWe are going down",name (thisList select 0)],"Plain down"]
goto "lost"

you can see by the ;; comments where i tried to put my lines
------------------------------------------------------------------------------------------------------------------------------
Thanks in advance for any help
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Kaliyuga

  • Guest
Re:Activating script with getdamage
« Reply #1 on: 30 Jan 2003, 21:32:41 »
If all you want to do is activate a script when the chopper is damaged between those two amounts is do this:

 make yourself a   0 X 0 trigger....

in the condition field of the trigger put:

getdammage >= 0.2 AND getdammage <= 0.6

and in the activation field put:

Hint "Tail rotor dead" ;  []exec "tailrotor.sqs"

should work for you as far as I know..

:cheers:

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Activating script with getdamage
« Reply #2 on: 31 Jan 2003, 00:08:26 »
I could do that, but there's 12 choppers,  what i initially want to do is play around with the setdamage values until i find the gameplay balance and then have all 12 choppers activate the script if their damage is X amount

I thought, seeing as i use only 1 respawn script for the choppers, a line or two in the script would be better than 12 triggers

the actual script i want to run, is something that replicates the effect of a chopper losing its tail rotor.

Its a nam chopper frenzy(Plane Frenzy) fun map and if i find a nice balance, its something i will use for all future ,maps that use choppers, so ideally i want to incorporate it into the respawn script

« Last Edit: 31 Jan 2003, 00:12:11 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

teeBore

  • Guest
Re:Activating script with getdamage
« Reply #3 on: 07 Feb 2003, 08:39:24 »
Well, if you want to modify your respawn script, you can't just do a getDammage then and there as the choppers will be brand new and 'unhurt', (I know that's not what you meant), so basically you could include in tailrotor.sqs a bit of code that runs a loop to constantly check the 'dammage' of a heli, but keep in mind that you can only run one tailrotor.sqs at a time, so you would have to have 12 different scripts running at one time, ie tailrotor1.sqs, tailrotor2.sqs, etc etc.

So what I suggest you do is in your respawn script or another script that is run at init time, include the following code:
Code: [Select]

;array consisting of all the choppers you want to check for damage
_chopperArray = [heli1, heli2]
_heli = 0
#loop

_damage = getDammage ( _chopperArray select _heli)
if(( _damage >= 0.2)&&( _damage <= 0.6))
{
    [_chopperArray select _heli] exec "tailrotor.sqs"
    ;so this code doesnt exec tailrotor.sqs again on the same chopper :)
    ( _chopperArray select _heli) setDammage 0.19
}

_heli = _heli + 1
goto #loop


(Don't use the above as it only runs thru the heli array once)
Hope you get the idea, it basically runs thru each of your choppers and checks their damage, so yeah you are gonna have to have a script running constantly in the background which may not be what you want, but I can't think of anything else.

Cheers,
teeBore

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Activating script with getdamage
« Reply #4 on: 07 Feb 2003, 16:13:21 »
Thx
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123