Jump to content

Recommended Posts

Hi,

 

I have been developing a mission now and i  have come to do the spawn menu.

 

I have set up the rscbuttons but i have no idea how to get the button on clicked to teleport someone to a part if the map.

 

Where would i set this up and what would the code look like

 

Thanks Harry

 

P.S i am pretty new to scripting so please dumb it down as much as possibe.

Share this post


Link to post
Share on other sites

In your .hpp file that contains the dialog, add an action line to the config class for the buttons as necessary.  I've added one to the last line of this example class:

class Your_Button: RscButton
{
	idc = 1;
	text = "Teleport"; //--- ToDo: Localize;
	x = 0.432989 * safezoneW + safezoneX; //-----The x, y, w, h, and size will be different for your button
	y = 0.566024 * safezoneH + safezoneY;
	w = 0.0618565 * safezoneW;
	h = 0.0550202 * safezoneH;
	sizeEx = 1 * GUI_GRID_H;
	action = "_yourUnit setPos (markerPos 'destinationMarker')";
};

Replace _yourUnit with the player or players or whatever and 'destinationMarker' with the name of whatever marker you want to teleport to.  If you want to use a more complicated but more robust system, you can write a function and call it in the same line.  Basically, the action line means that anything between the quotation marks is done when the button is clicked.

  • Like 1

Share this post


Link to post
Share on other sites

So, in game i would make a marker called kavala for example and then replace destinationmarker with kavala. if i wanted every one on the fraction to be able to spawn there what would i put in _yourunit

 

Thanks For the reply

 

Harry

Share this post


Link to post
Share on other sites
class a3_button_spawn_Kavala: RscButton

{

idc = 1600;

text = "Spawn At Selected"; //--- ToDo: Localize;

x = 0.644375 * safezoneW + safezoneX;

y = 0.248 * safezoneH + safezoneY;

w = 0.111562 * safezoneW;

h = 0.056 * safezoneH;

action = ((side _unit) == civiliansetPos (markerPos 'Kavala')";

};

Share this post


Link to post
Share on other sites

Post all of the dialog code and any code/fncs you're using with it.

Share this post


Link to post
Share on other sites

As @soolie said, it would help to have your full dialog code and any scripts or functions you're using for the back end.  A clear, full description of exactly what you want this dialog to accomplish would be helpful as well.

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

×