OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: shadow99 on 03 Aug 2004, 03:42:21

Title: Invincible Units
Post by: shadow99 on 03 Aug 2004, 03:42:21
Hah, I've decided to ask all the little questions that have always bugged me all at once. I should have limited to one thread instead of posting them as I thought of them, though. Sorry about that.

Anyway, my question is, is there anyway to make a COMPLETELY invincible unit?

You see, I want the player to be in a group, and the leader of this group to stay alive throughout the whole mission (being one of the campaign's main characters).

Quote
this setCaptive true
works to some extent but there's still a chance the leader could be killed by an out of control grenade, a tank explosion, etc...

There must be a script to keep completely invincible somehow. What about something like this in a trigger:

Condition:
Code: [Select]
not alive leader1
On Activation:
Code: [Select]
Alive leader1
or something? I'm sure 'alive leader1' isn't a command, but it's an idea to keep him alive if he's killed.

It would be good though, if damage didn't effect him in any way. That way, the player would never be stuck with a leader that has to crawl through the whole mission.

Is any of this possible? Through a script, maybe?
Title: Re:Invincible Units
Post by: olseric on 03 Aug 2004, 03:47:37
Create a simple script:

#loop
? (damage player > 0): player setdamage 0
goto "loop"

Just one idea...
Title: Re:Invincible Units
Post by: Dubieman on 03 Aug 2004, 04:28:51
Easy, make a trigger the size of the area where the leader will be and make it repeating and then:

Condition: Not Alive unitname
Activision Field: unitname setdammage 0

There you go. Don't try it on yourself though. This just brings the unit back to life quickly, the onplayerdeath.sqs will still run and you'll still be dead if you use it for the player. :P


Title: Re:Invincible Units
Post by: shadow99 on 03 Aug 2004, 04:31:41
Simply wonderful. What did you say about the onplayerdeath.sqs though GRK?

Thank you Olseric, as well.
Title: Re:Invincible Units
Post by: Dubieman on 03 Aug 2004, 04:51:47
I heard about this automatic script that executes once the player reaches at least a dammage of 1. Then I think it starts that little death scene with a quote and who killed you and all that. But I just heard that, I've never messed with it. :P
Title: Re:Invincible Units
Post by: macguba on 03 Aug 2004, 09:45:13
If you really want to make him invincible do the setdammage thing as suggested, and do the setcaptive thing too (alhough nobody will shoot at him.    Better yet, add an eventHandler "hit".

The script onPlayerKilled.sqs is launched automatically when the player dies.    It shows you the standard little scene you get when you die.   If you want to create a custom version you can - just put a script file of that name in your mission folder.    You are very strongly advised to use the original as a template because there are certain things (like variables being set) that must happen during this script for the game to work correctly.
Title: Re:Invincible Units
Post by: shadow99 on 03 Aug 2004, 09:51:27
After reading through everything, I decided upon using the 'setDamage 0' thing, but I chose NOT to do:

Code: [Select]
this setCaptive true
Why?

Because if the leader is somehow wounded the legs and has to crawl around, that's a long time he's crawling trough the whole mission...

However, if he's not a captive, the enemies will go to the extent of finishing him off. And when they do, he is returned to full health, and his legs will no longer restrict him to crawling...
Title: Re:Invincible Units
Post by: minimilo on 03 Aug 2004, 20:13:19
last night i tried in the activation of a trigger

unitname setdammage -100

i know the code took effect because my player went a bit wierd and his gun was goung up and down, any ideas how i can get more health
Title: Re:Invincible Units
Post by: Dubieman on 04 Aug 2004, 01:28:27
Too much life in the bastard, a few aK bullets here, a few more there, then a head shot, and we're okay! :D ;D

I dunno about giving people negative life ratings like that.

If you give a tank a setdammage 15, the hulk of metal is VERY black. Doesn't look like a tank almost. :P

But I dunno about units...
Title: Re:Invincible Units
Post by: shadow99 on 05 Aug 2004, 06:40:57
Interesting, I'll give it a shot. Thanks for the info...
Title: Re:Invincible Units
Post by: shadow99 on 05 Aug 2004, 06:50:00
Actually, setDammage 15 doesn't do anything but instantly kill the unit... not even with a tank does it do as you said...

Where did you get the idea?

Anyway, it was a thought. thanks
Title: Re:Invincible Units
Post by: Kaliyuga on 05 Aug 2004, 08:49:19
 I've always heard rumors of numbers above 1.0 resulting in more damage, bigger explosions.. etc..   but I've never seen it work personally...

its 100% damaged.. you can get much more than that :p

;D
Title: Re:Invincible Units
Post by: olseric on 05 Aug 2004, 10:53:31
Actually, if you peruse the forums here and the "official" ones, you'll see posts related to the various levels of setDamage.

Basically, shadow99 was correct in saying that bigger numbers don't do anything, however, someone posted that if you setDamage a tank to, say, 4, it'll blow bigger.   I have tested that and found that it doesn't work.

I have, however, found that negative damage numbers will create a drunk-like character.  The "more negative" the number, the more intoxicated your guy will seem.  I have no clue how it affects actually taking lead.
Title: Re:Invincible Units
Post by: Dubieman on 05 Aug 2004, 16:39:05
 Actually I tried it a long while back. There was no big explosion but I think it wasn't 15 it looked blacker on like 2 or 3.... :P :-\

Title: Re:Invincible Units
Post by: Tomb on 05 Aug 2004, 20:11:13


 ??? is there anyway to make a COMPLETELY invincible unit?




 8) The coolest "Arnoldinvinsiblemuthafrikkinslayer" will always be the PBO'ed custom unit. :o ;D

 :) it takes no more then a tweaked config; and the part to change is just this:

 armor=1000000000000;

There!    A 100% bullet proof soldier, ready to eat shells & rockets of any kind  ::) ;D


Later :-*
Title: Re:Invincible Units
Post by: Artak on 05 Aug 2004, 20:36:02
Quote
There!    A 100% bullet proof soldier, ready to eat shells & rockets of any kind

How about drowning? What if I get hit by an LGB 17 times and fly into the sea. Would my poo bastard drown?
Title: Re:Invincible Units
Post by: Federalist on 05 Aug 2004, 23:17:27
You can fix the onplayerkilled.sqs problem by simply making a custom onplayerkilled.sqs and leaving it blank. That way the little cutscene with the inspiring quotes won't play when you die.
Title: Re:Invincible Units
Post by: Dubieman on 05 Aug 2004, 23:24:03
Quote
If you want to create a custom version you can - just put a script file of that name in your mission folder.    You are very strongly advised to use the original as a template because there are certain things (like variables being set) that must happen during this script for the game to work correctly.
::)
Title: Re:Invincible Units
Post by: THobson on 07 Aug 2004, 16:19:41
Does this link give you what you want  (See reply #5)?

http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=18512

Quote
Putting the following in the Initialisation field of a soldier:

this addEventHandler ["killed",{this setdammage 0}]; this addEventHandler ["Hit",{this setdammage 0}]  

Seems to work.  He even survives a satchel charge exploded under his feet - once he has landed that is!!  It is very strange to watch.

No scripts needed