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
FreddyCruger

Здоровье перса

Подскажите, как сделать так, чтобы у персонажей при респе было половину хп и 3/4 крови? То есть при первом заходе на сервер или после смерти, выдавались такие значения.

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts




  • 0
float max_Health = player.GetMaxHealth("GlobalHealth", "Health");
float max_Blood = player.GetMaxHealth("GlobalHealth", "Blood");
player.SetHealth("GlobalHealth", "Health", (max_Health / 2));
player.SetHealth("GlobalHealth", "Blood", (max_Blood * ( 3 / 4)));

прописать после выданного старт лута например

p.s. не тестировал

Share this post


Link to post
Share on other sites
  • 0
1 час назад, 123new сказал:

прописать после выданного старт лута

я так понимаю, что можно в ините это организовать?

боюсь могу напутать, это примерно так должно выглядеть?
 

override void StartingEquipSetup(PlayerBase player, bool clothesChosen)
    {
        EntityAI itemTop;
        EntityAI itemEnt;
        ItemBase itemBs;
        float rand;

        itemTop = player.FindAttachmentBySlotName("Body");

        if ( itemTop )
        {
            itemEnt = itemTop.GetInventory().CreateInInventory("Rag");
            if ( Class.CastTo(itemBs, itemEnt ) )
                itemBs.SetQuantity(4);

            SetRandomHealth(itemEnt);

            string chemlightArray[] = { "Chemlight_White", "Chemlight_Yellow", "Chemlight_Green", "Chemlight_Red" };
            int rndIndex = Math.RandomInt(0, 4);
            itemEnt = itemTop.GetInventory().CreateInInventory(chemlightArray[rndIndex]);
            SetRandomHealth(itemEnt);

            rand = Math.RandomFloatInclusive(0.0, 1.0);
            if ( rand < 0.35 )
                itemEnt = player.GetInventory().CreateInInventory("Apple");
            else if ( rand > 0.65 )
                itemEnt = player.GetInventory().CreateInInventory("Pear");
            else
                itemEnt = player.GetInventory().CreateInInventory("Plum");

            SetRandomHealth(itemEnt);
        }
        float max_Health = player.GetMaxHealth("GlobalHealth", "Health");
        float max_Blood = player.GetMaxHealth("GlobalHealth", "Blood");
        player.SetHealth("GlobalHealth", "Health", (max_Health / 2));
        player.SetHealth("GlobalHealth", "Blood", (max_Blood * ( 3 / 4)));
    }

 

Edited by FreddyCruger (see edit history)

Share this post


Link to post
Share on other sites
  • 0
50 минут назад, 123new сказал:

float max_Health = player.GetMaxHealth("GlobalHealth", "Health"); float max_Blood = player.GetMaxHealth("GlobalHealth", "Blood"); player.SetHealth("GlobalHealth", "Health", (max_Health / 2)); player.SetHealth("GlobalHealth", "Blood", (max_Blood * ( 3 / 4)));


float max_Health = player.GetMaxHealth("GlobalHealth", "Health");
float max_Blood = player.GetMaxHealth("GlobalHealth", "Blood");
player.SetHealth("GlobalHealth", "Health", (max_Health / 2));
player.SetHealth("GlobalHealth", "Blood", (max_Blood * ( 3 / 4)));

прописать после выданного старт лута например

p.s. не тестировал

эх, вроде работает только кровь, и то сразу смерть после респа. ХП не уменьшается

 

Share this post


Link to post
Share on other sites
  • 0

Попробуй player.SetHealth( "GlobalHealth", "Health", 50);

Share this post


Link to post
Share on other sites
  • 0
2 минуты назад, Yuki сказал:

Попробуй player.SetHealth( "GlobalHealth", "Health", 50);

а кровь как сделать, чтобы сразу не умирал, видимо 3 / 4, это слишком много, а с хп попробую отпишусь

 

Share this post


Link to post
Share on other sites
  • 0

О! Изменил на такое и вуяля заработало) 
 

player.SetHealth("GlobalHealth", "Health", (max_Health * 1 / 2));
player.SetHealth("GlobalHealth", "Blood", (max_Blood * ( 1 / 1)));

кровь не убавилась, но ХП половина, ща буду с кровью разбираться

Edited by FreddyCruger (see edit history)

Share this post


Link to post
Share on other sites
  • 0
float max_Health = player.GetMaxHealth("GlobalHealth", "Health");
        float max_Blood = player.GetMaxHealth("GlobalHealth", "Blood");
        player.SetHealth("GlobalHealth", "Health", (max_Health * 1 / 3));
        player.SetHealth("GlobalHealth", "Blood", (max_Blood *  1 / 2));

Идеально!

Edited by FreddyCruger (see edit history)

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.