Forum Jump :

Author Message

Rick  

One of Armaholic's finest ..... by presence....


Posts: 256
Rank:


Country: ca
Location: Alberta
Occupation: Sodbuster
Age: 26
In-game name: Rick

 
#1 Posted at 2015-02-15 04:28        
     
Hi guys. I have a teleport script that I'm using in a mission. I can successfully teleport when I call the script through a addaction like this:

this addAction ["Teleport - Airfield","scripts\teleport.sqf",["Airstrip"]]; 

However instead of the addaction, I want to include the teleport in the agm interact menu so I have the following:

teleport_base = [flag_farp, "Teleport to Base", 5, {true}, {execVM "scripts\teleport.sqf",["Airstrip"]}, true] call AGM_Interaction_fnc_addInteraction;

Then I teleport but I go to the corner of the map instead of the marker so I think it's not allowing me to name "Airstrip" when using the execVM command.

Here is the teleport.sqf:

// 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)];  

Added 17 minutes later:

I just made a separate script for each teleport destination and left out the arguments so it works now.

This post was edited by Rick (2015-02-15 04:48, 980 days ago)

I am very macho.

Author Message


Posts: 635
Rank:


Level: Member

Country: uk
Location: N.W.
Occupation:
Age: 29
In-game name: big_wilk

 
#2 Posted at 2015-02-15 08:21        
     
Really need to see the fn_addInteraction.sqf or some notes on it to help.


Advertisement


Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 20
In-game name: Wak

 
#3 Posted at 2015-02-15 12:53        
     
This should be your execVM to pass the marker as an argument:
{["Airstrip"] execVM "scripts\teleport.sqf"}
You're not actually passing it as an argument, so getMarkerPos returns [0,0,0] and you get teleported to there (left top).

Also noticed the _dest is not anything in teleport.sqf, because there is no _this select 3. The wiki doesn't say AGM passes anything in to the script so maybe that's what you're trying to use?
// Get the destination.
_dest = _this select 0;

// Get a random direction
_dir = floor random 360;

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


# big_wilk : Really need to see the fn_addInteraction.sqf or some notes on it to help.
big_wilk here is all the the interaction functions in the AGM wiki.

This post was edited by 654wak654 (2015-02-15 13:47, 980 days ago)

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage

Author Message

Rick  

One of Armaholic's finest ..... by presence....


Posts: 256
Rank:


Country: ca
Location: Alberta
Occupation: Sodbuster
Age: 26
In-game name: Rick

 
#4 Posted at 2015-02-15 16:14        
     
Ok, I passed the argument incorrectly then and that's probably why it wasn't working. Thanks for your help around here!

What I ended up doing was specifying the marker like _dir = "marker" and saving it as a seperate script for each teleport location; it's ok because there are only 2 but in the future I'll come back with correct argument usage.

I am very macho.