Jump to content
DieselJC

Spawn or Teleportto New Carrier?

Recommended Posts

Having issues when I try and teleport or spawn on the new USS Freedom carrier..I always end up in the water..no matter where I put the flag. Anyone else have this issue?

 

 

 

Diesel

Share this post


Link to post
Share on other sites

To teleport , u can set the height or use object

Sent from my SM-G925T using Tapatalk

Share this post


Link to post
Share on other sites
4 hours ago, claws01 said:

To teleport , u can set the height or use object

Sent from my SM-G925T using Tapatalk
 

I have an object down that is "Carrier" then this in the init.sqf. from the flagpole at base.

 

_id3 = myPole addaction [
    "<t color=""#F70525"">" +"Teleport To Carrier",
    {
        (_this select 1) setPos getPos Carrier; 
        (_this select 1) moveInCargo Carrier;
    },
    nil,
    1,
    false,
    true,
    "",
    "alive Carrier && {speed Carrier < 1}" //condition - if the Carrier is alive and isn't moving. 
];

 

Where would I set the height to spawn as?

 

 

Diesel

Share this post


Link to post
Share on other sites

How would the carrier be moving? Can it be destroyed at all? And it doesn't have Cargo.

 

Your problem is that the position of an object is always the middle of an Object.

You have to adjust the Height of. As I don't have the correct height, I will use 20m

 

(_this select 1) setPos [getPos Carrier select 0,getPos Carrier select 1, getPos Carrier select 2, + 20 ]; 

This should be the 20m above the middle of the object. You might have to adjust the height, as it is just a number I picked.

Again, if the Carrier is the USS Freedom , you can remove the speed limitation, the moveinCargo (and if I'm not mistaken) the check if it is alive, as neither of those things work.

Share this post


Link to post
Share on other sites
14 minutes ago, crewt said:

How would the carrier be moving? Can it be destroyed at all? And it doesn't have Cargo.

 

Your problem is that the position of an object is always the middle of an Object.

You have to adjust the Height of. As I don't have the correct height, I will use 20m

 


(_this select 1) setPos [getPos Carrier select 0,getPos Carrier select 1, getPos Carrier select 2, + 20 ]; 

This should be the 20m above the middle of the object. You might have to adjust the height, as it is just a number I picked.

Again, if the Carrier is the USS Freedom , you can remove the speed limitation, the moveinCargo (and if I'm not mistaken) the check if it is alive, as neither of those things work.

Thanks..I'll give that a try..I used the same thing I used for my MHQ's so that's why it is set up like that..but yeah what your saying makes sense about height and moving.I appreciate the reply I'll give that a go later.

 

 

Diesel

Share this post


Link to post
Share on other sites

You'd need to translate the respawn world position into model position.

Name the Freedom Carrier to test and try this:


output = [];

removeallactions player;
player addAction ["Test Spawn position",{_rndSpawn = selectRandom output;_rndspawn params ["_dir","_pos"];player setdir _dir;player setposasl _pos}];

player addAction ["Capture SpawnPos AND direction",{

_getspawndir = direction player;
_spawnpos = agltoasl (test modelToWorld (test worldtomodel (asltoagl (getposAsl player))));
output pushback [_getspawndir,_spawnpos];
Systemchat format ["Captured position %1 relative to %2, direction %3!",_spawnpos,typeof test,_getspawndir];
}];
player addAction ["Copy Waypoints to Clipboard",{copyToClipboard str output}];
player addAction ["!!!Reset Spawn positions!!!",{output = []}];

Just paste this into the debug console and walk around on the carrier.

  1. Find a position you want to add as a respawn position, adjust your direction because that will be captured as well.
  2. Now use the 'Capture SpawnPos AND direction' action.
  3. Repeat this for as many respawn positions you like.
  4. You can test the added respawn positions using the 'Test Spawn position' action.
  5. When you're finished use the 'Copy Waypoints to Clipboard' action.
  6. Then paste the clipboard content into your respawn script or eventhandler.

To pick a random respawn use this:

_positions = youroutput from clipboard here;
_rndSpawn = selectRandom _positions;
_rndspawn params ["_dir","_pos"];
player setdir _dir;
player setposasl _pos

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

To spawn/teleport to the deck of the carrier, I use setVehiclePosition command.

 

Quote

If position is in water and vehicle can float, it is placed on water surface, otherwise it is placed on the ground, even if ground is under water. If roof surfaces support walking (ie. Carrier Deck), units will be placed on roofs if such position is given.

 

Command:

vehicle player setVehiclePosition [<carrier_pos>,[],0,"None"];

 

Tested and approved with MapClick ;) Try it in mission and regardless of the elevation, if you click anywhere on the carrier, you will be on its deck at that location.

OnMapSingleClick "vehicle player setVehiclePosition [[_pos select 0, _pos select 1, 0],[],0,""None""]";

 

  • Like 1

Share this post


Link to post
Share on other sites

This is how I'm doing it.
It will teleport you to the small platform at end of carrier.
This will keep you from getting run over by any traffic on main carrier deck, will work on any map and does not matter what direction the carrier is situated.

Eden editor placed USS Freedom in this case is named Carrier.

JIG_transfer_fnc = {
	_dest = (_this select 3) select 0;
	_dir = random 359;

	titleText ["", "BLACK OUT"];
	switch (typeName _dest) do {
		case "ARRAY" : {player setPos [(_dest select 0)-2*sin(_dir),(_dest select 1)-2*cos(_dir),_dest select 2];};
		case "OBJECT" : {player setPos [(getPosATL _dest select 0)-10*sin(_dir),(getPosATL _dest select 1)-10*cos(_dir)];};
		case "STRING" : {player setPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir)];};
	};
	titleText ["", "BLACK IN",2];
	true
};

