Home   Help Search Login Register  

Author Topic: Invincible vehicle?  (Read 1593 times)

0 Members and 1 Guest are viewing this topic.

Mr.BoDean

  • Guest
Invincible vehicle?
« on: 17 Oct 2003, 13:37:19 »
I want to keep a chopper alive until he's done with all of his drops. I made a little script to loop, but it doesn't seem to work ...one stinger and it goes down.  Is there a better way?

Code: [Select]
_helidmg = getdammage Mi17
?!(local server) : exit

#FixChop
?_helidmg >= .2 : Mi17 setdammage 0
~1
goto "FixChop"
     :-X

Knut Erik

  • Guest
Re:Invincible vehicle?
« Reply #1 on: 17 Oct 2003, 13:52:44 »
Try to use event handlers!

Chopper1 addEventHandler ["Hit","Chopper SetDammage 0"]
Chopper1 addEventHandler ["Killed","Chopper SetDammage 0"]

 8)

deaddog

  • Guest
Re:Invincible vehicle?
« Reply #2 on: 17 Oct 2003, 14:13:36 »
Or if that doesn't work, try removing the stingers from the AA soldiers until the chopper is done.  

I've also tried setcombatmode "blue" before on AA soldiers, but it didn't always work.  They would fire anyway.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Invincible vehicle?
« Reply #3 on: 17 Oct 2003, 14:27:48 »
Here is a wild idea.   There is somewhere an invisible target addon.     Get hold of it and make a loop setpossing it say 50m behind the chopper.    Now create another looping script, checking the distance of the target from any AA soldier:   if he is close enough the AA loon gets doTarget and doFire commands on the target, so it looks like he is shooting at the chopper and missing.

Would be a bit of work but it would be a cool effect if it works and it might solve the problem of the chopper being shot down.      
Plenty of reviewed ArmA missions for you to play

Torak

  • Guest
Re:Invincible vehicle?
« Reply #4 on: 17 Oct 2003, 15:20:39 »
Is there any way of keeping units in general alive? For instance, in one cutscene I'm trying to have a Humvee column moving through a town, being shot at all along (you'd never guess I've seen BHD too many times, would you?), but the gunners always get shot halfway through.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Invincible vehicle?
« Reply #5 on: 17 Oct 2003, 16:13:57 »
Event handlers and looping scripts are your best bet.     As far as I know there isn't a magic wand you can wave to make them indestructible.  

Your loop can setdammage 0 the unit, or perhaps setpos or moveingunner a new unit, or whatever you like really ... depends on the circumstances.
Plenty of reviewed ArmA missions for you to play

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Invincible vehicle?
« Reply #6 on: 17 Oct 2003, 21:17:36 »
Actually, event handlers are pretty much a "magic wand" that can create invincible units. Like Knut Erik said:

this addEventHandler ["Hit","(_this select 0) SetDammage 0"]

put that in the init field of a unit, and it becomes invincible. You can even make yourself (the player) un-killable with this. Try to see how far you can blow yourself away with pipebombs. It's rather fun to be flung 100 meters through the air by a huge explosion, then just walk away ;D

I guess there are a couple limits, though. First, a unit has to suffer at least 5% damage in a single hit for the eventhandler to go off. So an MG bullet hitting a chopper isn't going to set off the eventhandler (but a stinger will). Also, if you increase the time acceleration to x2 or x4, sometimes the computer won't register the eventhandler on time, and the unit will die.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Mr.BoDean

  • Guest
Re:Invincible vehicle?
« Reply #7 on: 17 Oct 2003, 23:33:30 »
Wow, thanks for the ideas, guys.   :D  I will probably go with eventhandlers, then , cuz I will need to guard against not only but those pesky self-thinking human types, too.  ;D
I was actually hoping for something like the chaff "defensive measures" system used on the BAS Blackhawks . I thought maybe the BAS Mi17 and Mi24 issued with the MaH60 addon would include that system, but I really saw no difference from the BIS version.  :-\
  Has anyone de-pbo'd the BAS BH's for scriptage?

Also, if I just put the eventhandler in the unit's init., it will act continuously throughout game ? i.e. .... multiple hits, multiple repairs?
« Last Edit: 17 Oct 2003, 23:35:11 by Mr.BoDean »

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Invincible vehicle?
« Reply #8 on: 18 Oct 2003, 03:04:25 »
Eventhandlers will continue to function until they are removed. One way to remove them is with the command: unit removealleventhandlers "type" (ie. "hit","killed" etc). Also, adding an eventhandler returns a number, just like adding an action to a unit returns a number. Then you can call the command: unit removeeventhandler number. Usually event handlers are removed at the end of the script that is executed by the event handler.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Mr.BoDean

  • Guest
Re:Invincible vehicle?
« Reply #9 on: 18 Oct 2003, 12:07:47 »
Ok, thx all. Just what I needed ....works great.

@Gen.Barron and all:
? ..if you deletevehicle a unit/group that is running a script, does that effectively terminate the script , so that it is no longer involving CPU time? Or do you still need to use that removeeventhandler  and/or cause the script to be exited?
« Last Edit: 18 Oct 2003, 12:08:19 by Mr.BoDean »

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Invincible vehicle?
« Reply #10 on: 18 Oct 2003, 23:38:53 »
Mr. BoDean,

I believe that event handlers are basically "traits" or "properties" (I'm not sure what the proper word is) of the specific unit that they are added to. Just like health, skill, fuel level, etc. I assume that once the unit is deleted, the game stops keeping track of the eventhandler (as well as health/fuel/etc).

Scripts are another issue. Scripts are not "run on a unit". Even though you may pass a unit to the script (this exec "blah.sqs"), the script still runs independent of that unit. You could pass a unit to a script and then never even refer to that unit in the script. All scripts run until the code in the script says to exit. So you should always make it so that your script will exit once a unit is either dead or deleted.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Mr.BoDean

  • Guest
Re:Invincible vehicle?
« Reply #11 on: 20 Oct 2003, 09:02:27 »
Ah, Okay! Good info, Gen'l ...thanx!  ;)