OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: greg147 on 22 Mar 2005, 18:44:11

Title: Near invincible AI
Post by: greg147 on 22 Mar 2005, 18:44:11
Hi all,
Is there a way to make AI take more shots to kill? Say, if you shoot him in the chest, theres blood and everything, but he takes 5 or so more shots to kill?
I'm trying to do it to make key squad members stay alive longer.  ;)

Thanks.
Title: Re:Near invincible AI
Post by: GI-YO on 22 Mar 2005, 19:18:29
i've never tryed this but you could try something like

Loon setdamage 0

goto loop ~ 1

The syntax is no doubt wrong, but should give you a start. Hope that helps.

GI-YO
Title: Re:Near invincible AI
Post by: bedges on 22 Mar 2005, 19:27:18
alternatively, use an event handler for the loons. slightly quicker. so for example,

Code: [Select]
this addeventhandler ["hit", _this setdamage 0]

in the init field should make the ai loon in question unkillable, although i seem to recall this being unhelpful when it came to explosions.
Title: Re:Near invincible AI
Post by: RujiK on 22 Mar 2005, 19:49:47
No good for what he said, that will make him totally unkillable (Almost). Luckally I was making the worlds most interesting mission (and still am) And it consisted of a boss that you had to kill, here is what you may want to try just put [unitname] exec "Nameofscript.sqs"

Code: [Select]
_unit = _this select 0
_reduction = 5
#loop
_dmg = getdammage _unit
@(getdammage _unit != _dmg)
_dmggvn = getdammage boss - _dmg
_dmgamount = (_dmggvn * (1 / 5))
_dmgfinal = _dmg + _dmgamount
_unit setdammage _dammagefinal
?(getdammage boss >= 0.8):_unit setdammage 1
goto"reset"

For more health change the reduction number, the higher the number the more health.
Currently he will take a fifth of defualt dammage so hes pretty tough.
Or, if you want a more basic script try this:
Code: [Select]
_unit = _this select 0
_lives = 5
#reset
_dmg = getdammage _unit
@(getdammage _unit != _dmg)
_unit setdammage 0
_lives = _lives - 1
?(_lives <= 0):hint"Hes outa Lives!";exit
goto"reset"
This script he will have EXZACTLY five lives, so he will take 5 times as many hits.
Title: Re:Near invincible AI
Post by: greg147 on 22 Mar 2005, 21:18:29
Thanks for the replys  ;)

I'll try those ideas, and post back if I have any problems  ;D
Title: Re:Near invincible AI
Post by: Wadmann on 22 Mar 2005, 23:06:29
If you wanted something to simulate a bullet proof vest, take a look at this topic (http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=14454;start=0).

Although you may not survive even one hit if it is to your head, it does keep you alive long enough to try to get out of the line of fire, If you do not, then the next thing you know you are getting a bird's eye view of the battle.  ;)


                                                           Wadmann
Title: Re:Near invincible AI
Post by: Flauta on 23 Mar 2005, 03:34:54
anyone knows if it is possible to asing a unit via init or sometihing else to "setdammage -1" or lesss? this maybe will help... but i dont thing it worsk... :p

please respond!!


thanks
Title: Re:Near invincible AI
Post by: The-Architect on 23 Mar 2005, 08:02:34
You want something like this.

http://www.ofpec.com/editors/resource_view.php?id=239
Title: Re:Near invincible AI
Post by: greg147 on 23 Mar 2005, 11:32:31
Aha, thanks. I'll use that script  ;)

@Flauta
Unforunatly, setdamage -1 doesn't work.
In fact, it has a very different outcome.
It makes the AI and player have really HD guns  ;D
Title: Re:Near invincible AI
Post by: Roni on 24 Mar 2005, 00:10:02
How about a damaged EH -

this addeventhandler ["dammaged", _this setdamage (getDammage _this * 0.5)]

This should (?) reduce any non-lethal damage to a character by 50%.  It won't save him from a head shot but it should stop him being picked apart by multiple hits.



roni
Title: Re:Near invincible AI
Post by: RujiK on 25 Mar 2005, 03:15:46
Actually that could even reduce your dammage when you get hit. Because it will be reducing your ENTIRE dammage by half, not just the dammage given, there the unit will almost be invincable.