Jump to content

Recommended Posts

I have been working on a spawnPoints generation script for my missions, and I have a few issues with it, so I am looking for advice and assistance. I am making it for a general all purpose spawn point generation system, all side mission with many players.

 

The Issues I am having include:

- An error when BIS_fnc_removeRespawnPosition is used as I generate it dynamically, and cannot seem to fetch the ID # associated to the object when it is spawned.

- An error when respawning on created point at the respawn MenuPosition: BIS_fnc_showRespawnPositionMapDraw  Draw Icon: type any, expected string. The fnc is still listed as //TODO in the functions in game, not sure if there is anything that can be done.

- And my primary concern is that the new Respawn position seems to remove the existing name off of the initial spawn point, and replace it with the name that should be used for the first BIS_fnc_addRespawnPosition; basically switching the two.

 

Edit: Just played an old mission with a different version of spawning respawn positions, and got the same issue can somebody verify this?

 

Also, still unsure how many problems may arise as multiple triggers are fired, multiple fires of the same trigger, and other "Unknown" multiplayer issues can be prevented; Therefore Advice is welcomed.

 

Spoiler

/*
Created by Contrathiest Aka. Trenchcoat of Necessary Genocide Gaming

Instructions:

Use this script by adding to the on act line of trigger: 
nul = [thisTrigger, "AO Name"] spawn NGG_fnc_spawnPoints;
set trigger as activated by anyone present, repeatable and Server only.

*/

 

 

private ["_trigger","_locName","_aoSize","_locNameStr","_safeLoc","_bl","_op","_in","_markerCiv","_markerBlu","_markerOpf","_markerInd","_spawnMkr"];

_trigger = _this select 0;  //"thisTrigger" is first array object
_locName = _this select 1;  //Name of AO
_locNameStr = format ["%1", _locName];
_safeLoc = [_trigger, 15, 120, 5, 0, 15, 0] call BIS_fnc_findSafePos;

[civilian, _safeLoc] call BIS_fnc_removeRespawnPosition; //Try to eliminate duplicates
[west, _safeLoc] call BIS_fnc_removeRespawnPosition;
[east, _safeLoc] call BIS_fnc_removeRespawnPosition;
[independent, _safeLoc] call BIS_fnc_removeRespawnPosition;

_newSpn = [civilian, _safeLoc, _locNameStr] call BIS_fnc_addRespawnPosition; //create unused civilian spawnPoint
_markerCiv = createMarkerLocal ["CIV_spawnMkr_#",_safeLoc];
_markerCiv setMarkerTypeLocal "respawn_inf";
_markerCiv setMarkerColorLocal "ColorCIV";
_markerCiv setMarkerSizeLocal [0.7,0.7];
_spawnMkr = "CIV_spawnMkr_#";


while {(alive player && player inArea _trigger)} do {

sleep 30;
_bl = {[_trigger, _x] call BIS_fnc_inTrigger && side _x == west && alive _x} count allUnits;
_op = {[_trigger, _x] call BIS_fnc_inTrigger && side _x == east && alive _x} count allUnits;
_in = {[_trigger, _x] call BIS_fnc_inTrigger && side _x == independent && alive _x} count allUnits;

if (_bl > _op + _in) exitWith {
deleteMarkerLocal _spawnMkr;
[civilian, _newSpn] call BIS_fnc_removeRespawnPosition;
[west, _newSpn] call BIS_fnc_removeRespawnPosition;
[east, _newSpn] call BIS_fnc_removeRespawnPosition;
[independent, _newSpn] call BIS_fnc_removeRespawnPosition;
_newSpn = [west, _safeLoc, _locNameStr] call BIS_fnc_addRespawnPosition;
_markerBlu = createMarkerLocal ["WEST_spawnMkr_#",_safeLoc];
_markerBlu setMarkerTypeLocal "respawn_inf";
_markerBlu setMarkerColorLocal "ColorWEST";
_markerBlu setMarkerSizeLocal [0.7,0.7];
_spawnMkr = "WEST_spawnMkr_#";
hint format ["NATO units have occupied %1!", _locName];
sleep 120;
};

if (_op > _bl + _in) exitWith {
deleteMarkerLocal _spawnMkr;
[civilian, _newSpn] call BIS_fnc_removeRespawnPosition;
[west, _newSpn] call BIS_fnc_removeRespawnPosition;
[east, _newSpn] call BIS_fnc_removeRespawnPosition;
[independent, _newSpn] call BIS_fnc_removeRespawnPosition;
_newSpn = [east, _safeLoc, _locNameStr] call BIS_fnc_addRespawnPosition;
_markerOpf = createMarkerLocal ["EAST_spawnMkr_#",_safeLoc];
_markerOpf setMarkerTypeLocal "respawn_inf";
_markerOpf setMarkerColorLocal "ColorEAST";
_markerOpf setMarkerSizeLocal [0.7,0.7];
_spawnMkr = "EAST_spawnMkr_#";
hint format ["CSAT units have occupied %1!", _locName];
sleep 120;
};

if (_in > _bl + _op) exitWith {
deleteMarkerLocal _spawnMkr;
[civilian, _newSpn] call BIS_fnc_removeRespawnPosition;
[west, _newSpn] call BIS_fnc_removeRespawnPosition;
[east, _newSpn] call BIS_fnc_removeRespawnPosition;
[independent, _newSpn] call BIS_fnc_removeRespawnPosition;
_newSpn = [independent, _safeLoc, _locNameStr] call BIS_fnc_addRespawnPosition;
_markerInd = createMarkerLocal ["GUER_spawnMkr_#",_safeLoc];
_markerInd setMarkerTypeLocal "respawn_inf";
_markerInd setMarkerColorLocal "ColorGUER";
_markerInd setMarkerSizeLocal [0.7,0.7];
_spawnMkr = "GUER_spawnMkr_#";
hint format ["Independent units have occupied %1!", _locName];
sleep 120;
};


};

 

