Home   Help Search Login Register  

Author Topic: BP vests?  (Read 1719 times)

0 Members and 1 Guest are viewing this topic.

j-man

  • Guest
BP vests?
« on: 30 Nov 2003, 08:46:09 »
I was wondering if there was any way to simulate a unit with a bulletproof vest? Mabey putting somthing in the unit int. field?

8 Ball

  • Guest
Re:BP vests?
« Reply #1 on: 30 Nov 2003, 10:03:39 »
Put this in the init field of the unit

this addEventHandler ["hit", {_this select 0 setdammage 0}]

That will set the units dammage to 0 whenever it's hit. :)

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re:BP vests?
« Reply #2 on: 30 Nov 2003, 10:04:29 »
Not in the Init line unless he's an AI unit. The player unit will be as bullet absorbant as normal. I think that the BAS Rangers have bullet proof vests. They seem to take more bullets when I shoot them anyway.

Here's the bit to make AI double hard. I'm not sure of the exact syntax.

Condition:         NotAlive joebloggs
Activation field:  Joebloggs setdammage 0

Group the trigger to joe bloggs and set it to repeatedly.
It's not very good though.  :(
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re:BP vests?
« Reply #3 on: 30 Nov 2003, 10:06:57 »
Grr 8ball you beat me.

Showed me summit I didn't know too.
 ::)  ;D
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

gundernak

  • Guest
Re:BP vests?
« Reply #4 on: 30 Nov 2003, 13:40:08 »
what if they got shot in the head....

Can we distinguish where the hit gone?

8 Ball

  • Guest
Re:BP vests?
« Reply #5 on: 01 Dec 2003, 10:07:12 »
Yep, you can. Here's a little script I wrote. Put the script in your mission file and put this in the init field:

guy addeventhandler ["dammaged", {[_this select 0,_this select 1,_this select 2,MAXDAMMAGE] exec "BPV.sqs"}]

Note- Maxdammage is the amount of dammage the vest can take before its penetrated.
----------------------------------------------------------------------------------------------------------------------------

; Script By - 8BAll (Adam); E-mail -admd89@netscape.net
;Syntax-
;guy addeventhandler ["dammaged", {[_this select 0,_this select 1,_this select 2,MAXDAMMAGE] exec "BPV.sqs"}]
;What it all means...
;"guy addeventhandler ["dammaged", = add's the eventhandler "dammaged" to the unit "guy"
;_this select 0 = gets the name of the unit that was dammaged.(In this case the unit named "guy"
;_this select 1 = get part of body dammaged
;_this select 2 = get amount of dammage
;MAXDAMMAGE =  Put a value from 0 to 1. This is the max amount of dammage the vest can take.
 

; Define your variables
_unit = _this select 0
_body = _this select 1
_dammage = _this select 2
_maxdammage = _this select 3

;If unit is in vehicle exit
? vehicle _unit != _unit : exit

;If the bullet hit something other then the chest exit
? _body != "telo" : exit

;If dammage is greater then the max dammage exit
? _dammage >= _maxdammage : exit

;Have the unit's dammage go back to the dammage he was before as if  the "vest" stopped the bullet
_olddam = (getdammage _unit) - _dammage
_unit setdammage _olddam

exit
----------------------------------------------------------------------------------------------------------------------------

All that does is detect if the bullet hit the chest. That way the bullet can still hit the head and any where else on the body and cause guy to die. ;)

gundernak

  • Guest
Re:BP vests?
« Reply #6 on: 01 Dec 2003, 18:56:28 »
amazing... :-X

...what I actually do not understand:

;_this select 1 = get part of body dammaged

based on this what will detect which part dammaged :-\

8 Ball

  • Guest
Re:BP vests?
« Reply #7 on: 02 Dec 2003, 10:12:43 »
The eventhandler will ;)

When you add an eventhandler, you tell OFP to wait until a ceartin event happened.(And then do some sort of consequence).  When the event happens, the eventhandler returns an array with values in it. In the case of the dammage eventhandler, it returns :
                                         1-the guy who was hit
                                         2-What part of the body got hit
                                         3-How much dammage was taken by the guy.
You could use these variables in a script (use "_this select index" to pass the variables to the script) or do just about anything else you want. Thats why eventhandlers are so great. You could do a lot of stuff using eventhandlers.  ;D

Note - The different parts of the body are "nohy" for legs,"ruce" for the hands, "hlava" for the head, and "telo" for the torso

Basic Syntax for eventhandlers = unit addeventhandler ["Event" , {action}]

You can get a list of all eventhandlers in the editors depot.  ;)

gundernak

  • Guest
Re:BP vests?
« Reply #8 on: 02 Dec 2003, 14:57:40 »
thanks, clear ;)

Is it true that eventhandlers are much faster than a trigger with condition and activation...

Because I was trying to cheating by unlimited health. In trigger's cond: getDammage and on act: setDammage...

And setDammage sometimes did not work, and my unit died, other case his health restored to max...

Offline desper8

  • Members
  • *
  • REBEL Council member
    • http://rebel.clanzone.at/board/
WOW BP vests
« Reply #9 on: 02 Dec 2003, 23:00:45 »
Woooo!
This $hit goes deep!!!

how comes my "help run people over question"
couldn't be answered!!!
like i said before DAMN COLLISION DETECTION
 ???
friendly clan battle any one?
PM me

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:BP vests?
« Reply #10 on: 03 Dec 2003, 03:28:37 »
@8Ball,

instead of [_this select 0,_this select 1,_this select 2,maxdammage] exec "scriptname.sqs"

you could say:

[_this,maxdammage] exec "scriptname.sqs"

and inside the script you can still access the three sub-elements
of this by:

_whatever = _this select 0

_unit = _whatever select 0
_body = _whatever select 1
_dammage = _whatever select 2

_maxdammage = _this select 1


That way you could save a few nano-seconds, it takes more
to pass 2 more parameters from the EH to the script.

This might not look worth to be mentioned, but fact is:

it results in assigning one variable less than how it was
before.

May become important when there are some more shots
being fired onto that guy  ;)

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

deaddog

  • Guest
Re:BP vests?
« Reply #11 on: 03 Dec 2003, 03:37:48 »
If you are simply trying to cheat death then do this:

#loop
~.05
player setdammage 0
goto "loop"

This should cause no appreciable lag and you can forget about the complicated code.  Unless you get hit by heavy explosives then this should do the trick.