Jump to content
Sign in to follow this  
UltimateBawb

Disabling Physics/Destruction Engine

Recommended Posts

I was wondering if I could disable the destruction and physics of buildings within an area. My mission has multiple bases that I'd like to be indestructible. There are also AI merchants that I want to not be able to be moved by explosions.

How can I disable destruction and physics?

Share this post


Link to post
Share on other sites

Put this in the initialization

this addEventHandler ["handleDamage", { false }];

or name it something like building it would look like this then

building addEventHandler ["handleDamage", { false }];

if they are buildings already in the game then im sorry cant help you there but if they are warfare buildings you can this way

For your ai put this in initialization

this disableAI "move";

(This Will prevent Him From Moving)

this disableAI "anim";

(This Will Prevent Animations)

this allowdamage false;

(Makes him Invulnerable)

Edited by ra1n0fpa1n

Share this post


Link to post
Share on other sites

Thanks, the event handler bit did help with the indestructible added structures.

However, most of the other things you said about disabling movement and AI are already implemented. I need to "glue" units to the ground so explosions won't make them superman.

Share this post


Link to post
Share on other sites

Two possible solutions for unit's init field:

1.

this addEventHandler ["handleDamage", {}]; this enableSimulation false;

(but then unit will be totally freezed)

2. More glue-like. Place a game logic, where you want "to glue" an unit, name it eg logic1, then use this in unit's init filed:

this addEventHandler ["handleDamage", {}]; this attachTo [logic1,[0,0,0]];

---------- Post added at 18:51 ---------- Previous post was at 18:37 ----------

As for indestructible map buildings (not placed in editor)...

At each of building, that should be not destroyed, place a trigger, name it, eg tr1. Condition : none

Its condition field:

true

Its activation field:

(nearestBuilding tr1) addEventHandler ["handleDamage", {}];

Should work.

Edited by Rydygier

Share this post


Link to post
Share on other sites

this attachTo [logic1,[0,0,0]]; if you use this attachTo [logic1] all the objects will attach at their relative positions but unless you get and reset their direction it looks a little jumpy.

You can use one game logic for all objects.

You could try including all the commands within the eventhandler, including a release after the damage.

this addEventHandler ["handleDamage", {dir = getdir (_this select 0);(_this  select 0) disableAI "move";(_this select 0) attachto [gl];(_this select 0) setdir dir;  null= [_this select 0] spawn { sleep 1;detach (_this select 0) ;(_this  select 0) enableAI "move"}   }];

I don't know if it will work with large number of units or if there is a lot of other stuff happening.

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  

×