OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: schuler on 23 Feb 2007, 08:59:02

Title: dont fire on emeny outside the zone
Post by: schuler on 23 Feb 2007, 08:59:02
iam looking for a script. There's the point. the sgt "player" is told not to fire a pone enemy's leaving the area ,,,there is a trigger to end the game with a time out of 60s. when the game is tiggered to end i'd like the script to run, only for the player if posible ,or for the unit if its easyer to make. and if he does he gets warned and looses points. i'd been happy with just a warning!,,,,, iam thinking this is a hard one.
     i hope i was clear enough on that , i can be hard to follow  :-[
Title: Re: dont fire on emeny outside the zone
Post by: Cheetah on 23 Feb 2007, 09:45:44
You could use EventHandlers (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=a#addEventHandler)

With a fired eventhandler you can check if the player fires, activate this code when needed:
EHkilled = player addEventHandler ["killed", {_this exec "playerKilled.sqs"}]

playerKilled.sqs
Code: [Select]
_unit = _this select 0;
if(_unit == "player") then { hint "Damn you, you're violating the law!"; player addRating -5000; }

I think that something like this should work, untested in OFP though.
Title: Re: dont fire on emeny outside the zone
Post by: schuler on 24 Feb 2007, 06:26:25
Ok Cheetah i'll give that a go. and check eventhandler too. thanks, shuler