Jump to content
gc8

Carrier height on onMapSingleClick

Recommended Posts

Hi

I'm using onMapSingleClick to teleport player for testing but I want it also to work when player clicks on position over carrier. How do I get the carrier height in this case?

 

thx!

Share this post


Link to post
Share on other sites
22 minutes ago, gc8 said:

Hi

I'm using onMapSingleClick to teleport player for testing but I want it also to work when player clicks on position over carrier. How do I get the carrier height in this case?

 

thx!

afaik the most reliable way for ships is to hardcode it.

Share this post


Link to post
Share on other sites
1 minute ago, sarogahtyp said:

afaik the most reliable way for ships is to hardcode it.

 

Then I have to determine if carrier was clicked...

 

Could probably use raycast but I thought there would be simpler methods

Share this post


Link to post
Share on other sites

if it has not to be much precise then u could use an area marker to detect the click on Carrier and define one or more teleport points on it and choose the nearest point for teleport.

Share this post


Link to post
Share on other sites

Sounds complicated.

 

I tried lineIntersectsSurfaces but it couldnt catch the carrier

 

Here's what I tried:

 

while { true } do
{

_ipos = getposASL player;

_spos = +_ipos;
_spos set[2,2500];
_epos = +_ipos;
_epos set[2,-2500];

_con = lineIntersectsSurfaces [_spos, _epos, player, objNull, true, 1, "VIEW", "FIRE", true];

if(count _con > 0) then
{

(_con select 0) params ["_intPos"];

//_intPos = ASLToATL _intPos;

 hintSilent format["--> %1",_intPos select 2];
 
}
else
{
 hintSilent "NO surf";
};
 
 sleep 0.1;
};

 

It just returns the terrain height...

Share this post


Link to post
Share on other sites

its easy trust me.

u just need to use inArea command to know if the player clicked your marker.

then u just sort an array of hardcoded teleport positions from closest to farthest and teleport to the first/closest of those positions.

i ll do an example later...

Share this post


Link to post
Share on other sites
3 minutes ago, sarogahtyp said:

i ll do an example later...

 

No need to make example for me thanks, because I could do it my self too. But I'm still thinking there has to be more direct approach of doing this...

Share this post


Link to post
Share on other sites

@gc8   Your code is returning 23 m which is the height of the main deck above the sea.

Share this post


Link to post
Share on other sites
7 minutes ago, pierremgi said:

@gc8   Your code is returning 23 m which is the height of the main deck above the sea.

 

Ok I know what the problem was. I had placed the carrier outside of the map bounds, so those commands didn't return proper results.

 

So it works, great. But what if I still want to keep the carrier outside map?

Share this post


Link to post
Share on other sites
8 minutes ago, pierremgi said:

Use the lineIntersectsObjs example 1

 

Wrote my own version of it but it doesn't return the carrier either when off the map

Share this post


Link to post
Share on other sites
11 minutes ago, killzone_kid said:

setVehiclePosition

 

Works, thanks 🙂

 

Share this post


Link to post
Share on other sites

Except it doesn't work with off map carriers either hmm...

Share this post


Link to post
Share on other sites

You're right the LOD fire ifire, view, geom  work on map but not out of map (black surface in editor). I checked with checkVisibility from eyePos player (on deck) to the sea level right below...

0 when carrier is on map, 1 out of map...

 

EDITED: and cursorObject returns the hull part when on map, objNull out of map.

Share this post


Link to post
Share on other sites

It's like pierremgi said. Have to keep those carriers within the map or nothing works

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

×