Jump to content
Sign in to follow this  
Vincent Vega

NV Goggles not allowed for Opfor - how to?

Recommended Posts

hi @ all!

i made a teamplay mission where blufor infantry has to destroy several targets which are guarded by the opfor infantry team. timelimit is 1 hour and it gets darker and darker - the opfor team has flares to light up the area. i don't want the opfor units to be able to use nightvision.

i made a trigger that covers the whole area:

activation: opfor/multiple/present

condition: this hasWeapon "nvgoggles"

on activation: {_x removeWeapon "nvgoggles"} foreach thisList

the problem is that opfor is still able to use nightvision - how can i solve this problem?

i also tried to do it with a script, in this case the trigger activates the script for opfor (tested):

? !(local server) : exit 
_unit = _this select 0
~1
#loop
~1 
?!(_unit hasweapon "nvgoggles") : goto "Skip"  
~1 
_unit removeweapon "nvgoggles"
~1
#Skip 
~3  
goto "loop"

but this solution also doesn't work :(

how can i solve this problem?

Share this post


Link to post
Share on other sites

Can you not just remove the "NVGoggles" from all the OPFOR units and ammo crates if there are any?

This would still allow OPFOR units to pick up NV of dead BLUFOR obviously, but thats kind of realistic dont you think? If your not using a weapon respawn, then any OPFOR will loose the NVG's once they get killed even if they do manage to find a pair.

Share this post


Link to post
Share on other sites

Have you tried on units init/respawn:

this removeWeapon "NVGoggles";

I've tried it in editor, works fine.

Share this post


Link to post
Share on other sites
Can you not just remove the "NVGoggles" from all the OPFOR units and ammo crates if there are any?

This would still allow OPFOR units to pick up NV of dead BLUFOR obviously, but thats kind of realistic dont you think? If your not using a weapon respawn, then any OPFOR will loose the NVG's once they get killed even if they do manage to find a pair.

i removed all NVgoggles from the ammo crates - also from all opfor units in the init field.

i don't want opfor to be able to pick up/use nvgoggles from dead blufor - they can use the flares to light up the area.

the mission is already much fun without this feature (if opfor voluntarily doesn't use NV), but i want the blufor to have a chance to accomplish their mission also on public servers. i'm talking about 8 blufor attackers vs. 24 opfor defenders ^^

Share this post


Link to post
Share on other sites
activation: opfor/multiple/present

condition: this hasWeapon "nvgoggles"

on activation: {_x removeWeapon "nvgoggles"} foreach thisList

how can i solve this problem?

Don't know how you are calling the script, but your trigger does not work because of the condition. Putting it simply to "this" should do. "this" refers to the entity you "are typing stuff in". So that would be the trigger in this case, which does not have NVGoggles :)

You could do something like

{if (_x hasWeapon "NVGoggles") then {_x removeWeapon "nvgoggles"}} foreach thisList

but it won't matter in this case anyhow.

Share this post


Link to post
Share on other sites

any nasty solution: have you considered using event handler killed for removing nvg for dead blufor players? :)

{_x addEventHandler ["killed",{_this removeWeapon "nvgoggles"}]}foreach thislist (trigger w/ activation for all blufor units)

Share this post


Link to post
Share on other sites

first: thx for the help @ all :)

both solutions as described by schaefsky & Reyhard are now in the mission - but it still doesn't work.

the "removeweapon" command seems to be buggy somehow in this case :(

Share this post


Link to post
Share on other sites

execVM this as an sqf from the init.sqf:

While{true} do {

{

if(side _x == EAST and _x hasweapon "nvgoggles")then{_x removeWeapon "nvgoggles"};

} foreach playableunits;

sleep 1;

};

(note playableunits is only valid in mpgames, it will not work in the editor/SP).

EDIT: actually stuff that, have u tried just putting in a trigger with:

condition: player hasweapon "nvgoggles" and playerside == EAST

activation: player removeweapon "nvgoggles"

idk theres a 1000 simple ways to do this, any of them should work really :/

Edited by pogoman979

Share this post


Link to post
Share on other sites

So, how to remove nvgoggles for EAST AI ? (Singleplayer mode.)

I want to play as west, and have east as my enemy, then I want to remove all units that have nvgoggles on them.

How to?

Thanks.

Share this post


Link to post
Share on other sites

@Vincent Vega: Do you have any player loops you can put the following in?

if (player hasWeapon "NVGoggles") then {hint "NVGoggles not allowed, removed"; player removeWeapon "NVGoggles"};

Share this post


Link to post
Share on other sites

OK so after searching, I find this, which is almost the same thing as I want for a mission I'm making. Basically the playable side will be EAST and I want to disable the usage of NVGs from them, and if they pick them up from WEST they will be removed again from their inventory. Here is what I'm using in my init.sqf:

{ 

 	if (side _x == EAST) then {
	   _x removeWeapon "NVGoggles";	   
};
} foreach allunits;

{
if (player _x hasweapon == "NVgoggles") then {
   _x removeweapon "NVGoggles";
};
} foreach all units;


execVM "briefing.sqf";

if (isServer) then {
ace_sys_tracking_markers_enabled = false;
};

execVM "nonvg.sqf";

And inside the nonvg.sqf I used the code pogoman suggested which is

While{true} do {

{

if(player _x == EAST and _x hasweapon "nvgoggles")then{_x removeWeapon "nvgoggles"};

} foreach playableunits;

sleep 1;

};

The verdict is the original remove weapon from the INIT works, I just need a way to make the script 2 remove it keep looping, and check to see if a player has them, then remove. Any suggestions?

Share this post


Link to post
Share on other sites

You guys are making this much more complicated than it needs to be. All you need to do is make a repeatedly-activated trigger with the following fields:

Condition:

player hasWeapon "NVGoggles" && side player == east

Activation:

player removeWeapon "NVGoggles"

Share this post


Link to post
Share on other sites

Thanks, that works. If anyone else is wanting to do the same, just add one trigger for the entire zone, it will keep working and you don't have to leave and reenter the trigger area. Thanks Dux.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×