if (!isNil "Carrier") then {
	private _carrierPos = Carrier getRelPos [181, 349];
	INS_flag addAction["<t size='1.5' shadow='2' color='#12F905'>USS_Freedom</t>", "call JIG_transfer_fnc", [[(_carrierPos select 0),(_carrierPos select 1),19.2468]], 3.5];
};

 

  • Like 1

Share this post


Link to post
Share on other sites
20 hours ago, Jigsor said:

This is how I'm doing it.
It will teleport you to the small platform at end of carrier.
This will keep you from getting run over by any traffic on main carrier deck, will work on any map and does not matter what direction the carrier is situated.

Eden editor placed USS Freedom in this case is named Carrier.


JIG_transfer_fnc = {
	_dest = (_this select 3) select 0;
	_dir = random 359;

	titleText ["", "BLACK OUT"];
	switch (typeName _dest) do {
		case "ARRAY" : {player setPos [(_dest select 0)-2*sin(_dir),(_dest select 1)-2*cos(_dir),_dest select 2];};
		case "OBJECT" : {player setPos [(getPosATL _dest select 0)-10*sin(_dir),(getPosATL _dest select 1)-10*cos(_dir)];};
		case "STRING" : {player setPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir)];};
	};
	titleText ["", "BLACK IN",2];
	true
};

if (!isNil "Carrier") then {
	private _carrierPos = Carrier getRelPos [181, 349];
	INS_flag addAction["<t size='1.5' shadow='2' color='#12F905'>USS_Freedom</t>", "call JIG_transfer_fnc", [[(_carrierPos select 0),(_carrierPos select 1),19.2468]], 3.5];
};

 

If I am going to use this in one of your missions..I used the Zargabad mission and ported it to Everon..where would I add that in so I could have the carrier out on the sea.

 

 

Diesel

Share this post


Link to post
Share on other sites

The action goes in init_player.sqf. The function is an update in client_fncs.sqf

Share this post


Link to post
Share on other sites
5 hours ago, Jigsor said:

The action goes in init_player.sqf. The function is an update in client_fncs.sqf

Thanks for the reply Jigsor..works great..would it be possible to implement this into a different mission?

I see where to use the action by making an init_player.sqf but what would I do for the client_fncs.sqf

I tried making one with just the function in it and placed it in the mission folder but I couldnt get it to work,I assume I have to call it from somewhere like the init.sqf maybe?

 

Diesel

Share this post


Link to post
Share on other sites

There are a number of ways to plug it into your mission but without knowledge of your mission layout I suppose the most simple is to put it all in initPlayerLocal.sqf.

Share this post


Link to post
Share on other sites
On ‎2017‎년 ‎5‎월 ‎21‎일 at 6:33 PM, Grumpy Old Man said:

You'd need to translate the respawn world position into model position.

Name the Freedom Carrier to test and try:

 

Grumpy,

How do I know my x,y,z position value from object's center? I want to know the position relative between object(carrier)'s center and me.

Share this post


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

 

Grumpy,

How do I know my x,y,z position value from object's center? I want to know the position relative between object(carrier)'s center and me.

All in the snippet I posted.

 

Cheers

Share this post


Link to post
Share on other sites
50 minutes ago, Grumpy Old Man said:

All in the snippet I posted.

 

Cheers

 

Is it right?
_spawnpos = test worldtomodel (asltoagl (getposAsl player));
 

Share this post


Link to post
Share on other sites
9 minutes ago, magicsrp said:

 

Is it right?
_spawnpos = test worldtomodel (asltoagl (getposAsl player));
 

That's not in the snippet I posted.

 

Cheers

Share this post


Link to post
Share on other sites
16 hours ago, Jigsor said:

There are a number of ways to plug it into your mission but without knowledge of your mission layout I suppose the most simple is to put it all in initPlayerLocal.sqf.

Thanks Jigsor..worked perfectly with both your BMR Mission and on a couple others I am running like Hearts and Minds and Battlezone and Liberation..much appreciated!

 

Diesel

Share this post


Link to post
Share on other sites
On 5/21/2017 at 4:33 AM, Grumpy Old Man said:

