HalfdeadKiller
Member-
Content Count
4 -
Joined
-
Last visited
-
Medals
Everything posted by HalfdeadKiller
-
Script for Grenadier Smoke Shells
HalfdeadKiller posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Alright, I'm going to preface this with I have barely any idea of what I'm doing. My coding experience is that I know enough to stumble around and copy and paste things to make them work, but not enough to write anything from scratch. My current project is telling an AI grenadier, to fire a smoke shell from his underbarrel grenade launcher, at the target he has been assigned by the group leader. Ideally I'd like this to be modular, so I can just shove it into the init of any grenadier I want to do that with. Bonus points if it's possible to have the AI only fire the smoke shells within a certain range. I've done digging for the past two days and came up with this. At first I had it in it's own .sqf file, but the game kept throwing errors so I did away with that and went straight for the Grenadier's Init. This code doesn't work at all. Currently it spams the console with "Suspending not allowed in this context". Which would be related to the sleep command. When I had it in it's own SQF it threw errors like "Error assignedtarget: Type Array, expected Object" or "Error Undefined variable in expression: this". I'm completely lost so any help would be appreciated. -
Script for Grenadier Smoke Shells
HalfdeadKiller replied to HalfdeadKiller's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm beginning to think this problem is a lot more complex than initially thought of. When directly using the forceWeaponFire, the command is looking for a firerate, not a magazine. The firerate for the GP25 is Single. So far I don't see a way to specific the type of grenade, aside from some switch ammo action that requires specific ID numbers of magazines. So to tell the AI to fire the grenade launcher, I had to do " this forceWeaponFire ["GP25Muzzle","single"]; " I have yet to figure out how to tell the AI to change the magazine type of the gp25 muzzle. -
Script for Grenadier Smoke Shells
HalfdeadKiller replied to HalfdeadKiller's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I've modified the code and ended up with this. However it still gives me an undefined variable for _grenadier. changing _this to this doesn't seem to yield any results either. Not sure how to continue. The sleep errors have stopped after changing 0 = [_this] spawn { to [] spawn { . However I don't know the intricacies of [] spawn vs the other. Edit1: Try as I might I keep getting undefined variable for _grenadier. It's as if _this isn't passing it's information through to the script that is being spawned. I'm not sure how to proceed. Edit2: This was my latest iteration of testing. Also I will post the outputs of the debug console when I used different commands to output things. Debug Console Outputs Non-functioning script, throws undefined variable for _unit -
Script for Grenadier Smoke Shells
HalfdeadKiller replied to HalfdeadKiller's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Looks like we're getting the following errors. The main one being spammed is the Suspending not Allowed section. The last block only happens right before hitting ESC according to the timestamps in the .rpt. I'm pretty sure the muzzle name is rhs_weap_ak74m_gp25, since currentMuzzle player; gives me "rhs_weap_ak74m_gp25" when the gp-25 is selected. Edit: I had the wrong weapon selected. currentMuzzle gives me "GP25Muzzle". Edit2: Maximum Zeroing range for the GP25 seems to be 400 meters currently, so we can change the 200 to 400. Just gotta figure out what why it doesn't like sleep. Last I checked using spawn was a way for sleep to function properly. Not sure why it's tossing errors at me now.