Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
zafjr

Porting GhostHotel to a different location

Recommended Posts

I've run into a stumbling block. I'm trying to move Playerunknown's GhostHotel Mission (deathmatch) to a different location. The gametype is very fun as a relaxer after a long stressful op, but it could also use some more variety regarding scenery ;).

But i cant figure out the loot location system. Ghosthotel spawns random loot in preset locations (hundreds of them). The locations are stored in an array which looks like this: 

BRMini_Loot_Offsets = [
	[21893.1,21036.6,216.026],
	[21896.7,21040.4,216.024],
	[21889.9,21043.4,219.564],
	[21890,21040,219.564],
	[21888.4,21033.9,7.56719],
	[21883.7,21044.3,219.57],
	[21883.1,21041.4,219.571],
	[21883.8,21034.4,219.57],
	[21890.6,21043.3,216.063],
	etc....

The X and Y coordinates are exactly where loot would spawn, however, the Z coordinates seem to be waaaaaaay up in the air for some reason (and yet the loot spawns on ground level, some inside buildings, some on 2nd floor.). The xyz positions i can provide are normal (like [20278.2,8814.49,0.0610847]), not 200 meters up in the air. So im wondering why the Z coords are so high like that. 

 

This is the Loot spawn script he made:

//all loot objects attach to masterObject so their positioning is correct 100% of the time
_masterObject = "Sign_Sphere10cm_F" createVehicle [0,0,0];
_masterObject enableSimulationGlobal false;
_masterObject setdir 0;
_masterObject setposatl [0,0,0];

LOOT_OBJECTS = [];

 _offsetFix = 0.65;

_time = time;
{
	_obj = createVehicle ["groundWeaponHolder", [0,0,0], [], 0, "CAN_COLLIDE"];
	LOOT_OBJECTS set [count(LOOT_OBJECTS),_obj];
	_pos = _x;
	_z = _pos select 2;
	_z = _z + _offsetFix;
	_pos set[2,_z];
	_obj attachTo [_masterObject,_x]; //sets position
	detach _obj;
	for "_i" from 1 to (2 max floor(random(5))) do {
		_usedTypes = [];
		while{true} do {
			_loot = BRMini_Loot select floor(random(count(BRMini_Loot)));
			_lootName = _loot select 0;
			_lootType = _loot select 1;
			_lootChance = _loot select 2;
			_lootAmount = _loot select 3;
			if(_lootChance == 1) then {_lootChance = floor(random(2));} else { //50%
				if(_lootChance == 2) then {_lootChance = floor(random(4));} else { //25%
					if(_lootChance == 3) then {_lootChance = floor(random(8));}; //12.5%
				};
			};
			if(_lootChance == 0 && !(_lootType in _usedTypes)) exitWith {
				_usedTypes set [count(_usedTypes),_lootType];
				switch(_lootType) do {
					case 0: {_obj addMagazineCargoGlobal[_lootName,_lootAmount];};
					case 1: {
						_obj addWeaponCargoGlobal[_lootName,_lootAmount];
						_arr = getArray(configFile >> "cfgWeapons" >> _lootName >> "Magazines");
						_magType = _arr select floor(random(count(_arr)));
						_obj addMagazineCargoGlobal[_magType,3];
					};
					case 2: {_obj addItemCargoGlobal[_lootName,_lootAmount];};
					case 3: {_obj addBackpackCargoGlobal[_lootName,_lootAmount];};
				};
			};
		};
	};
} forEach BRMini_Loot_Offsets;

I cant see anywhere there why his Z coordinates have to be so high. I would like to know so i could apply it to new loot locations, and port this excellent fun mission to many different settings and maps.

 

 

Ghost Hotel Battle Royale - https://steamcommunity.com/sharedfiles/filedetails/?id=325919374

 

Share this post


Link to post
Share on other sites
2 hours ago, R3vo said:

Check out this page and make sure you are using the correct command to get/set the position of the hotel composition

 

https://community.bistudio.com/wiki/Position#PositionASL

 

Heya R3vo! Thanks. Through lots of trial, error, and comparison, i've found out that i can create location values that work by: Dropping an object(Sign_Sphere10cm_F), getting its position (i used getPosASL), and then adding 185.9717 to it's Z value. I end up with a location value thats similar to the originals and also works. (i still cant figure out why that much has to be added tho, but it works). So [20248,8797.17,41.3464] turns into [20248,8797.17,227.3181]

 

This is what i use to get the location values:

allSpheres = nearestObjects [helpersphere, ["Sign_Sphere10cm_F"], 2000];  
private _return = [];  
{  
  _return pushBack (getPosASL _x);  
  false  
} count allSpheres;  
hintSilent str(_return); 
copyToClipboard str _return;	

Then i paste it in notepad++.

 

oh btw: (ummm Dunno if you recognize me but i requested if you could add a "Log positions to clipboard" feature to 3den Enhanced, and you said "done" :D. Thank you, it will save a ton of time and would be so convenient. Im curious if it gets the position using the regular getPos or can it also getPosASL and getPosATL?)

 

Anyway, im gonna end up with hundreds of locations like:

[21826.5,20932.4,11.9957],
[21825.3,20929.5,11.5914],
[21823.9,20926.5,11.1781],
[21822.5,20923.3,10.7678]

 

And i will have to add 185.9717 to the Z value.

Is there a way i can automate this? I read the notepad++ cant really do automated math operations like that. 

 

 

Share this post


Link to post
Share on other sites

Not sure if this is the most ideal solution but, could you just alter all the positions before you use them (in the script):

_array = [
	[21826.5,20932.4,11.9957],
	[21825.3,20929.5,11.5914],
	[21823.9,20926.5,11.1781],
	[21822.5,20923.3,10.7678]
];

_array = _array apply {_x vectorAdd [0,0, 185.9717]};

 

Share this post


Link to post
Share on other sites
8 hours ago, zafjr said:

 

oh btw: (ummm Dunno if you recognize me but i requested if you could add a "Log positions to clipboard" feature to 3den Enhanced, and you said "done" :D. Thank you, it will save a ton of time and would be so convenient. Im curious if it gets the position using the regular getPos or can it also getPosASL and getPosATL?)

 

 

It logs the ASL position of the object. Retrieving different kinds of positions would break the syntax so that it can directly be copied into a script or similar and in most cases ATL is used anyway.

Share this post


Link to post
Share on other sites

@HallyG Thanks man.

 

@R3vo Thank you very much for that new 3den feature ;)

 

I've gotten this working now on my server. There are now 3 NEW locations to choose from, for variety :) . So now thats Ghost Hotel, Panagia, and Syrta. At the starting position any player can manually set where they want the next round to take place in or have it random every round :D. However, it requires ACE currently, and the only reason is for its Spectate function (which any player can access from the starting position, its in their actions).

 

The reason im using ACE is because its spectate function can be called and then escaped from (by pressing escape). With the default Bohemia spectate, i cant find a away to get away from it if you call it as an "alive" player (not dead). Pressing escape doesnt work, and theres no option manually for any player to get out from it. I tried binding ["Terminate"] call BIS_fnc_EGSpectator; to a key, but it seems that while in spectator mode, NONE of the display idd's work, so keydown doesnt work. If anyone can help me figure out a vanilla solution for spectating id be very greatful:

 

- Has to be accessible while the player is alive.

- I can call it from an addaction with this: ["Initialize", [player, [], true, true, true, true, true, true, true, true]] call BIS_fnc_EGSpectator; But the player cant get away from spectate mode by his/herself.

 

For now im sticking with ACE Spectate though. Currently making a Takistan version ;). Playerunknown made a very fun little gamemode with this, and id be sad if it didnt get expanded.

Share this post


Link to post
Share on other sites

×