OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: JPSelter on 06 Sep 2005, 10:05:45
-
Right now my coop-mission is like this: I get killed, I lay on the ground for 10 seconds, then I respawn. During these 10 seconds I would like to know who exactly killed me. So I need a camera ride like in singleplayer mode. I guess I need a camera script. I understood the basics of it but not how the script is triggered and what ID the enemy unit that shot me has got.
-
Go to the COMREF (http://www.ofpec.com/editors/comref.php) in the Editors Depot. Read about addEventHandler "killed" and a script named onPlayerDeath.sqs (or is it onPlayerKilled???)
These are the tools you need to trigger your camera script. The "killed" eventHandler is local, so it requires some publicVariables to work in MP. Might be a good idea to check out that command as well. Then hit the camera tutorials.
EDIT:
The reurned values from the "killed" eventHandler are:
_this select 0 = victim
_this select 1 = killer
-
I still need to know how I can figure out who killed me. There must be a global variable somewhere...
EDIT: OK, I found an example in the COMREF, thx :)
-
Go to the COMREF (http://www.ofpec.com/editors/comref.php) in the Editors Depot. Read about addEventHandler "killed" and a script named onPlayerDeath.sqs (or is it onPlayerKilled???)
These are the tools you need to trigger your camera script. The "killed" eventHandler is local, so it requires some publicVariables to work in MP. Might be a good idea to check out that command as well. Then hit the camera tutorials.
EDIT:
The reurned values from the "killed" eventHandler are:
_this select 0 = victim
_this select 1 = killer
what this means is
place the following code in the following files
INIT.SQS
player addEventHandler ["killed", {_this exec "deadplayer.sqs"}]
deadplayer.sqs
_player = _this select 0
_killer = _this select 1
@alive _player
hint format ["I was killed by %1",name _killer]
The above script (Killed eventhandler script), is local to your pc only
Now thats answered your question, but i doubt it's solved your problem :-)
-
I hope to figure out how the camera animation works. But this should work, as I have a) my own name, b) the killerÂ's name and c) a local animation. WouldnÂ't make sense when all players see my personal death animation :D
-
WouldnÂ't make sense when all players see my personal death animation :D
Local scripts can be very useful MP tools sometimes :)
-
I have to alter my camera script because one of my fellows doesnÂ't want to see who killed him ;) So I want to change the last camera position from the _killer to my respawn point. My respawn-point dynamically changes its position according to our progress on the island. I have a marker named "respawn_west", so I tried this:
; move the camera
_cam camsettarget respawn_west
_cam camsetrelpos [0,-2,2]
_cam camcommit 5
@camcommitted _cam
But itÂ's not working. He stays on my _player and doesnÂ't seem to find my respawn point. How can this be?