Jump to content
Sign in to follow this  
allamawitharifle

OnPlayerKilled script

Recommended Posts

I'm having a slight problem with the onplayerkilled.sqs script, my current script looks like...

_player = _this select 0
_killer = _this select 1

setAccTime 1

_deathscenes = ["death_OFPDeathScene.sqs", "death_OFPDeathScene2.sqs", "death_DeathScene1.sqs", "death_DeathScene3.sqs"]
_deathscenepick = _deathscenes select floor random count _deathscenes;

[_player, _killer] exec (_deathscenepick)

exit

I have multiple scripts which I want one to be randomly picked which works fine.

However inside each death script I have

? (_killer == player) or !(alive _killer) : goto "suicide"

To check if the person that killed the player is either alive or if the player killed himself. This is the problem, the script will always goto the "suicide" part of the script. So my best guess is that _killer and _player isn't getting carried over from the onplayerkilled.sqs script

Share this post


Link to post
Share on other sites

you should not need the alive _killer part, as he can be suicided by himself, grenade to close etc..

also you used player instead of the local variable _player wich means the player no matter what unit he is, so the kiled player is not used in the check, but the current state of player is.

? (_killer == _player) : goto "suicide"

you use

[_player, _killer]

as info sent to the death script, make sure you use _this select 0, _this select 1, and use _player instead of player..

Share this post


Link to post
Share on other sites

Another little bit of info....

For those more comfortable with .sqf .... onPlayeKilled can be an .sqf instead of an .sqs!

Share this post


Link to post
Share on other sites

Really? Some of the event scripts requires the .sqs variant (I know onFlare.sqs is one of them), If that is the case, you can always execVM the .sqf from the .sqs, just passing along _this. And yes, I would definitely go with .sqf for this one, due to switch do {} structure.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×