Jump to content
Sign in to follow this  
D. Patterson

Multiple Functions In One SQF, Multiple Add Action.

Recommended Posts

So I have a post, that when you walk up to it, you get several action menu items. Teleport 1, Teleport 2, Teleport 3. How do I make it so I can have each one link to the same sqf, but the sqf can differentiate between what option was selected. Im fine with putting multiple addactions in the init, but I dont want Teleport1.sqf, teleport 2.sqf, etc. (Because I actually have 15 teleport positions).

Share this post


Link to post
Share on other sites

As L3TUC3 says using a switch statement in your teleport.sqf will do the job.

Just make each addAction pass something in the arguments that you can check against e.g

Actions

_object addAction ["Teleport 1", "teleport.sqf", 1 ];
_object addAction ["Teleport 2", "teleport.sqf", 2 ];

teleport.sqf

_passedArgument = _this select 3;

switch (_passedArgument) do {
case 1 : {
	//do whatever
};
case 2 : {
	//etc
};
};

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  

×