How to Resurrect Creature (bug?)

Chris H.'s Ultima / ACS-style game development system!

Moderators: Ice Cream Jonsey, joltcountry

Admiral Ackguh

How to Resurrect Creature (bug?)

Post by Admiral Ackguh »

Right now in one of my ACK-ventures, I have a Pac-Man like region, with four ghost monsters. When one of them dies, I would like to resurrect it in the middle of the map, after a short time (or step) delay.

I use the MAPADD 255 macro command, followed by MAPSETD to the proper creature instance number.

Problem: after resurrecting one of these creatures, ACK will sometimes duplicate them, or have them stack, and eventually lock up and crash.

I thought this might be caused by creating more than one creature with the same instance number. I added code that would (tediously) keep track of all four monsters, and (re) create a particular one only if already dead. But that doesn't help.

Perhaps this problem is caused by using MAPADD to create a dead creature (one with HP = 0) rather than one explicitly removed by MAPTAKE. This looks to be the most likely cause.

Maybe someone familiar with the source code could look into this issue?

rld
Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Post by rld »

Yeah, I think the main problem is that you are recreating a creature that has HP=0 and that ACK has internally marked as 'dead'. Even if you keep the same instance number, you are restoring a dead creature to the map which I'm sure will cause the ACK code difficulties since it wasn't expecting that creature to be there.

One interesting trick I found that might be useful to you: When a macro 'teleports' the player by setting LOC[X], LOC[Y], or the other location variables, ACK reloads the room that the player is in after the teleport. However, this reload will occur even if the player is still in the same room, for instance, if the macro executes

SET LOC[X]=LOC[X]-1

without otherwise changing the player's location. It will also occur if the macro writes to one of the location variables, even if the player's location doesn't actually change:

SET LOC[X]=LOC[X]

The reason that this is useful is that when the room is reloaded, any 'wandering monster' locations in the room are checked and you have a chance of new wandering monsters being generated.

This is very easy to try out; in an existing game, set one of the 'extra' commands in the config editor to run a macro that sets LOC[X]=LOC[X]. Then, in a room, place a 'wandering monster' with 100% odds of reappearing. When you go in that room, trigger the extra command; a new wandering monster will appear in that spot each time you trigger it, as long as there is not already a creature there.

(If you wanted, you could make a really nasty 'trap room' this way by placing several squares around the edge of the room that had 100% wandering creatures, and then having squares in the room (or a step macro that ran while the player was in the room) trigger a reload with LOC[X]=LOC[X]. As the player walked through the room, more and more creatures would spawn as the old ones stepped off the squares and headed for the player, and the player would be surrounded.)

But back to your issue. I think the way that you could do this would be to run a step macro in the room, and set a flag when one of the creatures was killed (using the creature's death macro). When this flag was set, the step macro would reload the room by setting LOC[X]=LOC[X]. In each of the four corners of the room, place a 'wandering monster' for each of the four monster types you want to recreate. Surround these monsters with opaque obstacles so they can't move and so the player can't see them. When a reload occurs, these monster squares will be 'replenished' with your creatures, if they are not already there.

Then, the step macro would resurrect them as follows. When the flag for one of the creatures is set, do a reload. X number of turns later, use MAPCHKD/MAPTAKE to get that creature's instance number (from the 'wandering monster' square) and remove the creature, then use MAPADD/MAPSETD to copy it to your desired destination. The instance number will be different each time, as new creatures are being created. You may want to have a different 'resurrection spot' for each creature in case the player manages to kill more than one at once with an area weapon.

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Post by Garth's Equipment Shop »

Neat idea. I'm goin to experiment with that too. Thanks for sharing your combined expertise and ingenuity with the few and the proud among the ACK community rld.

My idea for one possible use for something like this would be in a full size adventure in which there is a whole world to explore and many quests to go on but quests of varying degrees of difficulty but very specific level and skill requirements. Anyone who has played Runescape will know what I am referring to here. Like having to train your character's combat ability to a certain level in order to meet the requirements to begin a certain quest.

In Runescape there are many special areas that are ideally suited for training your character and different areas for different level characters to train. A typical area would be a cave or wilderness area in which a certain type, level and number of monsters respawn. You take your character there and kill monsters continuously until you level up to your satisfaction or until you meet the required level for the quest you have your eye on.

The 'room' as it is called in ACK, would have a specific number of monsters in it and would respawn them continuously just as fast as they are eliminated thereby creating the perfect training area. The difficulty of each training area would be balanced to certain level characters and the number of monsters that could spawn never go over a certain number so that the character, of the appropriate level, never gets too overwhelmed. When the training area gets too easy there would be other more difficult training areas to move on to for a greater challenge and higher xp rewards.

And it can also serve as a way to build wealth or obtain certain resources. For example in Runescape a favorite place for medium to high level fighters to go is the Hill Giant cave because they drop giant bones when they die and sometimes also drop other useful things like grimy herbs, runes, and various types of weaponry and armor.

The bones can be buried immediately to raise your prayer level which can open up access to more cleric-like prayer spells or the bones could be sold for a decent price at the grand exchange where most players do their trading.

The grimy herbs can be cleaned and used to make very useful potions using the herblore skill or can also be sold for profit. With a morter and pestel and some water filled vials in your inventory you could also train your herblore skill while your training your combat and prayer skills.

This is all Runescape I am referring to of course, but I see no reason something like this couldn't be done in a detailed ACK game world as well.

For all your Runescape players out there reading this [just a long shot here] you might spot me running past, banking, training, questing or teleporting here and there under the name of DrEnergico. Feel free to add me to your Runescape friends list and be sure to let me know your from here.
Which of you is interested in my fine wares?

Admiral Ackguh

Post by Admiral Ackguh »

I know I'm late in replying, but I had many other things such as paid work.

Thank you, rld, for your idea. I have implemented it in my game and it works. The particular region has dead spaces out of sight of the user, and I hid my wandering monster squares there, placing many of them so that no part of the region is more than 16 units away.

I have also come up with a step-macro-based tracking mechanism that replaces a dead ghost with a "floating eyes" terrain space, and that moves the eyes to the centre of the region, then later resurrects the ghost. (Just like good old Pac-Man)

This also used up eight macros, and five overloaded variables!

A.A.

Post Reply