Jump to content
Nafrey

Trigger activates based on distance as well as condition

Recommended Posts

Hi all!

I'm currently working on a mission that involves assaulting a compound that contains a weapons cache and some intel. I have most of the mission down pat, but ran into a weird problem with a trick I planned to use with the weapons cache. Basically, if any of the cacheCrate1 to 4 were damaged by a semi-sustained spray in the firefight, I would spawn a bomb with an area trigger, and automatically kill everyone inside the trigger area.

Trigger type is set to None and Activation is set to None

The trigger's condition is:

(damage cacheCrate1 > 0.05) || (damage cacheCrate2 > 0.05) || (damage cacheCrate3 > 0.05) || (damage cacheCrate4 > 0.15)

The problem is that for some reason, since the initial players' spawns are at a distance of 2km+ from the cache, the cache seems to be exploding prematurely without having taken any damage in any firefight, and it happens a minute or so after game start. Trying to understand it, I spawned a "setCaptive true" BLUFOR player unit and a vehicle around the cache location, hung around,  fast-forwarded time for about 5 minutes, but no explosion happened. It was after I boarded the vehicle and drove away, getting some distance between me and the objects that the cache exploded on its own again. To make sure, I made sure to drive in both directions to determine that it was distance affecting the explosion/condition.

 

Does it have something to do with object distance? Do objects take damage when out of view distance? What trigger behavior can explain why it's prematurely exploding?

Thanks

 

P.S I don't really know how to use eventHandlers yet, but I'm considering either "Dammage" or "HandleDamage" for this problem. With that said though, it would put my mind at ease if I can get some clarification on why this trigger is behaving this way

 

Share this post


Link to post
Share on other sites

Mmmm...are the weapons cache and intel pre-placed, or they randomly spawn at game start? Sometimes they take damage when spawned, even if pre-placed.

In your shoes, I'll try to execute the trigger ONE cache at the time, just to be sure it does not depends on the initial positioning. 

  • Like 2

Share this post


Link to post
Share on other sites

Arma acts weird in general. Why not:

 

 

this allowDamage false;

 

at the beginning of the mission via the objects init and once any players are in a 500 m distance:

 

cacheCrate1 allowDamage true;

Does not answer the question BUT resolves the issue 💪

  • Like 2

Share this post


Link to post
Share on other sites

Hey guys,

I  appreciate the responses! I did end up going the Event Handler route, using the "Hit" EH off the Biki, (was easier than I thought, in all honesty, and its better for mission performance anyway). I made a separate EH for every cacheCrate (if there's a better way for doing this, I'm all ears) and put all that code in my initServer.sqf.

 

6 hours ago, zagor64bz said:

Mmmm...are the weapons cache and intel pre-placed, or they randomly spawn at game start? Sometimes they take damage when spawned, even if pre-placed.

 

@zagor64bz Yeah I had the weapons cacheCrates1 to 4 pre-placed in the editor. I even had a crate stacked on top of another at some point for aesthetic. But I never thought that they'd be taking damage at round start, but I suppose it ties into what @JohnKalo said:

 

1 hour ago, JohnKalo said:

Arma acts weird in general.

 

It is still pretty strange to me why they'd only prematurely blow up after some distance was made between the player and the cacheCrates though. I'm going to be testing it out some more and experimenting with it.

 

Thanks for the help guys!

  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, Nafrey said:

I even had a crate stacked on top of another at some point for aesthetic.

I had problems with that in the past. You'll be surprised how much they collide at mission start. Ended up NOT stacking them. Anyway, glad you solved the issue with a different route. That's what I do when I hit a wall.

  • Like 1

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

×