Cuberite Forum
Mob limit - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Mob limit (/thread-218.html)

Pages: 1 2


Mob limit - rs2k - 11-10-2011

I think the world class should gain m_MobLimit, m_CurrentPlayers and m_CurrentMobs. If ( m_CurrentMobs * m_CurrentPlayers > m_MobLimit), then no more mobs can spawn. When a mob spawns add + 1 to m_CurrentMobs, when it is removed, remove one from it. Same thing with m_CurrentPlayers.

The mob rate should also be slower and a bit more random I think.

How does this sound?




RE: Mob limit - ThuGie - 11-10-2011

Yeah better perhaps they also should have there own m_Health.
So we can set how much health they have.


RE: Mob limit - FakeTruth - 11-10-2011

(11-10-2011, 04:42 PM)ThuGie Wrote: Yeah better perhaps they also should have there own m_Health.
So we can set how much health they have.

ALL pawns already have health, so you don't need to add anything.


RE: Mob limit - ThuGie - 11-10-2011

How do i go about setting them ?
Like chicken having 2 harts / 4 heatlh ?


RE: Mob limit - rs2k - 11-11-2011

(11-10-2011, 11:37 PM)ThuGie Wrote: How do i go about setting them ?
Like chicken having 2 harts / 4 heatlh ?

In cChicken.cpp:
Code:
cChicken::cChicken()
    : m_ChaseTime( 999999 )

{
    //LOG("SPAWNING A CHICKEN!!!!!!!!!!!!!!!!!!!!!");
    m_EMPersonality = PASSIVE;
    m_MobType = 93;
    m_Health = 4 //Hearts = m_Health / 2
GetMonsterConfig("Chicken");
}[/code]


RE: Mob limit - ThuGie - 11-11-2011

Hey,

Thanks i'm able to set health now really nice thanks alot.
Now to make it actually be able to drop multiple items.

Client just seems to crash not sure why.
Going to do some testing as the current code does actually allow multiple drops so its somewhere in my code.


RE: Mob limit - rs2k - 11-11-2011

I couldn't get the game to drop raw beef without crashing the client. Anything else I tried worked just fine. I don't know why and haven't looked into it at all. I moved on to another project and stopped working with drops.


RE: Mob limit - ThuGie - 11-11-2011

Ah i see Smile.
I do hope it get implented in the main project.
As i dont wanna have any conflict when i update or having to readd it everytime.

Edit:
Also why is this in the cMonster
Code:
    m_Health = 10;

    int RandVal = rand() % 4;
    if( RandVal == 0 )
        m_MobType = 90; // Pig
    else if( RandVal == 1 )
        m_MobType = 91; // Sheep
    else if( RandVal == 2 )
        m_MobType = 92; // Cow
    else
        m_MobType = 93; // Hen
Isnt m_mobtype defined by the monster class itself atm for me also m_Health isnt that better ?


RE: Mob limit - FakeTruth - 11-11-2011

Yes it is. The parent constructor is called before the child constructor, so the child can overwrite the m_MobType value. These values in cMonster are simply default values.


RE: Mob limit - ThuGie - 11-11-2011

Ah i see haha then couldnt mobtype be just 93 chicken or something instead random ?