Jump to content
Sign in to follow this  
Freddan962

Need help - Script does not execute

Recommended Posts

Hello,

I've made a mission and a script but for some reason the script doesn't want to execute.

spawn.sqf

hint "Script has been executed";

_counter = 0;
for "_counter" from 1 to 10 do
{	
_x = floor(random 25);

_y = floor(random 50);
_xx = floor(random 50);

switch (_x) do
{
	case 1: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 2: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 3: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 4: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 5: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 6: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 7: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 8: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 9: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 10: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 11: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 12: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 13: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 14: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 15: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 16: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 17: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 18: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 19: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 20: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 21: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 22: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 23: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
	case 24: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"]};
};

_counter = _counter + 1;	
};

init.sqf

[] execVM "spawn.sqf";

Project files: http://filebeam.com/fdff362cc0f3f25454b332199b2a5904

I know it's badly written but it's just a placeholder while trying to figure this out.

Please help me, I'd be grateful! :)

Edited by Freddan962

Share this post


Link to post
Share on other sites

What are you trying to do?

spawning 10 units on that marker?

just use:

{
"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"];
} forEach [1,2,3,4,5,6,7,8,9,10];

wouldn't it be much easier?

or I got you wrong with the purpose of your script...

Share this post


Link to post
Share on other sites
What are you trying to do?

spawning 10 units on that marker?

just use:

{
"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor"];
} forEach [1,2,3,4,5,6,7,8,9,10];

wouldn't it be much easier?

or I got you wrong with the purpose of your script...

I don't need help with the code, as of right now, however I don't understand why the script (spawn.sqf) isn't executing.

Share this post


Link to post
Share on other sites

you are missing ; from the end of the first line

Share this post


Link to post
Share on other sites
you are missing ; from the end of the first line

Edited, issue persists :<

Share this post


Link to post
Share on other sites
I don't need help with the code, as of right now, however I don't understand why the script (spawn.sqf) isn't executing.

Your problem is with many things within this code. why staying with this if you can do the same thing with much less lines of code and much easier thing...

Share this post


Link to post
Share on other sites
Your problem is with many things within this code. why staying with this if you can do the same thing with much less lines of code and much easier thing...

More or less code wouldn't matter if it doesn't want to execute.

Share this post


Link to post
Share on other sites

Would this solve your problem?

http://forums.bistudio.com/showthread.php?160130-SelectPlayer-MP-compatible&p=2451764&viewfull=1#post2451764

Also, please refer to: http://forums.bistudio.com/showthread.php?121163-Script-not-working-Use-the-showScriptErrors-parameter!

Developing something without any error ouput it highly negligent.

Edited by XxAnimusxX

Share this post


Link to post
Share on other sites

As for the original scrip this should work

hint "Script has been executed";

_counter = 0;
for "_counter" from 1 to 10 do
{	
_x = floor(random 25);

_y = floor(random 50);
_xx = floor(random 50);

grp=creategroup west;[

switch (_x) do
{
	case 1: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor",grp, "", 1.0, "private"]};
// rest of your code


ect.

Share this post


Link to post
Share on other sites
As for the original scrip this should work

hint "Script has been executed";

_counter = 0;
for "_counter" from 1 to 10 do
{	
_x = floor(random 25);

_y = floor(random 50);
_xx = floor(random 50);

grp=creategroup west;[

switch (_x) do
{
	case 1: {"USMC_Soldier_AA" createUnit [getMarkerPos "bluefor",grp, "", 1.0, "private"]};
// rest of your code


ect.

I used your code and it still didn't execute. Also, I have the show script error parameter but it doesn't show any.

Grateful for more help! :)

Share this post


Link to post
Share on other sites

sorry slight typo grp=creategroup west;[ should be grp=creategroup west;

Share this post


Link to post
Share on other sites
sorry slight typo grp=creategroup west;[ should be grp=creategroup west;

Still doesn't work =/

Share this post


Link to post
Share on other sites

I think you were tring to do something along these lines,if

init.sqf

waitUntil {time > 3};
if(isServer) then { 
_null = [] execVM "spawn.sqf";
};

spawn.sqf

diag_log "Script has been executed";
_tempGroup = createGroup WEST;
_counter = 0;
_unittype = "USMC_Soldier_AA";
_marker = "bluefor";
for "_i" from 0 to 10 do { 	
_x = floor(random 25);

_y = floor(random 50);
_xx = floor(random 50);

switch (_x) do
{
	case 1: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 2: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 3: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 4: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 5: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 6: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 7: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 8: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 9: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 10: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 11: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 12: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 13: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 14: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 15: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 16: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 17: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 18: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 19: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 20: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 21: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 22: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 23: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
	case 24: {_unittype = "USMC_Soldier_AA";_marker = "bluefor";};
};
   diag_log format["counter: %1",_i];
    _unit = _tempGroup createUnit [_unittype, [(getMarkerPos _marker select 0) + _y,(getMarkerPos _marker select 1)+_xx,0], [], 0, "FORM"];
};

Edited by xyberviri

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  

×