Starting life

If you have a module that you'd like comments on or would like to know how to create your very own module, post here

Moderator: Moderator

Post Reply
Message
Author
Castler
Thalore
Posts: 153
Joined: Mon Mar 25, 2013 10:09 pm

Starting life

#1 Post 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.
Qi Daozei (QDZ) - an Oriental-themed fantasy game for T-Engine. ToME Tips - auto-generated spoilers for ToME.

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Starting life

#2 Post by darkgod »

In your actor init fucntion you can simply set self.life = self.max_life
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Castler
Thalore
Posts: 153
Joined: Mon Mar 25, 2013 10:09 pm

Re: Starting life

#3 Post 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.
Qi Daozei (QDZ) - an Oriental-themed fantasy game for T-Engine. ToME Tips - auto-generated spoilers for ToME.

Post Reply