Page 1 of 1

Starting life

Posted: Wed Jul 17, 2013 3:47 am
by Castler
I've noticed that creatures in my fledgling module are created with 100 life, presumably because engine.interface.ActorLife defaults max_life and life to 100 before the player's birth descriptors or NPCs' initialization code correctly set max_life.

I found that I can fix this by just adding an additional "life = " line to the birth descriptors and NPC definitions, and I saw where Startide uses a resolvers.life (presumably to fix this same problem), but is there a cleaner way of handling this? I couldn't see how ToME itself addresses it.

Re: Starting life

Posted: Wed Jul 17, 2013 5:53 pm
by darkgod
In your actor init fucntion you can simply set self.life = self.max_life

Re: Starting life

Posted: Fri Jul 19, 2013 1:49 am
by Castler
It looks like Actor's init is called before resolving and birth descriptors take place, so max_life doesn't yet have its final value.

I finally saw where ToME defines a resetToMax function that's called (indirectly) by resolveLevel, so I'm taking a similar approach.

Thanks.