Firstly to OFPEC admins, apologies, i know this is similar to a lot of addevent threads, but i have a target date to have this completed by
I have played with the addeventhandlers "Hit" and "Killed" all day Saturday
Some success, some failures.
The project i am working on, is a template map for a league
here are my aims and the resources that are available in the template at the moment
********************************************************
AIM
To create an Anti spawn shooting script, that is accurate, as lag free as possible,
and
To check whether a player that was hit or killed was
a) In a safezone
or
b) Shot by a player in a safezone
and then if either the shooter or the target was in a safezone, to punish the shooter by
a) relocating him back to his safezone and disabling his userinput for "prisontime"
___________________________________________________________________
___________________________________________________________________
Resources already available
1) Array of all east players "Eastplayers"
2) Array of all west players "Westplayers"
3) Array of all players "Allplayers" = Eastplayers + Westplayers
4) Reloadguy.sqs
5) Respawn Protection trigger (Example is for West Respawn Protection)
.....Activated: Anybody / repeating
.....Condition: (vehicle player in thislist) AND ((side player==East) or (player==WFlagrunner))
.....On Activation: (vehicle player in thislist) exec "common\WSafezone.sqs"
("WSafezone.sqs" basically kills any east player who enters or West's Flagrunner)
WFlagrunner = Flagowner EFlag
Problem encountered
1) The addeventhandler "Hit" isnt activated if the player is killed
I found this by wounding a player (It worked) then killing him (It didnt )
possible solution, run a "Hit" and "Killed" addeventhandler
_____________________________________________________________________________
_____________________________________________________________________________
My Initial Plan
1) Have an addeventhandler "Hit" and "Killed" for each player on the field that encompassed the wholeplaying area (Probably a trigger) possibly add it to "Reloadguy" triggers
2) Create two smaller triggers, or use the existing respawn protection triggers to see if the "Shooter" or "Target" was in a safezone
(I was thinking about using a trigger to switch a boolean status for variable "Insafezone" to
a) True ( when a player was in a spawn protection trigger)
or
b) False (when a player left the trigger area)
and have the addeventhandler activate something like the following script
__________________________________________________________________
__________________________________________________________________
Script not checked yet, (havent got that far) prob contains errors)
;;spawnprotect.sqs
_target = this select 0
_shooter = this select 1
?(_shooter == _target): exit
?(side shooter == side target :exit
?((_shooter)or(_target))insafezone:goto "Punish"
exit
#Punish
_target setdammage 0
?(_shooter == sideplayer west):{_shooter setPos (getMarkerPos "respawn_west")}
?(_shooter == sideplayer east):{_shooter setPos (getMarkerPos "respawn_east")}
?(_shooter insafezone):titletext[format["%1\nShot from within his safezone and hit\n%2\nUserinput disabled for %3 minutes",name (_shooter),name (_target),prisontime],"PLAIN DOWN"]
?(_shooter !insafezone):titletext[format["%1\nShot into an enemy safezone and hit\n%2\nUserinput disabled for %3 minutes",name (_shooter),name (_target),prisontime],"PLAIN DOWN"]
_target setdammage 0
_shooter disableuserinput = true
~ prisontime
_shooter disableuserinput = false
exit
_____________________________________________________________________________
_____________________________________________________________________________
I would normally have plodded through slowly, but unfortunately i have a time restriction
and therefore rather than asking individual questions when i come across a problem, i have simply posted all that i have and want
I need the system to use as little triggers and loops as possible, the league i am creating this for has a lot of members with slow servers or connections and therefore it needs to be as efficient as possible.
Once the system is working and tested, then i can create a tutorial of sorts on how to change it to the ultimate TK script, optional punishements etc etc etc etc,
I know this will take a lot of work, and i know due to the fact the hit and killed events are run locally that having the server control, this is going to be difficult
and to add to this, i also will need to make it failry easy to implement in to new maps (Hence the template planning)
So thanks in advance for any help that you may give