Jump to content
Play3r

check if a DemoCharge_F is detonated close to a Submarine_01_F

Recommended Posts

I want to check if a player has detonated a DemoCharge_f close to the vanilla SubMarine so i can finish a task.

I have done it once where i used a gamelogic to see if player did it to a gastank, but i can't find that old mission anymore.

 

Anyone got a idea how i can solve this BIG problem for me. 🤔 

Share this post


Link to post
Share on other sites
4 hours ago, Play3r said:

Anyone got a idea how i can solve this BIG problem for me. 🤔 

 

Hello there Play3r !

 

If there are no other explosions except the certain , then you can use an evenhandler from the start in this object or else you can add this in the certain time that you want , probably with a trigger.

 

You can use this :

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Explosion

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

or a simple trigger with:

{_x inArea thisTrigger} count allMissionObjects "#explosion" > 0

  • Thanks 2

Share this post


Link to post
Share on other sites

allmissionobjects? nearestObjects would be much cheaper on the CPU and can find "#explosion" or "#krater".

  • Like 1

Share this post


Link to post
Share on other sites

But what if something else explodes, like a grenade?

Shouldn't we use the "fired" EH to track placed charges instead with the "put" weapon type?

 

 

Untested :

this addEventHandler ["Fired", {
	params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
	if (_weapon isEqualTo "Put" && _mag isEqualTo "DemoCharge_f") exitWith {
		waitUntil {sleep 0.1; !alive _projectile};
		/*code*/
	};
}];

 

Share this post


Link to post
Share on other sites

Although the Submarine, last time I looked couldn't take damage, it would be worth adding an explosion EH to it and seeing if any useable results came back, just as George suggested earlier.

 

Share this post


Link to post
Share on other sites
26 minutes ago, Tankbuster said:

allmissionobjects? nearestObjects would be much cheaper on the CPU and can find "#explosion" or "#krater".

Did u test it or it's a simple supposition?

Share this post


Link to post
Share on other sites
1 minute ago, pierremgi said:

Did u test it or it's a simple supposition?

Oh yes, tested. I use it to sense explosions near bridge objects. I do other things too, such as the explosion EH, plus checking for kraters (sic) on the ground underneath the object.

  • Like 2

Share this post


Link to post
Share on other sites

The trigger solution somehow not always work.

my trigger is this:

cond:

{_x inArea thisTrigger} count allMissionObjects "#explosion" > 0 

Act:

Subtask setdamage 1; Subtask is a variable that see if trigger is fire so the  SubTasktrigger  succeeded can fire

and nothing more..

The sub is in the water and i have made a trigger that is the same length a the sub + 10 in each end,

the trigger is 25 width and is 150 high but it will not fire every time i try the task.

 

The EH i have never used before and i don't know where to put it

Is it on the sub ? that gives me a error something about a global variable on a local something

if i put inside the trigger nothing happens?? 

 

any idea what i do wrong..

Share this post


Link to post
Share on other sites
29 minutes ago, Play3r said:

The sub is in the water and i have made a trigger that is the same length a the sub + 10 in each end,

the trigger is 25 width and is 150 high but it will not fire every time i try the task.

The EH i have never used before and i don't know where to put it

any idea what i do wrong..

 

Try your trigger with a simple hint as activation code. At least you will see (read) something. If it doesn't work every time, that means the explosion is not inside the trigger (volume)

The problem with a EH "fired" is that you need to apply it on all the units supposed to blow this charge (and it's an unscheduled scope btw, so forget waitUntil w/o spawning the inner code).

For the EH "explosion", you need to apply it on submarine (init field is OK)... but it works if there is some damage on it. not tested. Read and follow BIKI.

If you use this EH (not tested), you don't need a trigger to detect the explosion.

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

×