Jump to content
zagor64bz

[SOLVED!!]"allowDamage" false only in the air

Recommended Posts

Hi, how can I set in the init of a unit a "allowdamage false" only when he's Haloing, and get back to TRUE when he's on the ground? Everytime I HALO with a large (8 to 10) AI team they collide in mid-air killing half of the team....

Thank you and sorry for the "NOOB-ness" 

  • Like 1

Share this post


Link to post
Share on other sites

Suppose you could do a height check and disallow damage until close or at zero.

Like a said, I'm a noob..could you please "develop" that? like with something I could "copy-and paste"??

Thank you mate! 

Share this post


Link to post
Share on other sites

On phone but I'll try later when at home. Also an isTypeOf "Air" might work

You'r the man!

Share this post


Link to post
Share on other sites

[this] spawn { (_this select 0) allowDamage false; waitUntil { (getPosATL (_this select 0)) select 2 < 2};  (_this select 0) allowDamage true;};

Unit init.

  • Like 1

Share this post


Link to post
Share on other sites
[this] spawn { (_this select 0) allowDamage false; waitUntil { (getPosATL (_this select 0)) select 2 < 2};  (_this select 0) allowDamage true;};
Unit init.

Just curious, but why not:

this spawn { _this allowDamage false; waitUntil { (getPostATL _this) select 2 < 2 }; _this allowDamage true; };
?
  • Like 1

Share this post


Link to post
Share on other sites

Just curious, but why not:

this spawn { _this allowDamage false; waitUntil { (getPostATL _this) select 2 < 2 }; _this allowDamage true; };
?

Same difference as far as I remeber.

  • Like 1

Share this post


Link to post
Share on other sites

Ok haha, was just checking there was no functional difference.

Sent from my SGP561 using Tapatalk

  • Like 1

Share this post


Link to post
Share on other sites

Just curious, but why not:

[this] spawn { (_this select 0) allowDamage false; waitUntil { (getPosATL (_this select 0)) select 2 < 2}; (_this select 0) allowDamage true;};
this spawn { _this allowDamage false; waitUntil { (getPostATL _this) select 2 < 2 }; _this allowDamage true; };
?

 

Sorry, none work... It give me :"script;expect nothing" error. I even try with unit name in stead of "_this"...Am I missing something?

Share this post


Link to post
Share on other sites

try :

_cowabanga = [this] spawn { (_this select 0) allowDamage false; waitUntil { (getPosATL (_this select 0)) select 2 < 2}; (_this select 0) allowDamage true;};
  • Like 1

Share this post


Link to post
Share on other sites

 

try :

_cowabanga = [this] spawn { (_this select 0) allowDamage false; waitUntil { (getPosATL (_this select 0)) select 2 < 2}; (_this select 0) allowDamage true;};

Thank you..it's 1.40 AM here...gonna try that tomorrow..better go to sleep now if I want to be able to work tomorrow..LOL

Share this post


Link to post
Share on other sites

try :

_cowabanga = [this] spawn { (_this select 0) allowDamage false; waitUntil { (getPosATL (_this select 0)) select 2 < 2}; (_this select 0) allowDamage true;};
Yep, sorry, was on my phone and typing quickly :P, what is quoted above will also not work in the scope of a unit's init (local variable in a global space), so do:

0 = [this] spawn....
  • Like 1

Share this post


Link to post
Share on other sites
Guest

You may use a damage eventHandler witch may be way more efficient and clean.

If you are intrested by this solution let me know I will investigate further. I'm on my phone right now so I will help you in like 8 hours.

Share this post


Link to post
Share on other sites

You may use a damage eventHandler witch may be way more efficient and clean.

If you are intrested by this solution let me know I will investigate further. I'm on my phone right now so I will help you in like 8 hours.

Sure, I'm always ready to learn something new! 

Thank you a lot!

Share this post


Link to post
Share on other sites

Yep, sorry, was on my phone and typing quickly :P, what is quoted above will also not work in the scope of a unit's init (local variable in a global space), so do:

 

0 = [this] spawn....

Sorry, not working..they still die......

Share this post


Link to post
Share on other sites

Sorry, not working..they still die......

Are you running any mods?

Share this post


Link to post
Share on other sites

Indeed I do!

Let me try "vanilla"....

What I was thinking? Can't do vanilla, since I'm using SpookyWarCom HALO mudules.....that and USAF mod for the c130j....

Share this post


Link to post
Share on other sites

Wait

 

Where is the soldier in the editor map? Is he high or just in the ground awaiting to be teleported to the air? If so, the code is spawning while he is on the ground and the waitUntil is passed.

 

Anyway:

 

this addEventHandler ["HandleDamage", {_player = _this select 0; if ((not(isTouchingGround _player)) and (vehicle _player==_player)) then {0} else {_this select 2}}]

 

When he opens the parachute, will get damage.

  • Like 1

Share this post


Link to post
Share on other sites

I haven't tried that part of my project since this last update. I'll look into it though. Should have an update that addresses that issue before the end of the weekend hopefully. Maybe even by morning here. Should be an easy upgrade/fix.

Since the A.I. is part of your squad, I didn't want the player to be invincible as well. If I can find time tonight, I'll try and squeeze that in and upload in the morning here in the US.

----------

Update: I don't want to hijack your thread, I'll post more info on my SWC thread...

  • Like 1

Share this post


Link to post
Share on other sites

I haven't tried that part of my project since this last update. I'll look into it though. Should have an update that addresses that issue before the end of the weekend hopefully. Maybe even by morning here. Should be an easy upgrade/fix.

Since the A.I. is part of your squad, I didn't want the player to be invincible as well. If I can find time tonight, I'll try and squeeze that in and upload in the morning here in the US.

----------

Update: I don't want to hijack your thread, I'll post more info on my SWC thread...

Hijack as many time you feel necessary to solve the problem. Thank you for the upcoming update. 

Share this post


Link to post
Share on other sites

Wait

 

Where is the soldier in the editor map? Is he high or just in the ground awaiting to be teleported to the air? If so, the code is spawning while he is on the ground and the waitUntil is passed.

 

Anyway:

 

this addEventHandler ["HandleDamage", {_player = _this select 0; if ((not(isTouchingGround _player)) and (vehicle _player==_player)) then {0} else {_this select 2}}]

 

When he opens the parachute, will get damage.

They are on the ground ready to be teleported in the air..indeed!

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

×