Home   Help Search Login Register  

Author Topic: checking if player is dead  (Read 1568 times)

0 Members and 1 Guest are viewing this topic.

Offline dalton

  • Members
  • *
  • i R n00b
checking if player is dead
« on: 17 Jan 2005, 14:57:28 »
i want a script that checks if the player is dead, and if he isnt then i want setdammage 0. would that be like this?:

Code: [Select]
?(alive playername): setdammage 0
"freedom aint free"

Offline dalton

  • Members
  • *
  • i R n00b
Re:checking if player is dead
« Reply #1 on: 17 Jan 2005, 15:00:58 »
or maybe its something like this?

Code: [Select]
?(player dammage<1):player setdammage 0
« Last Edit: 17 Jan 2005, 15:01:44 by dalton »
"freedom aint free"

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:checking if player is dead
« Reply #2 on: 17 Jan 2005, 15:34:34 »
I understand that you want the script to give player's health back if he's just injured, right?

Put it in a trigger.

Condition: player damage > 0

On activation: player setdammage 0

And type of the trigger should be repeatedly.

Not tested, but it should work that way. I don't know how it works if the player's damage reaches 1. Is he dead then or does this keep him still alive?

Test it.

Where you are going to use this... Hmm...

  ::)

EDIT

The answer to your first question:

?(alive playername): setdammage 0

should be

?(alive player) : player setdammage 0

in a _script_.

But use the trigger method, if you just want to check if player is injured and heal him.
« Last Edit: 17 Jan 2005, 16:04:47 by Baddo »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:checking if player is dead
« Reply #3 on: 17 Jan 2005, 17:03:38 »
Once the player is dead, that's it, mission over.    You can bring the unit back to life if you like, but you won't be able to control it.

You can use

player addEventHandler [{Hit}, {_this select 0 setDammage 0}]

and I also add a setDammage 0 loop in a wee script.     But the trigger should also work.
Plenty of reviewed ArmA missions for you to play

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:checking if player is dead
« Reply #4 on: 17 Jan 2005, 18:19:51 »
Making a player unkillable is impossible with OFP's scripting unless you use special units.
This is because there is no condition in the "OnPlayerKilled.sqs" that rechecks if the player is killed.

However if you want your player too be invincible change his Type in the mission.sqm file from "SoldierGB" (Example) too "SoldierGCheat". SoldierGCheat is a special unit that cannot be accessed in game unless you have special addons.

However this unit is almost impossible too kill and really doesnt even need a heal script.
I like your approach, lets see your departure.
Download the New Flashlight Script!

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:checking if player is dead
« Reply #5 on: 17 Jan 2005, 18:41:59 »
The addeventhandler is much better.

But the 'Hit' event handler does not help if you want to also heal from falling, drowning or car accident injuries.

We can combine it with a 'Dammaged' event handler. Put this to unit's initialization field:

Code: [Select]
this addEventHandler [{Hit}, {_this select 0 setDammage 0}];this addEventHandler [{Dammaged}, {_this select 0 setDammage 0}]
and go running in the sea.

This whole conversation is unnecessary, there should not be any usage to a healing method like we are discussing... maybe in cutscenes but not otherwise.

 ;D
« Last Edit: 17 Jan 2005, 18:47:19 by Baddo »

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:checking if player is dead
« Reply #6 on: 17 Jan 2005, 18:59:27 »
Making a player unkillable is impossible with OFP's scripting unless you use special units.
This is because there is no condition in the "OnPlayerKilled.sqs" that rechecks if the player is killed.

However if you want your player too be invincible change his Type in the mission.sqm file from "SoldierGB" (Example) too "SoldierGCheat". SoldierGCheat is a special unit that cannot be accessed in game unless you have special addons.

However this unit is almost impossible too kill and really doesnt even need a heal script.

Combination of event handlers 'Hit' and 'Dammaged':

Code: [Select]
this addEventHandler [{Hit}, {_this select 0 setDammage 0}];this addEventHandler [{Dammaged}, {_this select 0 setDammage 0}]
seems to make the unit unkillable.

Test it and confirm if you didn't find a way to get the unit killed. I didn't.
« Last Edit: 17 Jan 2005, 19:00:14 by Baddo »

Merc

  • Guest
Re:checking if player is dead
« Reply #7 on: 17 Jan 2005, 19:25:45 »
Code: [Select]
this addEventHandler [{Hit}, {_this select 0 setDammage 0}];this addEventHandler [{Dammaged}, {_this select 0 setDammage 0}]

I tested it and I have to say that I didn't die. I had 4 groups of Russian soldiers shooting at me and I didn't die. It was fun.  ;D

Merc

  • Guest
Re:checking if player is dead
« Reply #8 on: 17 Jan 2005, 19:29:45 »
Code: [Select]
this addEventHandler [{Hit}, {_this select 0 setDammage 0}];this addEventHandler [{Dammaged}, {_this select 0 setDammage 0}]

I tested it. I had 4 groups of Russian soldiers shooting at me and I didn't die. It was fun.  ;D

Offline dalton

  • Members
  • *
  • i R n00b
Re:checking if player is dead
« Reply #9 on: 17 Jan 2005, 21:48:33 »
Once the player is dead, that's it, mission over.    You can bring the unit back to life if you like, but you won't be able to control it.

You can use

player addEventHandler [{Hit}, {_this select 0 setDammage 0}]

and I also add a setDammage 0 loop in a wee script.     But the trigger should also work.
its a multiplayer mission, they become little birdies when they die
"freedom aint free"

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:checking if player is dead
« Reply #10 on: 17 Jan 2005, 22:48:57 »
Have you tried detonating a satchel charge at your feet?  I guess that could be fun too.  

I have not made the player invincible, but I have done it to AI.  They go a long way up with a satchel charge under them.

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:checking if player is dead
« Reply #11 on: 17 Jan 2005, 23:14:14 »
this addEventHandler [{Hit}, {_this select 0 setDammage 0}];this addEventHandler [{Dammaged}, {_this select 0 setDammage 0}]

Wow, that works.
I had forgotten about the eventhandler dammage entirely.

I tried even creating five laserguidedbomb explosions, and I still did not die.

(Nor did the death cam script start running)
« Last Edit: 17 Jan 2005, 23:14:53 by RujiK »
I like your approach, lets see your departure.
Download the New Flashlight Script!