OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Multiplayer => Topic started by: SpectrumWarrior on 24 May 2011, 19:42:27
-
I need to ask for help on triger I found a flaw in. Well acttually 2 flaws
activation: west
repeating
name: NoWeaponZone
con: this
on act: NoWeaponlist = thislist; {NoWeapon = [] execVM "NoWeapon.sqf"} foreach NoWeaponlist
NoWeapon.sqf
if (player in list NoWeaponZone) then {
for [{_loop=0}, {_loop<1}, {_loop=_loop}] do
{
removeallweapons player;
};
};
Everything works perfect except one thing.
You walk into the triger you lose your weapons, you teleport into the triger you lose your weapons, you parachute into the triger you lose your weapons, you drive into the triger you DO NOT lose your weapons??
I have knowlege of ( thislist = [Man, Landvehicle] ) but I have no clue where to add it if that is what is needed.
Second flaw is if one player is in the triger area while another player enters the triger the second player does not lose his weapons. Not sure if there is a fix for that.
-
try
if (vehicle player in list NoWeaponZone)
-
Works like a charm thank you very much.
-
Second flaw is if one player is in the triger area while another player enters the triger the second player does not lose his weapons. Not sure if there is a fix for that.
I assume this is a global trigger, eg placed in the editor or scripted
Most likely the second player did not activate the trigger because it was already activated.
Fix:
Instead of creating the trigger globally, create it locally on every players machine (via a script), that will solve the problem
-
Ok still new at scripting lol, you lost me there. Set the trigger something like this
NoWeaponTrigger.sqf
_trgobj = createTrigger ["EmptyDetector", [4601.6831,339,10323.554]];
_trgobj setTriggerActivation ["WEST", "PRESENT", true];
_trgobj setTriggerArea [850, 550, 58.9088, true];
_trgobj setTriggerTimeout [0, 0, 0, true ];
_trgobj setTriggerStatements ["this", "NoWeapon = [] execVM ""data\scripts\NoWeapon.sqf""",""];
_trgobj1 = createTrigger ["EmptyDetector", [4601.6831,339,10323.554]];
_trgobj1 setTriggerActivation ["WEST", "NOT PRESENT", true];
_trgobj1 setTriggerArea [855, 555, 58.9088, true];
_trgobj1 setTriggerTimeout [0, 0, 0, true ];
_trgobj1 setTriggerStatements ["this", "NoWeapon1 = [] execVM ""data\scripts\NoWeapon1.sqf""",""];
not sure about the angle part
NoWeapon.sqf
if (vehicle player in list NoWeapon) then {
for [{_loop=0}, {_loop<1}, {_loop=_loop}] do
{
removeallweapons player;
};
};
NoWeapon1.sqf
terminate NoWeapon;
NoWeapon trigger on map
position[]={4436.8638,-13.339605,1911.1981};
interruptable=1;
age="UNKNOWN";
name="NoWeaponTrigger";
expCond="local player";
expActiv="NoWeapon = thislist; {NoWeapon = [] execVM ""data\scripts\NoWeaponTrigger.sqf""} foreach NoWeapon;";
OK that did not work, so I will have to wait untill you come back on and reply.
I followed this page like it says http://community.bistudio.com/wiki/Triggers#Scripting (http://community.bistudio.com/wiki/Triggers#Scripting)
RESOLVED:
This is what we ended up with.
marker on the map, rectangle, solid: NoWeaponZone
Object on the map ( anything ), Initialization:
NoWeapon = [] execVm "NoWeapon.sqf"; this addEventHandler ["HandleDamage", {false}];
NoWeapon.sqf: for [{_loop=0}, {_loop<1}, {_loop=_loop}] do
{
deletevehicle _trgairport;
_trgairport = createTrigger ["EmptyDetector", (getmarkerPos "NoWeaponZone")];
_trgairport setTriggerArea [850, 350, 58.9088, true];
_trgairport setTriggerActivation ["WEST", "PRESENT", true];
_trgairport setTriggerStatements ["true", "airportzone=thislist; {removeallweapons _x} foreach airportzone;", ""];
sleep 2;
};
We tried it with out the loop, but it would not work.
we tried it execVM from the init.sqf, it would not work.
If player 1 enters the zone he loses his weapons, if player 2 enters the zone while player 1 is still in the zone he loses his weapons too. if player 1 leaves the zone he can rearm at any ammo crate, even if player 2 is still in the zone.
As I said we did try it with out the loop and called from the Init.sqf to no avail. Then I remembered something I had trouble with in arma 1 once, same thing kind-a. tried calling this one script from a trigger and from the init.sqf and never could get it working, then added an object to the map and called it from that initialization and it worked prefect. Never understood that one. Again resolved and Thank you very much for your help. Lol, it even removes all weapons from the ai's.