Forum Jump :

Author Message


Posts: 29
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2009-10-03 19:05        
     
Hi. Apologies im sure the answer is here somewhere but after a fair bit of searching ive gotten no where.

I have an LHD that im using as a base. I have it set nice n snug next to a dock, I want a trigger to offer a teleport that will put you on the deck of the LHD. My problem is that I can teleport to the marker... but the marker is at ground level so i spawn in the ship rather than on it. There is no init line on a marker so i cant setpos and I cant use an object as far as I can see. So how do I get a teleport to land me 20 meters up?


Trigger / flag has - this addAction ["Teleport - Airfield","teleport.sqf",["Airfield"]];

Marker being called Airfield. (No real reason will edit this later)

*telport script.
// Get the destination.
_dest = (_this select 3) select 0;

// Get a random direction
_dir = random 359;

// Move the person 15 meters away from the destination (in the direction of _dir)
player SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir)];



I am very new to scripting .. but im trying to learn so any help welcome even just comments on what stuff to look up. :)


Author Message

W0lle  

call me evil


Posts: 1968
Rank:


Country: de
Location:
Occupation: CWR III Project Leader
Age: 104
In-game name:

 
#2 Posted at 2009-10-03 20:16        
     
// Get the destination.
_dest = (_this select 3) select 0;

// Get a random direction
_dir = random 359;

// Move the person 15 meters away from the destination (in the direction of _dir)
player SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir),+15];

Note the 3rd parameter I added to the last line, it defines the height of the setpos command (in this case 15 meters). Eventually you must adjust it up or down.


Advertisement


Author Message


Posts: 29
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2009-10-05 18:02        
     
Thanks for your reply will test this in a bit. :)


Author Message


Posts: 29
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name:

 
#4 Posted at 2009-10-07 22:35        
     
Tested this and it works lovely. One question .. is there a way to get this script to set the Azimut of the player on spawn. Right now it depends on which way the player is facing when he teleports. And id like to set it pointing away from the door he is supposed to emerge from.

Thanks alot for your help.

Andy