Advertisement

Author Topic: Small problem with a triger ( RESOLVED )  (Read 398 times)

0 Members and 1 Guest are viewing this topic.

Small problem with a triger ( RESOLVED )
« 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
Code: [Select]
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.
« Last Edit: 27 May 2011, 15:03:06 by SpectrumWarrior »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: Small problem with a triger
« Reply #1 on: 24 May 2011, 20:40:23 »
try


if (vehicle player in list NoWeaponZone)


Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Re: Small problem with a triger
« Reply #2 on: 24 May 2011, 20:43:53 »
Works like a charm   thank you very much.
« Last Edit: 24 May 2011, 20:50:52 by SpectrumWarrior »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: Small problem with a triger
« Reply #3 on: 24 May 2011, 20:46:59 »
Quote
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
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Re: Small problem with a triger
« Reply #4 on: 24 May 2011, 20:59:33 »
Ok still new at scripting lol, you lost me there. Set the trigger something like this
NoWeaponTrigger.sqf
Code: [Select]

_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
Code: [Select]
if (vehicle player in list NoWeapon) then {
 for [{_loop=0}, {_loop<1}, {_loop=_loop}] do
{

removeallweapons player;

};
};
NoWeapon1.sqf
Code: [Select]
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







RESOLVED:

This is what we ended up with.
marker on the map, rectangle, solid: NoWeaponZone
Object on the map ( anything ), Initialization:
Code: [Select]

NoWeapon = [] execVm "NoWeapon.sqf"; this addEventHandler ["HandleDamage", {false}];

NoWeapon.sqf:
Code: [Select]
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.
« Last Edit: 26 May 2011, 23:54:56 by SpectrumWarrior »