Jump to content
Sign in to follow this  
katipo66

Call random script from description.ext

Recommended Posts

Hi, Im trying to get this button to choose random scripts, i have tried this below to no avail, can someone point me in the right direction, or is it even possible etc?

class but4:but1{
	text = "Missions";
	private ["_scriptNum"];
_scriptNum = floor(random 2);
switch (_scriptNum) do {
case 0:
{
  action = "temp = execVM ""missions\01mission.sqf""; closeDialog 0";
};
case 1:
{
 action = "temp =  execVM ""missions\01mission2.sqf""; closeDialog 0";
};
};
	y = 0.52;
};

This is the original button code calling single script no problem:

class but4:but1{
	text = "Mission One";
	action = "temp = execVM ""missions\01\mission.sqf""; closeDialog 0";
	y = 0.52;

Share this post


Link to post
Share on other sites

Do not think you can have scripting like that in your description.ext. Would recommend using a wrapper script that has the randomization code and referencing the wrapper in the description.

Share this post


Link to post
Share on other sites

description.ext

class but4 : but1 
{
       text = "Missions";
       action = "call fnc_selectRandomMission";
       y = 0.52;
};

init.sqf

fnc_selectRandomMission =
{
private ["_rNum"];
_rNum = floor (random 2);
switch (_rNum) do
{
	case 0:
	{
	   execVM "missions\01mission.sqf";
	   closeDialog 0;
	};
	case 1:
	{
	  execVM "missions\01mission2.sqf";
	  closeDialog 0;
	};
};
};
};

Ok if you just put both of those in, it should work. I haven't tested it though :) might have missed something out.

Share this post


Link to post
Share on other sites

Cheers Evil_Echo...

@Andy455... i have just tested it, and it worked awesome! thank you very much :D

Share this post


Link to post
Share on other sites

xa xa xa Unleashing the beast of spawning, right? :yay:

Great work and idea Katipo66, could you do an article for WICT homepage? :cool:

We are rising sandboxing to another level? Do you even know this gave me goosebumps and chills through my spine -- a whole new chapter man :)

What I have in mind right now is "Mass Effect 2" ;) I really can't wait for that article, make a nice tutorial please, this will be fantastic for Marshal of Savana.

You nailed it once again with your idea, pure beauty and ellegance... I am speechless...

Edited by ArmAIIholic

Share this post


Link to post
Share on other sites

Ahaha... your quick, yes i am looking at this with the beast of spawning in mind ! i love this option :D

No worries, ill do an article once i get everything right!

i hope BIS improve the 3D editor!!

Edited by Katipo66

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  

×