Jump to content
Sign in to follow this  
Lucky44

Random spawn positions for AI???

Recommended Posts

Haha, thanks again man. I swear I wish there was better documentation for the scripting (or someone to explain why it doesn't work), as the wiki seems to be misleading me, it seems so finicky with things that "should" work.

Now correct me if I'm wrong, but say If I wanted to contain my hostage conditions in a separate script file all I would have to do is this?

H1 = groupHostage createUnit ["GUE_Soldier_MG", _markerPos, [execVM "scriptName.sqf";], 0, "FORM"];

Or does that not work with createUnit_array?

Share this post


Link to post
Share on other sites

Are you running the game with -showScriptErrors? And also get a better look at your errors via arma2oa.rpt. It seems like some of your scripts simply aren't reaching the line you expect to execute.

You can also use waitUntil {!isNull player}; player sideChat "Line <whatever> reached"; to see how far your script went before it got stuck, as well as use player sideChat format ["%1 %2 %3", _var1, _var2, _var3]; to see if your variables have the values you expect them to have.

Share this post


Link to post
Share on other sites

Seems you're mixing up the two commands... where you call the script is really for markers! You can have the unit spawn at a marker randomly.

H1 = groupHostage createUnit ["GUE_Soldier_MG", _markerPos, [[color="#FF0000"]"markerA1","markerA2","markerA3"[/color]], 0, "FORM"];

You could do this...

H1 = groupHostage createUnit ["GUE_Soldier_MG", _markerPos, [], 0, "FORM"];
nul = [H1] execVM "scriptName.sqf";

...and scriptname.sqf would start like this to select the passed unit...

_unit = _this select 0;

//code block...do whatever you want with the unit here

---------- Post added at 01:19 PM ---------- Previous post was at 01:15 PM ----------

Do you know about what Galzohar mentioned?... I did mention diag_log and the report file in a previous post. It's good advice to make -showscripterrors, hint, diag_log and the report file your good friends.

Share this post


Link to post
Share on other sites

Yea just added those in as well, thank you guys for your patience and help so much. Got what I wanted running properly now!

Share this post


Link to post
Share on other sites

Cool man... you might have just gone down the rabbit hole. Hooked for life!

Share this post


Link to post
Share on other sites

Haha I've been programming for close to 18 years now, just always fun tackling a new challenge, especially when it comes to scripting.

Share this post


Link to post
Share on other sites

Same here... programming a long time. Found this about 12 years ago and been fiddling with it ever since. Trust me mate... you've found many challenges and much, much more!

Enjoy!

Twirly.

Share this post


Link to post
Share on other sites

Just started scripting in ArmA 2 and I found this thread really helpful for designing my first mission :) I managed to get the switch statement version of this working deadlyhabit just in case you see this!! The variables in the switch statement were all local and as such couldn't be accessed by the rest of the script :) Just delete the _ and it works fine :D

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  

×