IRONFRONT FANS FORUM
Register Latest Topics
 
 
 


Reply
  Author   Comment  
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,733
Reply with quote  #1 
Download: Pick spawn from menu

This will create a menu with a gui, with a list of spawn locations you choose.

Create the following scripts:

Description.ext
Code:
respawn = base;
respawndelay = 3;
respawndialog = 0;
class header {
gametype = coop;
maxplayers = 3;
minplayers = 1;
};
class doostatic {
type = 0;
idc = -1;
style = 0;
x = 0;
y = 0;
w = 1;
h = 1;
colorBackground[] = {0, 0, 0, 0.75};
colorText[] = {0, 0, 0, 1};
font = "Zeppelin32";
sizeEx = 0.023;
text = "";
};
class doobutton {
type = 1;
idc = -1;
style = "0x02 + 0x100";
x = 0;
y = 0;
w = 0.095589;
h = 0.039216;
colorText[] = {0.543, 0.5742, 0.4102, 1};
colorDisabled[] = {0.4, 0.4, 0.4, 1};
font = "Zeppelin32";
sizeEx = 0.03921;
text = "";
colorBackground[] = {1, 0.537, 0, 0.5};
colorBackgroundActive[] = {1, 0.537, 0, 1};
colorBackgroundDisabled[] = {0.95, 0.95, 0.95, 1};
colorFocused[] = {1, 0.537, 0, 1};
offsetX = 0.003;
offsetY = 0.003;
offsetPressedX = 0.002;
offsetPressedY = 0.002;
colorShadow[] = {0.023529, 0, 0.0313725, 1};
colorBorder[] = {0.023529, 0, 0.0313725, 1};
borderSize = 0;
soundEnter[] = {"\ca\ui\data\sound\mouse2", 0.09, 1};
soundPush[] = {"\ca\ui\data\sound\new1", 0.09, 1};
soundClick[] = {"\ca\ui\data\sound\mouse3", 0.07, 1};
soundEscape[] = {"\ca\ui\data\sound\mouse1", 0.09, 1};
};
class doolistbox {
type = 5;
idc = -1;
style = "0 + 0x10";
x = 0;
y = 0;
w = 0;
h = 0;
colorText[] = {0.543, 0.5742, 0.4102, 1};
colorSelect[] = {0.95, 0.95, 0.95, 1};
soundSelect[] = {"\ca\ui\data\sound\new1", 0.09, 1};
class ScrollBar {
thumb = "\ca\ui\data\ui_scrollbar_thumb_ca.paa";
arrowEmpty = "\ca\ui\data\ui_arrow_top_ca.paa";
arrowFull = "\ca\ui\data\ui_arrow_top_active_ca.paa";
border = "\ca\ui\data\ui_border_scroll_ca.paa";
};
font = "Zeppelin32";
sizeEx = 0.03921;
rowHeight = 0.05;
autoScrollRewind = 0;
autoScrollDelay = 1;
autoScrollSpeed = -1;
maxHistoryDelay = 1;
};
class doodialog {
idd = 3000;
class controls {
class title : doostatic {
idc = 3001;
};
class mylistbox : doolistbox {
idc = 3002;
x = 0.152782;
y = 0.27103;
w = 0.39;
h = 0.483;
onlbdblclick = "[] spawn doobuy";
};
class okbutton : doobutton {
idc = 3003;
x = 0.752;
y = 0.7625;
text = "$STR_DISP_OK";
onbuttonclick = "[] spawn doobuy";
default = 1;

};
class cancelbutton : doobutton {
idc = 3004;
x = 0.552;
y = 0.7625;
text = "$STR_DISP_CANCEL";
onbuttonclick = "closedialog 3000";
};
};
};


Buy.sqf
Code:
 _lbdata = lbdata [3002, lbcursel 3002];
if (_lbdata == "") exitwith {[playerside, "hq"] sidechat "No item selected"};

if ({alive _x} count doorespawnarray != 0) then {
{
if (str _x == _lbdata) exitwith {
_r = random 360;
vehicle player setdir _r - 180;
vehicle player setpos [((getpos _x) select 0) + sin _r * 10, ((getpos _x) select 1) + cos _r * 10, 0];
};
} foreach doorespawnarray;
};
closedialog 3000;


Init.sqf
Code:
enablesaving [false, false];

doogetloc = {
        if (!isNil "doorespawn_names") exitWith {
            doorespawn_names select (doorespawnarray find _this)
        };
private "_loc";
_loc = nearestlocations [getPos _this, ["NameCityCapital", "NameCity", "NameVillage", "NameLocal", "Hill", "NameMarine"], 1500];
if (count _loc != 0) then {
if (text (_loc select 0) != "") then {
text (_loc select 0)
} else {
mapgridposition _this
};
} else {
mapgridposition _this
};
};

doorespawn_names = ["Spawn 1", "Spawn 2", "Spawn 3", "Spawn 4", "Spawn 5"];
doorespawnarray = [flag1, flag2, flag3, flag4, flag5];
titletext ["","black faded"];

if not isserver exitwith {};


Player.sqf
Code:
player creatediaryrecord ["diary", ["About", "<br /><br />Map by Doolittle"]];
player setvariable ["BIS_noCoreConversations", true];

[] spawn {
while {true} do {
waituntil {alive player};
titletext ["", "black in"];
if ({alive _x} count doorespawnarray > 1) then {
if createdialog "doodialog" then {
uinamespace setvariable ["doolb", finddisplay 3000 displayctrl 3002];
if not isnull (uinamespace getvariable "doolb") then {
{
if (alive _x) then {
_index = (uinamespace getvariable "doolb") lbadd (gettext (configfile >> "CfgVehicles" >> typeof _x >> "displayName") + " at " + (getpos _x call doogetloc));
(uinamespace getvariable "doolb") lbsetdata [_index, str _x];
};
} foreach doorespawnarray;
};
};
};
sleep 5;
waituntil {not alive player};
if dialog then {closedialog 3000};
sleep (playerrespawntime - 2);
titletext ["", "black out"];
};
};

doobuy = compile preprocessfile "buy.sqf";


Editor

Place Flags
The way this respawn works is in the editor you place flags at those locations you wish to respawn at.
The flag would be named flag1, flag2, flag3, flag4, flag5, ect,.

Place Trigger
then place a trigger with this code in the init line:
Code:
_dummy = [] execvm "playerinit.sqf"


Respawn Menu
When you get killed or respawn a transparent black screen pops up, and a list on the left shows what spawn you have to choose from.
and at the bottom of the screen you have an cancel button and an ok button.

If you choose your spawn and then hit ok then obviously you will respawn at that spawn. If you hit cancel then you will respawn right
where you are, basically where you died. You can remove the cancel button via the description.ext and then
you are forced to spawn at an location on the list, or menu.
=========
I've yet to test this in IF but have used it many times in Arma2CO, so it should work.

__________________
0
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,733
Reply with quote  #2 
Scripts are now hosted on the MR, readme included, link added to the top of the first post for download.

I converted all code into the scripts required to make this work, as said at bottom of the post above, this works in Arma2Co np,
but i haven't tested it in Iron front or DLC, so if someone is interested test and see what you think, its for mp only wont work in sp.

__________________
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.