Jump to content
Sign in to follow this  
Anzu

Basic Weapon Script Not Working....

Recommended Posts

Okay I've been doing a lot of reading over the past week or so and I've learned a lot. So, now I'm trying to apply what I've learned to improve my ArmA II experience. Well heres the scenario...

I have a basic mission I've created and I want my team to start out with custom weapons. So I used ArmA Edit to create 3 custom unit loadout scripts and placed them in my "Documents/ArmA 2/missions/mymission/" folder. Then I added "this exec "myscript.sqs"" to the init box for each of the units. saved the missions, and exported to single player. but wen i start the mission, the scripts dont work! i've tried moving them to a "scripts" folder in the folder i mentioned above, still doesnt work. i also tried moving them to the ArmA 2 installation folder, still doesnt work. i have a feeling im missing something really basic. but WTF am I doing wrong? X_X this is frustrating!

anyways, if anyone can give me some advice, itd be much appreciated.

thanks in advance! :-)

Edited by Anzu

Share this post


Link to post
Share on other sites

try:

nul = [this] execVM "ScriptName.sqf";

and place the script in the mission folder.

Share this post


Link to post
Share on other sites

should i rename the script files to .sqf instead of .sqs also?

---------- Post added at 06:23 PM ---------- Previous post was at 06:00 PM ----------

nevermind! i figured it out. thanks for the quick response though!

apparently, in the script files, it was using this as the first line:

"_unit = _this select 0"

i changed it to this:

"_unit = myunitsname"

and now it works. anyways, sorry for wasting space on the forums. u can delete this thread if u want :-P

Share this post


Link to post
Share on other sites

It's probably still why the script didn't work in the first place: you must pass the parameters ("this") in an array, so that "_this select 0" means something to the game.

Share this post


Link to post
Share on other sites
i've already broken 3 glasses trying figure this out, who knows what ill smash next X_X but this is SO F*#$&*CKING frustrating!

anyways, if anyone can give me some advice, itd be much appreciated. but please dont tell me to "do a search" or "read the wiki", cuz ive been doing that A LOT for the past week and i still cant get it.

thanks in advance! :-)

Just take a deep breathe and relax, it's only a game. ;)

Share this post


Link to post
Share on other sites
It's probably still why the script didn't work in the first place: you must pass the parameters ("this") in an array, so that "_this select 0" means something to the game.

Or a more proper fix is to change _unit = _this select 0 to just _unit = _this, then his execution is correct.

Share this post


Link to post
Share on other sites

Well maybe it's just me but I figure when passing only 1 argument why bother putting it into an array? It's only more typing, and more likely that you'll become confused.

Share this post


Link to post
Share on other sites
Well maybe it's just me but I figure when passing only 1 argument why bother putting it into an array? It's only more typing, and more likely that you'll become confused.

If you always stick to one convention, you won't get confused :)

Share this post


Link to post
Share on other sites

Passing a single element array is just improper IMO. It only gets confusing when people use the wrong conventions...

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  

×