Home   Help Search Login Register  

Author Topic: Invincibility  (Read 1538 times)

0 Members and 1 Guest are viewing this topic.

Offline Captain Crunch

  • Members
  • *
Invincibility
« on: 10 Jun 2003, 00:37:33 »
Hi!

   I checked the Editors Depot for a script that would make objects undestructable but haven't found anything. So I thought making one myself.

I can't do it. I tried this here:

In the "Init" field of the object:        [This] Exec "DontDie.sqs"


And the script looks like this:


_Obj = _This Select 0

#Loop

? ! (Alive _Obj) : GoTo "Live"

GoTo "Loop"

#Live

_Obj SetDammage 0

GoTo "Loop"

Any ideas?

 
Back to the forest!

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Invincibility
« Reply #1 on: 10 Jun 2003, 00:43:15 »
it shud work on nythin oder dan da player - cuz da game get dat he is dead b4 nythin else - also i sugest u add lil dely or it wil overuse resources  :o

also dere was thread bout dat - check search function - i think eventhandlers r good enough ;D

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

Babalon

  • Guest
Re:Invincibility
« Reply #2 on: 10 Jun 2003, 01:03:44 »
I'm at work, so I'm winging it here, hopefuly someone else can fix whatever little mistakes i make, or test it out.

Make sure every unit you want this ot run on has a name.
Put this in the init:
this exec "thisscript.sqs";

Make a script and put this in it.
Quote
#loop
?((getdamage _this) = 0) : goto "loop"

_this setdamage = 0
goto "loop"

exit

This is a loop.  0 is 100% health in OFP, 1 is dead.  So if its health is 100%, it keeps looping and checking.  If it isn't 100%, it goes to a command that sets the dammage level to 100% (IE fully healed).  If this works is I posted (I will check it out later when i get home, unless someone else volunteers), then there are only two questionable issues.

1) If a person is killed with one hit (like a direct hit from a HEAT round), will they die or not?  I know for sure if a person is hit and is 99% damaged (0.99 in script terms), it should fully heal them, but dont know about something like a one-shot-kill.

2) It may conflict with some other scripting.  IE if a plane is flying and hits a mountain, somewhere in the OFP scripting it is saying "setdamage = 1" to all units inside that plane.  So will this little script be able to counter-act another script tellign the unit to die?

This is something I would like to find out myself.  Might come in handy to have a god-mode script around for some DM or CTFs.

Offline Captain Crunch

  • Members
  • *
Re:Invincibility
« Reply #3 on: 10 Jun 2003, 01:06:51 »
Nothing. I checked the threads but couldn't find it.

I'll try scripting around the daisies a little!

 ;D
Back to the forest!

Offline Captain Crunch

  • Members
  • *
Re:Invincibility
« Reply #4 on: 10 Jun 2003, 01:09:49 »
Oh! Thanx Babalon!

  I forgot to refresh the page before replying!

I'll try it out!

Thanx again!
Back to the forest!

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Invincibility
« Reply #5 on: 10 Jun 2003, 01:13:30 »
didnt find ???

wuzut ???

u just donno how 2 search :P

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

Offline Captain Crunch

  • Members
  • *
Re:Invincibility
« Reply #6 on: 10 Jun 2003, 17:45:02 »
I do, just don't feel like it!

  I let the others do it for me!  ;D

Just kiddin' man! :P

Thanx a lot LCD!  :D
Back to the forest!

Offline Tomb

  • Contributing Member
  • **
  • in2 Metal? Go 2 my sig
Re:Invincibility
« Reply #7 on: 10 Jun 2003, 19:17:54 »
Actually, the best way to make hard a$$ troopers is to tweak their cpp


put:

Armor=1000000;


in the unit's defines, and you have a winner!  8) ;D



(normal unit armor is around 5)



Sgt.Zeke

  • Guest
Re:Invincibility
« Reply #8 on: 10 Jun 2003, 20:20:40 »
So what is the final script?

Offline Captain Crunch

  • Members
  • *
Re:Invincibility
« Reply #9 on: 10 Jun 2003, 23:31:24 »
I tried the one from Babalon and it works. (Had to slightly correct it)

Code: [Select]
#Loop
?((GetDammage _This)  == 0) : GoTo "Loop"

_This SetDammage  0
GoTo "Loop"

The only problem is that if unit or object is destroyed or killed in one shot then it won't work.

I couldn't try LCD's way, I don't have resistance yet.  :'(

Back to the forest!

Babalon

  • Guest
Re:Invincibility
« Reply #10 on: 11 Jun 2003, 01:08:34 »
Actualy, lets do a hybrid

Take my script you enhanced, and instead of health, make that sucker for Armor.

If it's Armor doesn't == 10000, then have it go through the loop and set it to so.

However one big problem here, i don't know of many commands that retrieve armor status, and that can change a unit's armor status.

If we dont have many command coices, just make a repeating loop, that goes every 0.5 seconds (to reduce lag), and just sets the armor to 10000.

IE
Quote
#loop
~0.5
Armor = 10000
goto "loop"

God knows if that will work.  Defenetly some exploration to do here.

I have yet ot encounter something that gives a unit more than 10000 hit points (though i should check some of those nukes out there).

I think we may be onto something here.  Unless LCD can tell me where this suposedly "Already created" script is for it.  I looked, cant find squat.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Invincibility
« Reply #11 on: 11 Jun 2003, 04:25:54 »
@ Baba

da armor thingy wil only work in .cpp files (as makin new addons) ;) :P - so ur script is not exactly good

bout da already created script - deres da eventhandlers lines nd if u check dat thread igor put link dere (dis 1 is linkin 2 wat igor lined  :o  ;D)

qoutes from da thread

Quote
#loop
_this setdammage 0
~0.01
?!alive _this:_this setdammage 1;exit
goto "loop"

just need 2 remove da ?! alive thingy ;) ;D

nd i think u can find toughguy script somwere in da ED ;D

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