OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Crook on 17 Sep 2004, 09:58:44
-
Is there anyway to have a trigger check for friendly fire amoungst a certain side and execute a script accordingly?
-
Eventhandler "hit" returns the "_shooter" and the "_victim".
?(side _shooter==side _victim):exec "xxx.sqs"
If u use vehicles:side(crew _shooter select 0)
-
I understand what you are saying to an extent... But I don't get far with what you said...
-
Ok,to answer your question,no trigger , use an Eventhandler "hit"
Search Igor Drukovs Tut on EHs in the editors depot.
Add each player an EH:player addEventHandler ["hit", {_this exec "FFCheck.sqs"}]
FFCheck.sqs;
_victim = _this select 0
_shooter = _this select 1
?(side _shooter==side _victim):exec "xxx.sqs"
xxx.sqs is the script u want to execute...
This is just a basic plan to give U an idea howto do it.And depending on what Your script does U might need to use PublicVariables for shooter and victim.
-
Well I tried it... but it didn't work... I wanted it to deduct points from the entire team everytime someone got TKed so it doesn't have to execute a script, it could probably just use the Goto "xxx" command... Yet, I tried the script you wrote and it didn't work no matter how I went about it... Thanks for trying though.
-
Doesnt OFP automatically deduct points of your score when U TK?
If your intrested I have made a script based on the ECL template where each player got punished when he Teamkills...
The punishment is 1 minute Blancs (achieved by deleting his bullets for 1 minute),we tested it,it works 100%.
You could simply change the punishment to anything U want.
-
Download link?
Yeah it deducts points, I just want it to deduct more than 1 point.
-
D/L HERE (http://users.pandora.be/Patton./ctf@%2020%20ecl%20cqb%20guerilla%20conflict.beta.1.4.noe.zip)
After de-pbo go to Spawnkill\Shooter.sqs and search the line #punishment,and change it to whatever U want.
-
Correct me if I'm wrong but from looking at it, it seems as if it only works in the spawn (i.e. is a shooter and victim are both in the westarray, they have to be on the same team(assuming the spawns are protected)) I need something that will work over the entire playing field although there was a piece of the script I could use. But I need basically a full map coverage rather than the spawn. But I will continue to try to figure something out...
-
I been working on this, and came up with this "ff" script, called by a hit eh, but it doesn't reliably work everytime. Sometimes it registers all tk's and sometimes all not tk's! any ideas?
_victim = _this select 0
_shooter = _this select 1
?(side _shooter == side _victim): goto "friendlyf"
#friendlyf
papabear globalchat format ["%1 was tk'd by %2", name _victim, name _shooter]
_shooter addscore -4
papabear globalchat format ["%1 has a score of %2", name _shooter, score _shooter]
exit
#notff
papabear globalchat format ["%1 was shot by %2", name _victim, name _shooter]
papabear globalchat format ["%1 has a score of %2", name _shooter, score _shooter]
exit
-
The Friendly Fire script works everywhere.
The line U talk about is for Spawnprotection.
The original Spawnprotect script checked some conditions to exit;
--?(_shooter == _victim): goto "END"-->When U hurt yourself
--?(crew _shooter select 0 in westarray AND _victim in westarray ): goto "END"-->When both players are on the same side.
This last line is the perfect conditioncheck for FF,but instead of :goto "end" I changed it into :goto "punishment"
After using PublicVariables for Shooter and Victim U can formulate any punishment U want.
-
I would like to thank both of you for your help. I figured it out by myself. Platoon, sorry but I opened your scripts and just sat there.. LOL
Anyways this is the script I came up with:
#Start
_victim = _this select 0
_shooter = _this select 1
#CheckFF
?(side _shooter == East): Goto "NFF";
?(side _shooter == West): Goto "YFF";
Of course the West Players and the East Players can't run the same script right off the EventHandler, but this gets the job done. Thanks for your help.
-
This Template was build by Terox and Pimmelorus,I only added something small....
These people spend many hours on it,and gave everybody the opportunity to build a high quality map even without any knowledge of scripting.They keep OFP alive..
@Zombie;
Your script is not 100% correct,it is activated from EH "hit",but a hit doesnt mean "death",so its not correct to talk about TeamKill when U only got hit ;)
Maybe EH "killed"?
Weird,is "side" another dodgy command:s
Or is it the same like "dammage",who only works on vehcs who are ingame at the start?(not on respawned vehicles (by createvehicle))
Check out Spawnkill\arrayupdate.sqs in the template,this loop updates the sidesarrays.U will prolly need it too.