Simple Python Things

It is possible to add two thigs to heroes?

1 Add specific era requirements to build them (ex leonidas can only be build on ancient)
2 Auto die hero when that connected to hero era will end

Can you program it please?
 
More or less done, but I need a clarification first.
Do you want that a hero always lives the whole assigned era (so Leonidas through the whole ancient times; after being build, I mean), or do you want that the custom "life time" (in turns) can trigger the death earlier?
Both is doable, and both versions will not make much of a difference for me. I just have to know which version you want :).
 
The later of both sounds better than the earlier of both lol.
Imagine poor Leonidas built this turn, and died next turn because you advanced to next era :D
 
I actually did that for testing :D.
But if you think about it again, neither of the suggestions will prevent it. They might prolongue the life if you build the unit earlier, but will not prevent cutting the life span to at worst 0 turns.
 
Hmm didnt read the whole codes :D
I thought it will be something like:
Original) If Leonidas has been around for X turns, kill him
New) If player advanced to new era, kill Leonidas

So a AND combination will mean if new era and Leonidas has been around for X turns, kill him?
So even when I advance to Classical Era, at least poor Leonidas can still survive for another few turns if he was built in late Ancient Era? Sounds like terminal illness
 
Thanks a lot :)

Do it that way:

Example
Leonidas (buildable only in ancient era) will live entire ancient era and when era will change Leonidas will live another X turns. Sounds good to you?
 
mmhh...seems with this approach I cannot correctly re-calculate the life time of a unit after reloading a game, and it would then be set to the default number.
Does anyone think some additional X rounds of life for a certain strong unit would make a difference? Would sure not happen that often, I guess.
 
suggest just giving a random chance to die after the ancient era is over for example gets 33% to live. Random is fun and you don't have to store a abstract number of turns. If he lives a while it's great luck if not - tough luck. Easier to code as well as I think you can see.
 
I will say just stick to the original code you have used, which is X turns based on the turn the unit created, since you also know there is a python function to get that value directly.
Rather than the X turns after the Era has changed.
That way, there is no need to store any values

So just a simple if he has lived X turns AND Era has changed, or if he has lived X turns OR Era has changed will suffice.

Would be fun to gift a dying hero away just before he died :D
Random sounds ok as well
 
The problem is that "if he has lived X turns AND Era has changed" will in most cases cut the rest life time down to 0.
Okay, is probably not worse than extending it with every reloading minimally.

Random is also an option, but I'd rather have the fixed time still in, just in case that somebody really only wants to use a set time frame.
 
Just curious though, the initialising codes were all done in onGameStart only without onGameLoad, but the last time I tried for my own stuff, the values were all gone if I load a game.
 
The problem is that "if he has lived X turns AND Era has changed" will in most cases cut the rest life time down to 0.
Okay, is probably not worse than extending it with every reloading minimally.

Random is also an option, but I'd rather have the fixed time still in, just in case that somebody really only wants to use a set time frame.

If you want the fixed time I wouldn't see much difference to just set it to the era rather than an abstract/subjective era + x turns.
 
in order to store the turns a unit has left for use on reload, you should try using ScriptData() for the pUnit...
 
Just curious though, the initialising codes were all done in onGameStart only without onGameLoad, but the last time I tried for my own stuff, the values were all gone if I load a game.

Nope, the same initialization code also runs after onGameLoad.

If you want the fixed time I wouldn't see much difference to just set it to the era rather than an abstract/subjective era + x turns.

Yes, that's not the problem. Just don't want to have it random, because that might conflict with some people's intentions.

in order to store the turns a unit has left for use on reload, you should try using ScriptData() for the pUnit...

Originally I wanted to keep it simple (well...as simple as possible)...but that's also an option.
 
@The_j

I am a php coder so i only can explain how it can be done via php :p

Just make a cookie and write exact turn number when player enters to what era.
Then you can use that value to count x turns from that time

Something like cookie is posible via python?
 
Back
Top Bottom