Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
sonic

Телепорт в одну точку

Доброго времени суток. Хотелось бы реализовать идею телепорта из аномалии в одну единственную точку вместо рандомной.

Так выглядит код изначально(мод Namalsk Survival):

 

static vector GetRandomTeleportPosition(float x = 1636, float z = 15108, float radius = 5000)
    {                
        vector position;
        position[0] = Math.RandomInt(x - radius, x + radius);
        position[2] = Math.RandomInt(z - radius, z + radius);
        position[1] = GetGame().SurfaceY(position[0], position[2]) + 1;
        
        if (GetGame().SurfaceIsSea(position[0], position[2]) || GetGame().SurfaceIsPond(position[0], position[2])) {
            // try again
            Print("Landed in water, trying again");
            return GetRandomTeleportPosition(); 
        }
        
        array<Object> position_objects = {};
        array<CargoBase> position_cargos = {};
        GetGame().GetObjectsAtPosition(position, 3, position_objects, position_cargos);
        if (position_objects.Count() > 0) {
            // try again
            Print("Landed in object, trying again");
            return GetRandomTeleportPosition();
        }
        
        return position;
    }

 

Хотелось бы сделать так чтобы аномалия постоянно телепортировала в одну и ту же точку на карте(в нашем случае сюда: x = 1636  z = 15108), а не в рандомную с указанным радиусом.

Попробовал "методом тыка" - ничего толкового не вышло(знаний нет от слова "совсем") Изменял float radius = 5000, на float radius = 1, телепортирует в одну точку, но далеко не в ту что нужно.

Если кто-нибудь сможет помочь, буду очень благодарен.

Edited by 123new
вставка кода в обязательный тег для его вставки (see edit history)

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

тупо и банально

static vector GetRandomTeleportPosition(float x = 1636, float z = 15108, float radius = 5000)
{                
	vector position;
	position[1] = GetGame().SurfaceY(position[0], position[2]);
	
	return position;
}

 

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.