Map editing commands?

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

Moderators: Ice Cream Jonsey, joltcountry

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

Map editing commands?

Post by rld »

Just a few technical questions on the map editing macro commands, as I'm trying to figure out the exact limits of what I can and can't implement...I am thinking mainly of room-type regions for the questions below.

1) Do MAPCHK/MAPCHKD look at the top item on the stack?

2) Does MAPADD destroy any creature occupying the target location, like MAPSET? What about MAPTAKE and MAPSETD?

3) What happens if you call MAPSET/MAPSETD on a location that has more than one object in the stack? Does it affect the top item?

4) Is there any way to tell from a macro if a square has a creature occupying it or not?

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 »

Good questions rld. I am anxiously awaiting the answers Chris will give us. ;)
Which of you is interested in my fine wares?

Chris H
Posts: 272
Joined: Sun Dec 02, 2007 4:07 pm
Location: California, USA

Post by Chris H »

Sorry to have been generally quiet lately -- work has had me extremely busy. I haven't forgotten you guys. :)

To answer these questions:

1. Yes, top of the stack only.

2. MAPTAKE would be the preferred method for removing a creature. MAPSET will replace the top object in the stack (which can destroy a creature) and MAPADD will put something on top of it. Note you can use MAPTAKE and MAPADD together to manually move a creature, that's how I did the before-and-after Julia and Shamino in U4PART2. (Treat it as object #255 and preserve the D value with MAPCHKD, MAPSETD) I'm not sure if this is a practical way to manually control the pathing of NPCs -- probably not -- but it's a handy way to make them disappear or appear (by moving them from somewhere inaccessible) as required.

3. Again yes, top of the stack only. Special case: items in wmaps use the D value to track (in a table) what's underneath. In other words, if the object is an item, avoid using MAPSETD.

4. Yes, creatures will appear as object 255, so a MAPCHK would return 255. And MAPCHKD would return the creature instance number.

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

Post by rld »

Chris H wrote:MAPTAKE would be the preferred method for removing a creature. MAPSET will replace the top object in the stack (which can destroy a creature) and MAPADD will put something on top of it. Note you can use MAPTAKE and MAPADD together to manually move a creature, that's how I did the before-and-after Julia and Shamino in U4PART2. (Treat it as object #255 and preserve the D value with MAPCHKD, MAPSETD) I'm not sure if this is a practical way to manually control the pathing of NPCs -- probably not -- but it's a handy way to make them disappear or appear (by moving them from somewhere inaccessible) as required.

4. Yes, creatures will appear as object 255, so a MAPCHK would return 255. And MAPCHKD would return the creature instance number.
ALL RIGHT!!! That is amazingly useful - I didn't know creatures showed up as objects on the stack at all! I assume the instance number points into a table of some sort (like with portals?) where each region has one table. I am also guessing that having more than one creature with the same instance number would be a Very Bad Thing and should be avoided.

So, that means a macro can tell if a creature exists in a certain space and move a creature from one spot to another. It can't create creatures, but the wandering life feature can be used to generate new creatures as needed, so this isn't too much of a problem. We can also destroy a creature, or at least send it to 'limbo' indefinitely.

The only thing the macro can't do at this point is tell what type of creature is on a given space, or alter the creature's HP. But if we have the instance number for a creature, maybe a future patch could add in a couple of arrays to let these values be accessed from macros? (hint, hint)

Something like

CRHP[x] - read/write creature instance X's hit point value

CRTYP[x] - read-only; return the creature number (type) for creature instance x.

That way, you could have things like a spell that only affects certain types of creatures.

Post Reply