Monster-Generating Eggs

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
Andrea B Previtera

Monster-Generating Eggs

Post by Andrea B Previtera »

Another coder's corner question : )
How do exactly the eggs that generates monsters (and, in general, eggs which trigger a certain event once they are on screen)?

For example, if I trigger the event as the egg gets on screen, and thereafter I disable that egg, there's the chance that by walking all around it, I could trigger it lots of times. For example, if it's an egg that generates a bunch of sheeps, by walking around it, it could generate more and more sheeps before the previously generated ones are deallocated because of their distance from the party.

Maybe you keep a list of the triggered eggs, and re-enable them only when you get *very* far from the original egg position?
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: Monster-Generating Eggs

Post by Wizardry Dragon »

My quick fix:
Put "auto-reset" and the distance to a respectable factor. Make sure that it's a "Party Near" egg and not an "Avatar footpad" egg :)

~ Wizardry Dragon
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Andrea B Previtera

Re: Monster-Generating Eggs

Post by Andrea B Previtera »

Heh, no no I am not working with exultstudio. It's a from-scratch project. So I am talking of real code here :)
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: Monster-Generating Eggs

Post by Wizardry Dragon »

They're egg props, it's just a lot easier to set them from ExultStudio.

~ Wizardry Dragon
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
wjp
Site Admin
Posts: 1708
Joined: Thu May 14, 2020 1:34 pm

Re: Monster-Generating Eggs

Post by wjp »

In U8, a monster egg has a 'hatched' flag. If you trigger the egg, it gets set. Then, when you get far enough away, it gets cleared again.
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: Monster-Generating Eggs

Post by Wizardry Dragon »

That's auto-reset, it's a default (I believe). You set how far away you have to go before it resets with the "distance" property.

~ Wizardry Dragon
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
drcode
Site Admin
Posts: 2267
Joined: Thu May 14, 2020 1:34 pm

Re: Monster-Generating Eggs

Post by drcode »

They also work that way (as wjp described) in U7. Also, the distance where the egg gets reset is also the distance where monsters created by the egg also disappear (they're 'cached out' in the term Ryan used when he implemented this).
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: Monster-Generating Eggs

Post by Wizardry Dragon »

I believe I heard that the monster persists if you use the once-only flag, but I am unsure as I havent tested it myself.

~ Wizardry Dragon
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Andrea B Previtera

Re: Monster-Generating Eggs

Post by Andrea B Previtera »

It's all a matter of distances, then. One must be careful that the egg scatters monsters a bit far away too. At least *a screen* away, to be sure that they will be created offscreen, preventing the "appearing from nothing" effect.

That, obviously, only for monsters and other visual things. Music, weather, they can just be triggered.
Wizardry Dragon
Posts: 1241
Joined: Thu May 14, 2020 1:34 pm

Re: Monster-Generating Eggs

Post by Wizardry Dragon »

Yeah, although I wouldnt want music for a town when I'm still miles away from it :)

~ Wizardry Dragon
Cheers, Wizardry Dragon
Lead Designer, Ultima VII: The Feudal Lands
www.thefeudallands.ca
Locked