Home   Help Search Login Register  

Author Topic: Anti Spawn Shooting (Addeventhandler "hit" and "Killed"  (Read 1369 times)

0 Members and 1 Guest are viewing this topic.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
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
« Last Edit: 25 May 2003, 11:11:59 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Anti Spawn Shooting (Addeventhandler "hit" and "Killed"
« Reply #1 on: 26 May 2003, 01:03:59 »
I now have the system working pretty well to certain point
Thanks to a guy called Pimmelorus for all his help so far

The system so far (Tested okay on a ded server)

Waits for any player anywhere to receive any damage via "hit"
then it looks to see if the victim or shooter is in a restricted area

If either are it sees the damage as being illegal and

1) Kills the shooter sending him back to his spawn instantly
(It holds him in his respawn while the respawn delay runs)
This way he cant see what is happening on the battlefield

At the same time
If the victim is only hurt, it repairs him
If the victim has been killed it respawns him instantly to the kill location
To the extent he still see's his old body falling

The multiple events caused by splash damage have been taken into consideration and these follow on events are not able to activate another instance of the scripts
(During our testing, we noticed that an M16 on burst could unload 3 rounds (Thats a minimum of 3 events) before the shooter was killed, so god knows what would happen with a g36 or M60, or Uzi) This intitially created multiple respawning Victims (Great fun) and other problems

The system  only uses the two normal safezone protection triggers and it only uses these to see if the victim or the shooter is in their lists. It doesnt use variable arrays of east or west players nor any other additional work by a mapper, other than to copy the two scripts into his mssion folder, exec one of the scripts from the init.sqs
and edit the names of the safezoneprotection triggers (Which normally dont have a name anyway)

So at the moment its purely scripted relying on no mapper modification other than the names given to either safezone protection triggerwhich makes it more universally portable between maps

This may turn out to be the mother of all Anti TK or Anti spawn shooting scripts



Still awaiting implementation are

1) Rearming the killed victim with the weapons he died with (If this is possible)
if not will rearm him with usual reloadguy type thing


2) Making the side detection system for east and west (victim shooter)
this may require some  "addrating" statements etc
This would then allow modification from anti spawncamping to anti TK or vice versa

3) Punish the shooter by disabling his userinput in spawn for a few minutes
(Gotta figure out how to get victims client to  let server know who shooter is, havent thought about this yet, shouldnt be difficult, must be done with a  Publicvariable

4) Then let shooter know what he did wrong and tell him when his punishement is finished

******************************************************************
******************************************************************
The only downside i can see is lag, which could be a problem seeing most of this is run clientside. However during testing this didnt seem to be the case
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123