OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: dalton 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?:
?(alive playername): setdammage 0
-
or maybe its something like this?
?(player dammage<1):player setdammage 0
-
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.
-
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.
-
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.
-
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:
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
-
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':
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.
-
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
-
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
-
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
-
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.
-
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)