Custom spawn between 2 selected points

Matt L

OpenDayZ Rockstar!
Help and discussion for Custom spawn between 2 selected points shall begin here.....

Some of your syntax is incorrect, you have too many closing brackets and you're missing some semicolons, other than that you're spot on. Don't get me wrong, it'll still work how you have it, but you might get some unexpected results at times.

Here's a fix:

^.^
 
Random
Code:
 _var = random 1;
     
        if (_var > 0.5) then {
Means it has a 50% chance of choosing between the two. I am sure you could add even more points if you changed the _var accordingly
 
The point of this script is to pick between 2 locations at random, if you want a single and set location look at my thread (and remember to look at the fix for 1.7.7.1 on the last page if you're running that version of dayz).

I knew that, but like.. is it possible to make it so you can choose between spawn points? I mean something like origins does but with select points..

I assume it would be difficult if even possible
 
The point of this script is to pick between 2 locations at random, if you want a single and set location look at my thread (and remember to look at the fix for 1.7.7.1 on the last page if you're running that version of dayz).


Code:
if (!isDedicated) then {
        sleep 1;
        //                          Player UID's
        if ((getPlayerUID player) in ["123644358"]) exitWith {
                _var = random 1; //generates a random value between 0 and 1
                if (_var > 0.25) then {
                        player setPosATL [2090.08,11855.3,0.001];
                } else {
                        player setPosATL [9924.58,2795.41,0.002];
                } else {
                        player setPosATL [9924.58,2795.41,0.002];
                } else {
                        player setPosATL [9924.58,2795.41,0.002];
                };
        };
        //                          Player UID's
        if ((getPlayerUID player) in ["89453894"]) exitWith {
                //## Custom Spawn Location 2 - Format: [X,Y,Z] (Z = Height AtTerrainLevel)
                player setPosATL [9924.58,2795.41,0.002];
        };
};

Would that work to have say 4 different points instead of 2?
 
I knew that, but like.. is it possible to make it so you can choose between spawn points? I mean something like origins does but with select points..
I assume it would be difficult if even possible
That is a whole different mod with a different intent to this one, but yes it is possible.
Code:
*snip*

Would that work to have say 4 different points instead of 2?


No, it wouldn't.
For that, try this (untested):
Code:
if (!isDedicated) then {
        sleep 1;
        //                          Player UID's
        if ((getPlayerUID player) in ["123644358"]) exitWith {
_var = random 1; //generates a random value between 0 and 1
if (_var < 0.25) then {
player setPosATL [2090.08,11855.3,0.001];
} else {
if (_var < 0.5 and _var > 0.25) then {
player setPosATL [9924.58,2795.41,0.002];
} else {
if (_var > 0.5 and _var < 0.75) then {
player setPosATL [9924.58,2795.41,0.002];
} else {
if (_var > 0.75 and _var < 1) then {
player setPosATL [9924.58,2795.41,0.002];
};
};
};
};
        };
        //                          Player UID's
        if ((getPlayerUID player) in ["89453894"]) exitWith {
                //## Custom Spawn Location 2 - Format: [X,Y,Z] (Z = Height AtTerrainLevel)
                player setPosATL [9924.58,2795.41,0.002];
        };
};

There is a better method of doing this via switches and cases if you have time to look it up I'd recommend it.
 
That is a whole different mod with a different intent to this one, but yes it is possible.



No, it wouldn't.
For that, try this (untested):
Code:
if (!isDedicated) then {
        sleep 1;
        //                          Player UID's
        if ((getPlayerUID player) in ["123644358"]) exitWith {
_var = random 1; //generates a random value between 0 and 1
if (_var < 0.25) then {
player setPosATL [2090.08,11855.3,0.001];
} else {
if (_var < 0.5 and _var > 0.25) then {
player setPosATL [9924.58,2795.41,0.002];
} else {
if (_var > 0.5 and _var < 0.75) then {
player setPosATL [9924.58,2795.41,0.002];
} else {
if (_var > 0.75 and _var < 1) then {
player setPosATL [9924.58,2795.41,0.002];
};
};
};
};
        };
        //                          Player UID's
        if ((getPlayerUID player) in ["89453894"]) exitWith {
                //## Custom Spawn Location 2 - Format: [X,Y,Z] (Z = Height AtTerrainLevel)
                player setPosATL [9924.58,2795.41,0.002];
        };
};

There is a better method of doing this via switches and cases if you have time to look it up I'd recommend it.

Cool. Thanks
 
on a side note, wouldn't this work better for random spawn points between the two?

Code:
if (!isDedicated) then {
        sleep 1;
        //                          Player UID's
        if ((getPlayerUID player) in ["123644358"][FONT=Consolas]) exitWith {[/FONT]
                        player setPosATL [[9924.58,2795.41,0.002], [9924.58,2795.41,0.002],[9924.58,2795.41,0.002],[2090.08,11855.3,0.001]] call BIS_fnc_selectRandom;
                };
        };
        //                          Player UID's
        if ((getPlayerUID player) in ["89453894"]) exitWith {
                //## Custom Spawn Location 2 - Format: [X,Y,Z] (Z = Height AtTerrainLevel)
                player setPosATL [9924.58,2795.41,0.002];
        };
};

Your method might work but wouldnt something like that bypass the need to set a var and all that and just choose at random?
 
Hey guys,
first at all ...really nice work thx :)
now my question : Is it possible to make a spawn point to an Object that i placed on a map so all players spawns near the object ?
 
Hey guys,
first at all ...really nice work thx :)
now my question : Is it possible to make a spawn point to an Object that i placed on a map so all players spawns near the object ?

You can place a marker of type Empty (to make it invisible) and getPos the marker to define the spawn point. You can then place the marker wherever you've placed the object.
 
thx buttface the thing is i want a function that set all spaws to the Object (or Marker) but only if the Object is spawned. especially for Events on a Server
 
You can do this by spawning the marker along with the object. For example, in my AI mod I create markers to help me locate triggers I have spawned. Here is a simplified version to demonstrate how I link the trigger object and the marker:

Code:
_trigger = createTrigger ["EmptyDetector",_pos];
_markername = format ["%1",_trigger];
_marker = createMarker [_markername,_pos];

By doing this, I can easily refer to the marker if I also have a reference to the trigger object. Now suppose I wanted to delete the trigger. I don't want to leave behind a useless marker, so I will delete it as well.

Code:
_markername = format ["%1",_trigger];
deleteMarker _markername;
deleteVehicle _trigger;
 
thx for the fast reply ... i will play around with that. thank you :)

That shows me an script error :/

and where is the spawn Pos cant figure it out both using getPos but there is no Position... hmm
 
got it working .. good ok ..another question can i flag a player to a side to get a custom spawn point on every death... or is it possible to enable East Side in DayZ , i've set in description the GameMode to Team and placed respawn_east in the mission.sqm .. but when i start the server i cant enter any side, all is disabled... ServerLog -> no Errors hmm
 
got it working .. good ok ..another question can i flag a player to a side to get a custom spawn point on every death... or is it possible to enable East Side in DayZ , i've set in description the GameMode to Team and placed respawn_east in the mission.sqm .. but when i start the server i cant enter any side, all is disabled... ServerLog -> no Errors hmm

Look at the original code up top, the one without the variances is the custom spawn on every death, the one with _var is the randomized between 2 spots one.
 
Back
Top