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
Sign in to follow this  
Impezdrat

Спавн существ

Есть скрипт на спавн мобов типа:

TStringArray WorkingZombieClasses()

    {
		return {

        "ZmbM_SoldierNormal",

        "ZmbM_PatrolNormal_Autumn",

        "ZmbM_PatrolNormal_Flat",

        "ZmbM_PatrolNormal_PautRev",

        "ZmbM_PatrolNormal_Summer",

        "ZmbM_usSoldier_normal_Desert",

        "ZmbM_usSoldier_normal_Woodland",

        "ZmbM_usSoldier_Heavy_Woodland",

        "ZmbM_usSoldier_Officer_Desert"

        };

    }
if (SpawnZombie)
				{
					vector base_pos = Spawn.GetPosition(), dynamic_pos;
        				for ( int inf = 0; inf < Infected_Count; inf++ ) 
						{
            				dynamic_pos = base_pos;
            				dynamic_pos[0] = dynamic_pos[0]+Math.RandomFloat(-20.0, 20.0);
            				dynamic_pos[2] = dynamic_pos[2]+Math.RandomFloat(-20.0, 20.0);
            				GetGame().CreateObject( WorkingZombieClasses().GetRandomElement(), dynamic_pos, false, true );
        				}
					
					
				}

 Вопрос как правильно прописать чтобы спавнилось определенное кол-во? (к примеру 1 - 5, 2 - 5, 3 - 2, 4 - 2)

Edited by Impezdrat (see edit history)

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
15.12.2024 в 17:11, Impezdrat сказал:

Infected_Count

этот параметр

Share this post


Link to post
Share on other sites



  • 0
17.12.2024 в 18:12, Archon7th сказал:

этот параметр

Эта переменная отвечает за общее кол-во, а меня все же интересует как прописать каждому мобу в первом блоке. Я пытался найти что-то похожее в ваниле, но пока  без успешно.

 

 

Share this post


Link to post
Share on other sites
  • 0
GetGame().CreateObject( ZmbM_usSoldier_Officer_Desert, dynamic_pos, false, true )

Я понимаю что могу прописать так каждого моба, в единственном числе. Но может есть способ сделать это в классе TStringArray?

Share this post


Link to post
Share on other sites
  • 0
TStringArray spawnList = {"ZmbM_usSoldier_Officer_Desert", "ZmbM_usSoldier_Officer_Desert", "ZmbM_usSoldier_Officer_Desert"};
foreach (string spawnType : spawnList )
{
	GetGame().CreateObject( spawnType, dynamic_pos + vector.RandomDir2D() * Math.RandomFloat(0,1), false, true )
}



vector.RandomDir2D() * Math.RandomFloat(0,1)
это что бы они хоть немного не были в одной точке, а-то кого-то может под текстуры вытолкнуть

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
Sign in to follow this  

×
×
  • 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.