celery 8 Posted May 25, 2009 Running people over can be great fun but it never shows in your score. How would it be possible to detect a roadkill and the guy who's responsible, allowing the mission to give credit where it's due? I've tried "killed" eventhandlers and proximity checks to the nearest car but they're very unreliable online where I plan to use such a feature. Here's the script I've tried: ?outro==1:exit _pos=[(getpos car select 0)-(vectordir car select 0)*2,(getpos car select 1)-((vectordir car select 1)*2),truealt+2.5] _victim=_this select 0 _killer=_this select 1 ?player==_killer and player!=_victim:exit ?_victim==_killer:goto "roadkill" _camera = "camera" camCreate [0,0,0] _camera cameraEffect ["internal","back"] _camera camCommand "inertia on" showcinemaborder false _camera camPrepareTarget car _camera camPreparePos _pos _camera camPrepareFOV 1.4 _camera camCommitPrepared 0 _camera camPrepareTarget _killer _camera camPreparePos _pos _camera camPrepareFOV 1.4 _camera camCommitPrepared 2 ~4.5 @alive player ?outro==1:exit player cameraEffect ["terminate","back"] camDestroy _camera #roadkill enemies=nearestobjects [player,["Car"],6] _select=0 _maxcount=count enemies #loop enemie=(enemies select _select) ?alive enemie and (count (crew enemie)>0):goto "roadkill2" _select=_select+1 ?_maxcount<=_select:exit goto "loop" #roadkill2 roadkiller=(crew enemie select 0);publicvariable "roadkiller" roadkill=player;publicvariable "roadkill" titletext [format["You were run over by %1",name roadkiller],"plain down",0.5] exit I have never seen it work in multiplayer. Share this post Link to post Share on other sites
dr_eyeball 16 Posted May 25, 2009 I presume this script is being executed by a "killed" EH. Therefore: the script will only execute on the victim's client, not any other client. (see Killed EH: MP) the _killer in this case will be a vehicle, not a person/driver. avoid referencing 'player' in these particular EH's, unless you are certain it makes sense.Firstly there is no need to because all parameters are already passed in and secondly because the script is only executed locally to the victim's client. So comparing player vs parameters for locality is unnecessary. I have made the exact same mistakes in all my code but have not got around to fixing it yet. Can't quite follow that script. Especially these lines below. Verify whether the above are true first. ?player==_killer and player!=_victim:exit ?_victim==_killer:goto "roadkill" Share this post Link to post Share on other sites
celery 8 Posted May 25, 2009 I presume this script is being executed by a "killed" EH.Therefore: the script will only execute on the victim's client, not any other client. (see Killed EH: MP) the _killer in this case will be a vehicle, not a person/driver. avoid referencing 'player' in these particular EH's, unless you are certain it makes sense.Firstly there is no need to because all parameters are already passed in and secondly because the script is only executed locally to the victim's client. So comparing player vs parameters for locality is unnecessary. I have made the exact same mistakes in all my code but have not got around to fixing it yet. I'm aware that the script is local to the victim. That's why there are global variables that activate addScore in another script for the killer. The eventhandler will say that _killer is the same as _victim if he was run over. If the eventhandler knew that the guy with the car is the killer, I wouldn't have this problem. The nearestObjects command looks for the closest car and if it has a driver, it defines the driver as the killer. Can't quite follow that script. Especially these lines below. Verify whether the above are true first. ?player==_killer and player!=_victim:exit ?_victim==_killer:goto "roadkill" It's exactly as planned. It goes to the roadkill part only if the player was killed by "himself", i.e. an unknown force. The camera part is irrelevant. Share this post Link to post Share on other sites