Jump to content
Sign in to follow this  
slenderboy

Bar at bottom of the screen when calling BIS_fnc_removespawnposition

Recommended Posts

Hello.

Been trying out the new respawn selection screen. I can add spawn points fine but can't remove them.

when executing this code I get a bar at the bottom of the screen containing "[bIS_fnc_removeRespawnPosition] #0;"

respawnWest1 call BIS_fnc_removeRespawnPosition;
respawnWest2 call BIS_fnc_removeRespawnPosition;
respawnEast1 call BIS_fnc_removeRespawnPosition;

http://iforce.co.nz/i/gke4uw3g.pf2.png (1692 kB)

What is the bar and any idea why the points are not being removed?

Share this post


Link to post
Share on other sites

What is respawnWest1 etc ? are they the return array from adding the positions?

Looking at the remove in the functions viewer its expecting to passed an array of

Description:
Remove a respawn point

Parameter(s):
	0:
		NAMESPACE
		SIDE
		GROUP
		OBJECT
	1: NUMBER - id
(both parameters were returned by BIS_fnc_addRespawnPosition)

As it says here the return from adding the respawn point will give you the correct information to pass in to remove it. eg.

respawn1_ID = [WEST, "respawn1"] call BIS_fnc_addRespawnPosition;
respawn1_ID call BIS_fnc_removeRespawnPosition

Thsi maybe what you are already doing but from your code above i can not tell. Hope this helps

Share this post


Link to post
Share on other sites

Exactly what is happening at the moment. respawnWest1 etc are the arrays returned from addRespawnPosition. I seem to doing everything correct but it doesn't work... Will do some testing and see if it is a problem with the BIS function or something I have done. Cheers anyway.

Share this post


Link to post
Share on other sites

I'm afraid I'm unable to reproduce the bug without knowing the code you're using to add the respawn positions. Coul you please post it here?

Share this post


Link to post
Share on other sites

Sure thing. This is being created in a multiplayer environment on the DEV build.

respawnWest1 = [west, "respawn_marker_west_5"] spawn BIS_fnc_addRespawnPosition;
respawnWest2 = [west, "respawn_marker_west_6"] spawn BIS_fnc_addRespawnPosition;
respawnEast1 = [east, "respawn_marker_east_7"] spawn BIS_fnc_addRespawnPosition;

This is in the init.sqf file.

Another file is called by a trigger (radio.sqf) (trigger tested working correctly) which has this

respawnWest3 = [west, "respawn_marker_west_1"] spawn BIS_fnc_addRespawnPosition;
respawnEast2 = [east, "respawn_marker_east_1"] spawn BIS_fnc_addRespawnPosition;
respawnEast3 = [east, "respawn_marker_east_6"] spawn BIS_fnc_addRespawnPosition;

respawnWest1 call BIS_fnc_removeRespawnPosition;
respawnWest2 call BIS_fnc_removeRespawnPosition;
respawnEast1 call BIS_fnc_removeRespawnPosition;

The intent is to move the current spawn points to more forward ones as the mission progresses. I do this a few times throughout the mission with different scripts. I can post them too but it's more of the same.

All spawn new spawn points are created but old ones are not removed.

I get 100% same results from this too.

respawnWest1 = [west, "respawn_marker_west_5"] spawn BIS_fnc_addRespawnPosition;

respawnWest1 call BIS_fnc_removeRespawnPosition;

So as far as I can tell if that works for you then the problem is with me. I am running no mods though.

If you need anything else just give me a yell.

Cheers.

PS. Awesome work on the all the respawn. Your guide in the sticky thread was very helpful too. I would recommend that is done on other sections of scripting :D

Edited by slenderboy

Share this post


Link to post
Share on other sites

Something does not work right here.

Make a new mission, add you (player) a vehicle named car1 and a marker named mrk1.

Preview and bring up the debug console, on the watchlines add

missionnamespace getvariable ["BIS_fnc_getRespawnPositions_listwest",[]]

spawnspot1

spawnspot2

spawnspot3

Then in the exec box type :-

spawnspot1 = [west,player] call bis_fnc_addrespawnposition;

spawnspot2 = [west,car1] call bis_fnc_addrespawnposition;

spawnspot3 = [west,"mrk1"] call bis_fnc_addrespawnposition;

You will see the spawnspots have their right values and that the missionnamespace variable is filled in.

Now remove one using :-

spawnspot2 call bis_fnc_removerespawnposition;

spawnspot2's position is now a blank string in the missionspace variable, this seems ok. Now try to remove another one e.g

spawnspot1 call bis_fnc_removerespawnposition;

it wont work no matter what spot you choose the variable does not update.

_______________________________________________________________

@Moricky

As addRespawnPosition is used to remove them by inserting an empty string at the index

this

if !(_position in _positions) then {_positions set [_positionID,_position];};

fails once there is already a removed index.

