Hello All,
Well, I've spent another several hours of my life trying to figure out what's going wrong, to no avail. I've also searched for examples for what I'm trying to do, with no luck whatsoever. This has probably been answered, oh, a 1,000 times or more already, but I have to ask as I'm really frustrated right now...
I'm in the process of setting up weapons and gear loadouts/kits for the infantry units, so that when it comes time to edit the unit's
init field it's not a cluttered and long listed mess. So I figured, why not make the loadouts as scripts, and then simply enter the script name that's to be executed inside the init line of the unit that you want to have said script? Sounds simple, right?
Each and every time I've loaded up the mission in the editor, my avatar (that I'm testing the script approach on) shows up weaponless. I am getting an error message at the top, but I'll get to that in a minute.
Again, this unit is the
player's unit, and in its init line I have the following entered:
init="this exec ""L_I_hk416car_ap.sqs""; ";
So, here's what the above mentioned
script looks like (and "Yes," I made sure that I got the name of the script spelled correctly in my unit's init field):
init="RemoveAllWeapons this; this addmagazine ""SmokeShell""; this addmagazine ""SmokeShell""; this addmagazine ""HandGrenade""; this addmagazine ""SJB_TOS_M4_mag""; this addweapon ""SgtEv_c416_acog""; this addmagazine ""SJB_TOS_M4_mag""; this addmagazine ""SJB_TOS_M4_mag""; this addmagazine ""SJB_TOS_M4_mag""; this addmagazine ""SJB_TOS_M4_mag""; this addmagazine ""SJB_TOS_M4_mag""; this addmagazine ""SJB_TOS_Colt1911_mag""; this addmagazine ""SJB_TOS_Colt1911_mag""; this addmagazine ""SJB_TOS_Colt1911_mag""; this addmagazine ""SJB_TOS_Colt1911_mag""; this addweapon ""SJB_TOS_Colt1911""; this addweapon ""Binocular""; this addweapon ""NVGoggles""';
When I load up the mission, my equipment's not there, and I get an error message at the top of the screen. It's so long I can't even read the whole thing as it goes off the right edge of the screen, it begins, "'init="RemoveAllWeapons this; this addmagazine ""SmokeShell""; this addmagazine ""SmokeShell"" and just keeps going, repeating the init code as I have it listed in the script.
What am I doing wrong?
================================
Another issue, that's somewhat related to the one above. It should be noted that I was having this problem
before I tried executing my unit's loadout through its own weapon's script. The trouble I was having with this bug occurred when I had
all of the gear
listed inside the unit's init field. I was trying to launch a script that I located here, on "doubleweapons," the default script that came with the download was entitled "gun.sqs". I modified its contents to better suit the extra gear I wanted my unit to take, and whenever I tried loading the mission up with this script active, my unit would show up weaponless. 30 seconds later, however, the doubleweapons script would kick in, and I was able to grab all of its contents and use them fine, but that doesn't address the fundamental issue that the equipment that was desired in the init wasn't showing up. If I removed the doubleweapons script, the equipment spelled out in detail within the field would appear. Now, I'm wondering if the conflict here is that when the unit's init kicks in, it's supposed to remove
all weapons, and since the doubleweapons script that I have written has an extra firearm and grenades in it, is it getting confused by "knowing" that extra weapons are in another script that's delayed in its execution by 30 seconds, or ...? By default, the doubleweapons script must take 30 seconds to start, and as far as I've been able to tell, there's no workaround for that.
The problem grew even worse when I tried running the equipment script
along with the doubleweapons script through the unit's init field; after trying to load the mission for several minutes, it would crash to the desktop. Here's what my unit's init line looked like when I was trying to execute both scripts through it:
init="this exec ""L_I_hk416car_ap.sqs""; "; this exec ""guns.sqs""; "
The
order of the scripts had
no impact on avoiding a crash to desktop. It crashed every time, no matter what I order I tried.
So, in summation, this is want I'm hoping to make work: I want the player unit to get its weapon through a script, and I would also like to run this script with the doubleweapons script. Further on down the line, I'm going to try and have certain units execute AI scripts, such as Blanco's cover and hold stuff, so if there's a particular format I'm missing in order to get all of the scripts to work at the same time, I'd love to know what it is.
Yours,
Kyle
Nov. 6, 2007