Home   Help Search Login Register  

Author Topic: making units indestructible  (Read 950 times)

0 Members and 1 Guest are viewing this topic.

Mr.T

  • Guest
making units indestructible
« on: 15 May 2003, 06:56:01 »
I was wondering if anyone can tell me how to make stock OFP objects such as Player units and vehicles indestructible.

This is for a multiplayer map im making. Is there a line of code that i should include in the objects Init field?


Thanks,


Mr.T
« Last Edit: 15 May 2003, 06:56:22 by Mr.T »

O Neil

  • Guest
Re:making units indestructible
« Reply #1 on: 15 May 2003, 07:38:57 »
Hey

I was just gonna ask this, as in, don't you type :

                           Alive Unitname
In the condition feild ?

If so, are you SURE it works ?

O Neil ;)

Mr.T

  • Guest
Re:making units indestructible
« Reply #2 on: 15 May 2003, 07:51:20 »
Hey

I was just gonna ask this, as in, don't you type :

                           Alive Unitname
In the condition feild ?

If so, are you SURE it works ?

O Neil ;)


I think that just returnes wether or not that unit is alive... it doesnt make them stay alive....


 not sure

O Neil

  • Guest
Re:making units indestructible
« Reply #3 on: 15 May 2003, 08:58:00 »
Oh, yea I had a feeling...

O Neil ;)

Knut Erik

  • Guest
Re:making units indestructible
« Reply #4 on: 15 May 2003, 09:45:48 »
You could create a script...

_object = _this select 0

#Alive
@getdammage _object < 0.25
_object setdammage 0
~0.01
?!alive _object : goto "end"
goto "alive"

#end
exit


Not sure about the syntax, but at least you'll se where I'm going..

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:making units indestructible
« Reply #5 on: 15 May 2003, 10:18:56 »
put in its init

this addeventhandler ["hit","this setdammage 0"]; this addeventhandler ["killed","this setdammage 0"]

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

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:making units indestructible
« Reply #6 on: 15 May 2003, 22:03:11 »
None of these will reliably work becuase when a unit is killed the AI of the unit is completely disbaled, even if you bring it back to life.  :-[

A script that constantly sets a units damage to 0, won't save anyone from a bullet to the head.

A script such as knut erics's is the best way to make units really tough...not indestructable but tough.

I'd make the script like this:

Code: [Select]
#Alive
_object setdammage 0
~0.01
?!alive _object :exit
goto "alive"
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline Tomb

  • Contributing Member
  • **
  • in2 Metal? Go 2 my sig
Re:making units indestructible
« Reply #7 on: 15 May 2003, 22:38:30 »
the engine can take faster loops then that, toadster mate, like:

~0.00000001

 or even worse.... it's up to yer CPU/RAM  :)

'course, in MP one should prolly keep the slowest PC in mind...



PS - most machines should be able to eat a delay of some ~0.0001
 :-*



« Last Edit: 15 May 2003, 22:39:52 by Tomb »

Mr.T

  • Guest
Re:making units indestructible
« Reply #8 on: 16 May 2003, 02:02:48 »
None of these will reliably work becuase when a unit is killed the AI of the unit is completely disbaled, even if you bring it back to life.  :-[

A script that constantly sets a units damage to 0, won't save anyone from a bullet to the head.

A script such as knut erics's is the best way to make units really tough...not indestructable but tough.

I'd make the script like this:

Code: [Select]
#Alive
_object setdammage 0
~0.01
?!alive _object :exit
goto "alive"

Sorry guys im a bit of a n00b at this. Toadlife where would i incude this code int the ext or a sqs file? Can i put it in the units Init field?

Thanks for the input so far.

Much appreciated,

Mr.T



Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:making units indestructible
« Reply #9 on: 16 May 2003, 02:09:39 »
ok save this script as "toughguy.sqs", and put it iny our missions folder.

Code: [Select]
#loop
_this setdammage 0
~0.01
?!alive _this:_this setdammage 1;exit
goto "loop"

For every unit that you want to make tough, put: this exec "toughguy.sqs" in their init feild.
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Mr.T

  • Guest
Re:making units indestructible
« Reply #10 on: 16 May 2003, 05:16:54 »
Excellent Thanks a bunch!


Finally i might be able to get my map to work.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:making units indestructible
« Reply #11 on: 16 May 2003, 08:19:12 »
no "[]"?

And Mr T. Are ya da same guy as Mr T at the swedish PCG forum?

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:making units indestructible
« Reply #12 on: 16 May 2003, 11:01:32 »
no "[]"?

No you don't have to pass an array to a script. If you are just passing one variable to a script, why put it inside of an array?

"_this" is the variable that you pass to a script...it can be an array which contains multiple variables, or just a single variable. In the exmaple I posted above, there was only one variable that needed to be passed to the script so there was no need for me to put it inside an array. It saves keystrokes. :)
« Last Edit: 16 May 2003, 11:03:14 by toadlife »
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:making units indestructible
« Reply #13 on: 16 May 2003, 12:56:54 »
@ toady - i saw somwere dat da eventhandlers work b4 da game itself react2 da death ;) worth checkin isnt it ? ;)

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