Edited by Larrow

Share this post


Link to post
Share on other sites

Thanks for finding the issue, should be fixed in today's dev branch.

Share this post


Link to post
Share on other sites

Well how about that. Good work, can finish my mission now thanks.

Share this post


Link to post
Share on other sites

I am having no luck still sorry Moricky. I have no change.

Share this post


Link to post
Share on other sites

As i dont use the DEV build i got slenderboy to post me the changed BIS_fnc_addRespawnPosition

@Moricky

Sorry but this just does not work and i am surprised no one else is posting problems since the update.

private ["_targetOrig","_target","_position","_varName","_positions"];

_targetOrig = [_this,0,missionnamespace,[missionnamespace,sideunknown,grpnull,objnull]] call bis_fnc_param;
_position = [_this,1,"",["",objnull,[]]] call bis_fnc_param;
_positionID = [_this,2,-1,[0]] call bis_fnc_param;

_varName = "BIS_fnc_getRespawnPositions_list";
_target = _targetOrig;

switch (typename _target) do {

case (typename missionnamespace);
case (typename sideunknown): {
	if (typename _target == typename sideunknown) then {_varName = _varName + str _target; _target = missionnamespace;};
	_positions = _target getvariable [_varName,[]];
	if (_positionID < 0) then {_positionID = count _positions;};
	if (!(_position in _positions) || _position == "") then {_positions set [_positionID,_position];};
	_target setvariable [_varName,_positions];
	publicvariable _varName;
};
case (typename grpnull);
case (typename objnull): {
	_positions = _target getvariable [_varName,[]];
	if (_positionID < 0) then {_positionID = count _positions;};
	if (!(_position in _positions) || _position == "") then {_positions set [_positionID,_position];};
	_target setvariable [_varName,_positions,true];
};

Anyone adding spawn positions based on objects/arrays will get errors from this as it will compare an OBJECT/ARRAY to ""

___________________________________________________________

@slenderboy

Although the fix should actually work for you from what you have shown in this thread as you are only using markers (strings)?

Anyway HERE is a link to a test mission in both PBO and extracted format.

I have made two functions one being fnc_addRespawnPosition which is a copy of the old BIS_fnc_addRespawnPosition (for anyone that needs a quick fix for object/arrays as respawn points) and fnc_removeRespawnPosition that should take care of positions not being removed correctly.

Try the test mission, at the start you should be able to respawn at your starting location and the apc in front of you.

Drive the apc up the runway to the arrow and respawn again and you should have two new respawn points , one in between the runways and one in the other apc on the runway opposite the arrow and the original two will have been removed.

Share this post


Link to post
Share on other sites

Interesting. Have you tried this? (You haven't because you can't in hind sight)

respawnPoint = [west,"marker"] call BIS_fnc_addRespawnPosition;
respawnPoint call BIS_fnc_removeRespawnPosition;

Because this results in the same error as at the start of the thread for me and I would see that as the simplest test possible.

Anyway I will try out the functions you have provided. Can I add them to my mission and then distribute? Credit will be provided (for functions and the help).

Cheers.

Share this post


Link to post
Share on other sites
Interesting. Have you tried this? (You haven't because you can't in hind sight)

respawnPoint = [west,"marker"] call BIS_fnc_addRespawnPosition;
respawnPoint call BIS_fnc_removeRespawnPosition;

Because this results in the same error as at the start of the thread for me and I would see that as the simplest test possible.

Anyway I will try out the functions you have provided. Can I add them to my mission and then distribute? Credit will be provided (for functions and the help).

Cheers.

Yes ive tried that before i posted that in my first post, I have also retried it with the current function you posted to me from the Dev build update, but i did not and do not get the error you show in your picture. Maybe this is something else todo with using the DEV build as i do not use it, or is related to some other conflict in your mission.

Everything else discussed here is because of the error that spawn locations were not being deleted from the list.

As per the PM if you would like to send me your mission i am quite happy to have a look at it for you to see if i get the same result or can see where the error is coming from.

Share this post


Link to post
Share on other sites

As a follow up. I am pretty silly and should have seen what I was doing before hand.

respawnWest1 = [west, "respawn_marker_west_5"] spawn BIS_fnc_addRespawnPosition;
respawnWest1 call BIS_fnc_removerespawnPosition

Is different to,

respawnWest1 = [west, "respawn_marker_west_5"] call BIS_fnc_addRespawnPosition;
respawnWest1 call BIS_fnc_removerespawnPosition

I was using spawn. Why? Have no idea. When I wrote code on the forum here I wrote it, not copy/pasted so it didn't get transferred over. When using markers and calling rather than spawning everything works fine and dandy.

Cheers everyone one for the help. Will continue testing all the respawn functions and settings.

Share this post


Link to post
Share on other sites

Well spawn only returns the script handle for the spawned script so no wonder things went out of control.

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
Sign in to follow this  

×