I have spent quite a few days getting this to where it is at currently, as well as searching high and low for examples; so I am attempting to generate my own that basically anyone could use easily. Your help is greatly appreciated.

 

Share this post


Link to post
Share on other sites

So, This is coming along and usable for the time being, but is still throwing the BIS_fnc_removeRespawn position error; and looking for the answer is driving me bonkers.

 

The Wiki says: Return Value:Array - format [target,id] (used in BIS_fnc_removeRespawnPosition)

 

How would I be able to retrieve this information and use the ID to remove and avoid the pesky errors that constantly pop up during mission testing?

 

Share this post


Link to post
Share on other sites
On 1/27/2020 at 12:06 AM, Trenchcoat said:

_safeLoc = [_trigger, 15, 120, 5, 0, 15, 0] call BIS_fnc_findSafePos;

[civilian, _safeLoc] call BIS_fnc_removeRespawnPosition;

 

BIS_fnc_removeRespawnPosition takes a target and a ID:

target: Namespace or Side or Group or Object

id: Number

 

_safeloc is an array.

 

On 1/27/2020 at 12:06 AM, Trenchcoat said:

_newSpn = [civilian, _safeLoc, _locNameStr] call BIS_fnc_addRespawnPosition;

On 1/27/2020 at 12:06 AM, Trenchcoat said:

[civilian, _newSpn] call BIS_fnc_removeRespawnPosition;

 

BIS_fnc_addRespawnPosition returns an array:

Return Value: Array - format [target,id]

 

Try:

[civilian, (_newSpn # 1)] call BIS_fnc_removeRespawnPosition;

Share this post


Link to post
Share on other sites
1 hour ago, RCA3 said:

Try:

[civilian, (_newSpn # 1)] call BIS_fnc_removeRespawnPosition;

 Thank you @RCA3It Seemed to work at first, but it deletes the first respawn as soon as another is created. As I am looking to set one at each area, and have them persist unless the area is taken by another faction (it will be running at 30 or so locations at a time).

 

Is there a way to capture the info returned from each creation and store it in the object so that the local object can have the ID number referenced when being removed? I am thinking to store it as a setVariable, but just need to fetch it primarily.  I know in the functions for BIS_fnc_addRespawnPosition it pulls the ID into another private variable, I am trying to pull that ID out, store it in my own local variable, use setVariable to store in the object and pull it out when the object is removed or factions change. Is it possible to achieve this or something similar?

Share this post


Link to post
Share on other sites

Yep 😉

Seems feasible, I think you got it figured out. Just keep the syntaxes correct and when needed pull values from arrays with # or select. E.g. _array1 = [a, b, c]; _myvariable =  _array1 # 1; _myvariable returns b.

  • Thanks 1

Share this post


Link to post
Share on other sites

it looks like they have some of the info set as a variable already, so I am going to try to grab what I need real quick; and see if this "magic" works...  I will update hopefully soon.

  • Like 1

Share this post


Link to post
Share on other sites

Well, none of the original variables seem to be recognized as such, so I am just getting errors or null at every turn. I am going to keep digging.

  • Like 1

Share this post


Link to post
Share on other sites
On 1/27/2020 at 12:06 AM, Trenchcoat said:

private ["_trigger","_locName","_aoSize","_locNameStr","_safeLoc","_bl","_op","_in","_markerCiv","_markerBlu","_markerOpf","_markerInd","_spawnMkr"]; 

 

Remove this line and set private independently for each variable. E.g. private _myvariable = _this;

Remember they stay private for the scope they are in, if you  exit that scope, that variable will be undefined.

 

On 1/27/2020 at 12:06 AM, Trenchcoat said:

_spawnMkr = "CIV_spawnMkr_#";

 

That might throw an error. Nevermind.

Share this post


Link to post
Share on other sites

Think I found what I was looking for with a random select in my location. I added the variable _id = _newSpn select 1; seems to have grabbed my mystery number that I couldn't seem to locate a command for (Ahh, the simple yet elusive). Now, for me to try to bypass the TODO error I catch on the respawn selection screen, for an unfinished built in script...  Hope when they get to it it doesn't require too much repair.  

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

×