You'd need to translate the respawn world position into model position.

Name the Freedom Carrier to test and try this:



output = [];

removeallactions player;
player addAction ["Test Spawn position",{_rndSpawn = selectRandom output;_rndspawn params ["_dir","_pos"];player setdir _dir;player setposasl _pos}];

player addAction ["Capture SpawnPos AND direction",{

_getspawndir = direction player;
_spawnpos = agltoasl (test modelToWorld (test worldtomodel (asltoagl (getposAsl player))));
output pushback [_getspawndir,_spawnpos];
Systemchat format ["Captured position %1 relative to %2, direction %3!",_spawnpos,typeof test,_getspawndir];
}];
player addAction ["Copy Waypoints to Clipboard",{copyToClipboard str output}];
player addAction ["!!!Reset Spawn positions!!!",{output = []}];

Just paste this into the debug console and walk around on the carrier.

  1. Find a position you want to add as a respawn position, adjust your direction because that will be captured as well.
  2. Now use the 'Capture SpawnPos AND direction' action.
  3. Repeat this for as many respawn positions you like.
  4. You can test the added respawn positions using the 'Test Spawn position' action.
  5. When you're finished use the 'Copy Waypoints to Clipboard' action.
  6. Then paste the clipboard content into your respawn script or eventhandler.

To pick a random respawn use this:


_positions = youroutput from clipboard here;
_rndSpawn = selectRandom _positions;
_rndspawn params ["_dir","_pos"];
player setdir _dir;
player setposasl _pos

 

Cheers

Ive never used an actual respawn script before I always just used the marker,is there a basic script someplace I can just input my position into?

I have this as my respawn position after using what you posted.  [[4.28521,[14348,5896.76,24.8952]]] so my question is exactly how and where would I input that postion? Thanks for the reply..much appreciated.

 

Diesel

Share this post


Link to post
Share on other sites

idk if u still having that issue but this is my mission file u can download and everything is in there \

https://1drv.ms/f/s!Ali3CqUW9fqq-zdfoET-GtbbD7-G

so the mission come with

- vehicle re spawn back on the uss99

- using bis to spawn player and revive etc

- i have two flag on the carrier 1 main deck and one below for the both boat hq

- so to add more re spawn point u just need to copy one of the atc inside the the main folder mission and create new then call it from the flag same as i did

u need to create one for each flag because u need height because during storm the boat keep switching height.

in game

i like to do one way back meaning

u create a flag and name it "hq1"  without the quote ----------------------- create another flag and put where u want end up and name to "hq2" without the quote then

 

put this in hq1 init

this addAction ["<t color='#3355ff'>Teleport Main Dock</t>","teleport.sqf",[hq1]];

 

put this in hq2 init

this addAction ["<t color='#3355ff'>Teleport Main HG</t>","teleport.sqf",[hq1]];

 

 

now u need  create  teleport.sqf and put inside your mission folder

_dest = (_this select 3) select 0;
player SetPos [(getPos _dest select 0),(getPos _dest select 1), 2];

the 2 u see at the end of the line  = the height so just adjust that value to your spawn position

u have everything inside my mission and feel feel to take everything u need in it

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, DieselJC said:

Ive never used an actual respawn script before I always just used the marker,is there a basic script someplace I can just input my position into?

I have this as my respawn position after using what you posted.  [[4.28521,[14348,5896.76,24.8952]]] so my question is exactly how and where would I input that postion? Thanks for the reply..much appreciated.

 

Diesel

 

Well you don't actually need an entire "sript" for that.

Taking my example you could grab some positions into an array like you did, put it in a file (init.sqf or wherever) like this:

MyRespawnArray = [[4.28521,[14348,5896.76,24.8952]]];

Now everytime you want a player to respawn at one of the grabbed positions just put this into onPlayerRespawn.sqf (filename must match and be in mission root):

params ["_respawnedUnit"];
_rndSpawn = selectRandom MyRespawnArray;
_rndspawn params ["_dir","_pos"];
_respawnedUnit setdir _dir;
_respawnedUnit setposasl _pos;
true

That's about it.

Won't get any more comfortable, heh.

 

Cheers

  • Like 2

Share this post


Link to post
Share on other sites

Jigsor  script works great for the freedom but how could I change or modify the script to teleport onto the CUP LSD or Nimitz carriers. I an not sure how to find a location on the deck or how to add it to the codelines that work for the freedom. Any help with be great on this.

Share this post


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

Jigsor  script works great for the freedom but how could I change or modify the script to teleport onto the CUP LSD or Nimitz carriers. I an not sure how to find a location on the deck or how to add it to the codelines that work for the freedom. Any help with be great on this.

Did you try my approach?

Won't get easier than that.

 

Cheers

Share this post


Link to post
Share on other sites

@Grumpy old man I fully don't understand how to get a location on the LSD and to put that information into jigsor script to allow me to teleport on to the deck of the cup LSD. Help would be greatly appreciated Avibird

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

×