canuckbrian

[RELEASE] Spawn Restriction Based On Corpse Location

7 posts in this topic

Removes spawn zones from the selection list that are within a certain range of the players corpse. Prevents players from spawning on top of, or near where they just died.

The script compares your corpse position to all Exile spawn zones. Any spawn zone that is closer than 3KM to your corpse won't be populated in the selection list. This is customizable, see below.

Script was not written by me, credit for that goes to @Janski, but I did request help in creating it and figured it's worth sharing, see here:

  1. Create a new text file and call it "ExileClient_gui_selectSpawnLocation_show.sqf"
  2. Paste the following code in to the new file and save it:
    /**
     * ExileClient_gui_selectSpawnLocation_show
     *
     * Exile Mod
     * www.exilemod.com
     * © 2015 Exile Mod Team
     *
     * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
     * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
     */
     
    private["_display","_spawnButton","_listBox","_listItemIndex","_numberOfSpawnPoints","_randNum","_randData","_randomSpawnIndex"];
    disableSerialization;
    ExileClientSpawnLocationSelectionDone = false;
    ExileClientSelectedSpawnLocationMarkerName = "";
    createDialog "RscExileSelectSpawnLocationDialog";
    waitUntil
    {
    	_display = findDisplay 24002;
    	!isNull _display
    };
    _spawnButton = _display displayCtrl 24003;
    _spawnButton ctrlEnable false;
    _display displayAddEventHandler ["KeyDown", "_this call ExileClient_gui_loadingScreen_event_onKeyDown"];
    _listBox = _display displayCtrl 24002;
    lbClear _listBox;
    {
    	if (getMarkerType _x == "ExileSpawnZone" && ((getMarkerPos ExileClientLastDeathMarker) distance (getMarkerPos _x)) > 3000) then
    	{
    		_listItemIndex = _listBox lbAdd (markerText _x);
    		_listBox lbSetData [_listItemIndex, _x];
    	};
    }
    forEach allMapMarkers;
    _numberOfSpawnPoints = {getMarkerType _x == "ExileSpawnZone" && ((getMarkerPos ExileClientLastDeathMarker) distance (getMarkerPos _x)) > 3000} count allMapMarkers;
    if (_numberOfSpawnPoints > 0) then 
    {
    	_randNum = floor(random _numberOfSpawnPoints);
    	_randData = lbData [24002,_randNum];
    	_randomSpawnIndex = _listBox lbAdd "Random";
    	_listBox lbSetData [_randomSpawnIndex, _randData];
    };
    true

     

  3. Create a folder in your mission file called "overwrites" and place "ExileClient_gui_selectSpawnLocation_show.sqf" inside the overwrites folder
  4. Open up your mission config.cpp file and find the section called "CfgExileCustomCode"
  5. Add the following in that section:
    ExileClient_gui_selectSpawnLocation_show = "overwrites\ExileClient_gui_selectSpawnLocation_show.sqf"; // Customized spawn selection menu

     

  6. Re-PBO your mission file and that's it!

 

To customize how far away spawn selection will be restricted adjust the numbers on lines 28 and 35. Currently set to 3000, this in in meters. If you want further, increase the numbers, if you want nearer decrease the numbers.

Everyone say a huge thanks to @Janski for figuring this out!

4 people like this

Share this post


Link to post
Share on other sites
Advertisement

You can actually die in one location, spawn in another, die there, and spawn back in the first location. Unfortunately people abuse this. 

Share this post


Link to post
Share on other sites
On April 10, 2016 at 0:31 PM, Janski said:

 

Well actually it works quite well if halo spawns are disabled. Even if you spawn somewhere else and die it's gonna take you to long before you can spawn back near your first dead body.

Share this post


Link to post
Share on other sites

Posted (edited)

2 hours ago, Repentz said:

You can actually die in one location, spawn in another, die there, and spawn back in the first location. Unfortunately people abuse this. 

I'd couple this with a suicide timer, limit suicides to not before 5 minutes of being alive or not whilst in the Bambi state.

Edited by kuplion

Share this post


Link to post
Share on other sites

I removed the suicide option all together from my server, forced spawning on the ground instead of parachuting or halo jumping. Makes it a bit harder for the players to kill themselves. Either have to find a tall object to jump off of, or they have to find some AI, zombies, or a player to kill them.

It's not perfect, but it works. I'm looking into how it can track the last X player death positions and use those for reference.

Share this post


Link to post
Share on other sites

Posted (edited)

Could this be modified to restrict spawn locations based upon time...so that players could not respawn in the same location over and over again? A respawn cooldown system that allows a player 1 respawn then that option is gone for say 10 minutes.

Edited by MudBone

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.