Jump to content

Season and spawning bird


Recommended Posts

Hello,

 

I want to make some news birds spawn in some season. But i don't find how to do it correctly.

 

I got my prefab for the news birds (working fine), and i got a morebirdspawner.lua, for the spawn of the news birds.

 

 

local BIRD_TYPES =
{
    --[GROUND.IMPASSABLE] = { "" },
    --[GROUND.ROAD] = {"crow"},
        [GROUND.ROCKY] = {"paradisebird", "huppebird"},
        [GROUND.DIRT] = {"paradisebird", "goldbird", "huppebird"},
        [GROUND.SAVANNA] = {"paradisebird", "huppebird"},
        [GROUND.GRASS] = { "goldbird", "patchbird"},
        [GROUND.FOREST] = {"paradisebird", "patchbird"},
        [GROUND.MARSH] = {"paradisebird", "goldbird"},
}

 

Here i can define bird for each tile.

 

 

local function PickBird(spawnpoint)
    local tile = _map:GetTileAtPoint(spawnpoint:Get())
    local bird = GetRandomItem(BIRD_TYPES[tile] or { "paradisebird" })
    return _worldstate.iswinter and bird == "goldbird" and "paradisebird" or bird
end

 

And, here, i suppose that it's the code where i could define which bird spawn in which season. But i can't find the right code to use.

I could keep the "_worldstate.iswinter" to replace one specie by another, but it's not what i want. I want one type to spawn in spring, two in summer, one in autumn, and so on.

 

But i obtain errors if i try to put "if" somewhere.

 

So maybe someone could help me to find a way to make it ?

 

Should i create somewhere a table to associate bird to season, like the one to associate bird and tile ? Could someone show me how to do this if it's the thing to do ? because it's exceed my skill.

 

Thank for the help.

 

morebirdspawner.lua

Edited by Lumina
Link to comment
Share on other sites

No, sorry if it's not clear. I use it because i can't find the proper way to do what i want.

 

What i want is define for each bird one season (or more) for spawning. Like :

 

Golden bird in summer

Paradise Bird in autumn

Huppe bird in spring and autumn

Patchbird in spring and summer

For example, maybe with some changes. (Or adding another bird to the list, latter)

 

I can't find how to do this. I should probably use "_worldstate.iswinter", "_worldstate.issummer", etc, but where ?

 

Link to comment
Share on other sites

 

attachicon.gif SeasonsAndBirds.zip

 

Here the bird part. I cleaned the rest, because it's still a work in progress and not related to this part.

Thanks for the help  :-)

 

 

Hello,

 

I am sorry I did not come back to you earlier, I was caught up in some other stuffs!

I found your issue. Could you tell me a bit what you want to do with your birds (under which conditions which birds should appear) so i can make some for you as an example and comment the piece of code so you can later expand it yourself?

Edited by ZupaleX
Link to comment
Share on other sites

No need to be sorry, i understand :)

 

Could you do something like :

 

Golden bird in summer

Paradise Bird in autumn

Huppe bird in spring and autumn

Patchbird when it rain

 

?

It would be a good example of how it work :)

I don't know if a "rain" condition is possible in this case (i know it exist, not if it will work here). If it's too problematic, a season condition would be fine :)

 

Thanks again. I appreciate your help :)

Link to comment
Share on other sites

No need to be sorry, i understand :-)

 

Could you do something like :

 

Golden bird in summer

Paradise Bird in autumn

Huppe bird in spring and autumn

Patchbird when it rain

 

?

It would be a good example of how it work :-)

I don't know if a "rain" condition is possible in this case (i know it exist, not if it will work here). If it's too problematic, a season condition would be fine :-)

 

Thanks again. I appreciate your help :-)

 

morebirds.lua

 

line 195

 

morebirdspawner.lua

 

lines 15-73

lines 148-174

 

Have fun.

 

If you have more question or something is not clear, please tell me

SeasonsAndBirds.zip

Link to comment
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
 Share

×
  • Create New...