zagor64bz 1225 Posted December 9, 2015 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" 1 Share this post Link to post Share on other sites
froggyluv 2136 Posted December 9, 2015 Suppose you could do a height check and disallow damage until close or at zero. 1 Share this post Link to post Share on other sites
froggyluv 2136 Posted December 9, 2015 Suppose you could run disallow damage until height of each unit is zero or close 1 Share this post Link to post Share on other sites
zagor64bz 1225 Posted December 9, 2015 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
froggyluv 2136 Posted December 9, 2015 On phone but I'll try later when at home. Also an isTypeOf "Air" might work 1 Share this post Link to post Share on other sites
zagor64bz 1225 Posted December 9, 2015 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
jshock 513 Posted December 9, 2015 [this] spawn { (_this select 0) allowDamage false; waitUntil { (getPosATL (_this select 0)) select 2 < 2}; (_this select 0) allowDamage true;}; Unit init. 1 Share this post Link to post Share on other sites
Mamba Six 11 Posted December 9, 2015 [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; }; ? 1 Share this post Link to post Share on other sites
jshock 513 Posted December 9, 2015 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. 1 Share this post Link to post Share on other sites
Mamba Six 11 Posted December 9, 2015 Ok haha, was just checking there was no functional difference. Sent from my SGP561 using Tapatalk 1 Share this post Link to post Share on other sites
zagor64bz 1225 Posted December 9, 2015 THANK YOU ALL!!!!!! Share this post Link to post Share on other sites
zagor64bz 1225 Posted December 9, 2015 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
donelsarjo 60 Posted December 10, 2015 try : _cowabanga = [this] spawn { (_this select 0) allowDamage false; waitUntil { (getPosATL (_this select 0)) select 2 < 2}; (_this select 0) allowDamage true;}; 1 Share this post Link to post Share on other sites
zagor64bz 1225 Posted December 10, 2015 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
jshock 513 Posted December 10, 2015 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.... 1 Share this post Link to post Share on other sites
Guest Posted December 10, 2015 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
zagor64bz 1225 Posted December 10, 2015 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
zagor64bz 1225 Posted December 10, 2015 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
jshock 513 Posted December 10, 2015 Sorry, not working..they still die...... Are you running any mods? Share this post Link to post Share on other sites
zagor64bz 1225 Posted December 10, 2015 Are you running any mods? Indeed I do! Let me try "vanilla".... Share this post Link to post Share on other sites
zagor64bz 1225 Posted December 10, 2015 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
barbolani 198 Posted December 10, 2015 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. 1 Share this post Link to post Share on other sites
Von Quest 1163 Posted December 11, 2015 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... 1 Share this post Link to post Share on other sites
zagor64bz 1225 Posted December 11, 2015 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
zagor64bz 1225 Posted December 11, 2015 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