Adding step macro for creatures

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

Adding step macro for creatures

Post by rld »

I am looking at adding a feature to the mega-patch that will support a form of creature 'step macros' as has been discussed previously.

Basically, this is how it would work. If the feature is enabled, a creature's 'touch macro' setting would actually be used to select two macros. The touch macro would be TOUCHM, while the 'step macro' would be TOUCHM+1. For example, if you have a creature's touch macro set to 100, the touch macro would be 100 and the step macro would be 101.

The step macro would be called for each creature before the normal creature move and attack sequence. Before the step macro is called, the following variables would be set:

W - set to the creature instance number
X - set to creature's X map location
Y - set to creature's Y map location

There will be additional commands added (using the DRAW hook) that allow various stats of a creature (creature type, HP, MP, anger, motive, etc.) to be read or written using the creature instance number as an index. I will also add a command that retrieves the creature instance number from a creature at a given map location.

When the step macro exits, if the W variable is nonzero, no action is performed. If the macro has set W to zero, then the values of X and Y are checked as follows.

X can be set by the step macro to assign an 'extra move' to the creature. This move would take place in addition to, and before, the normal move/attack sequence. Values for X might be something like:
0 - No extra move
1 - Move N
2 - Move S
3 - Move E
4 - Move W
5 - Move towards player
6 - Move away from player
7 - Move randomly

If a creature's motive is set to MOVE, then it will move twice if the above settings are used. If it is set to STOP, however, then it will only use the extra move (but it will still attack normally if possible). This could be used to implement creatures that follow preprogrammed movement paths, flee from the player, etc. Or it could be used to implement friendly creatures that follow the player.

Y can be set by the step macro to select a 'temporary weapon' for the creature to use that turn. Depending on the type of the weapon selected, either the creature's melee weapon or ranged weapon will be temporarily 'swapped out' for that turn only. This could be used to implement the following types of effects:
o Creatures that have more than two types of attacks.
o Creatures that have a powerful attack that can only be used once (or a certain number of times), and then revert to a weaker unlimited attack.
o Creatures that cast a variety of 'spells' (implemented as a ranged weapon in combination with a touch macro).

Of course, the step macro will have access to the normal map editing commands as well, allowing creatures to teleport themselves, delete themselves from the map, etc.

jjsonick
Posts: 145
Joined: Tue Apr 10, 2007 2:49 pm

Post by jjsonick »

This would be an INCREDIBLY awesome & useful feature! :)

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 »

Oooo... nice!
Which of you is interested in my fine wares?

joebonk
Posts: 112
Joined: Mon Aug 27, 2012 3:16 am
Location: las cruces, nm

step creature macro

Post by joebonk »

rld wrote: X can be set by the step macro to assign an 'extra move' to the creature. This move would take place in addition to, and before, the normal move/attack sequence. Values for X might be something like:
0 - No extra move
1 - Move N
2 - Move S
3 - Move E
4 - Move W
5 - Move towards player
6 - Move away from player
7 - Move randomly
Has this been implemented yet? I am currently making another version of ultima 6, the appearance is from top down as apposed to say ultima5 where the camera looks strait on at characters. Each character tile in U6 is slanted at 45 degree angle. I have also made a step macro that allows the character to have "walking" tiles (12 tiles in all).
Image
What I want to know is, is it possible to have a creature step macro draw a direction tile depending on what direction they are facing the player?
If creatures animate four direction tiles, it looks as if they are just spinning around in place. But if they have a hit player macro, can we change the tile of the monster to the direction in which this hit took place?
Or is there any way to have creatures turn direction (remake their tile) without the standard animating 4 tiles?

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

Re: step creature macro

Post by rld »

joebonk wrote:
rld wrote: X can be set by the step macro to assign an 'extra move' to the creature. This move would take place in addition to, and before, the normal move/attack sequence. Values for X might be something like:
0 - No extra move
1 - Move N
2 - Move S
3 - Move E
4 - Move W
5 - Move towards player
6 - Move away from player
7 - Move randomly
Has this been implemented yet? I am currently making another version of ultima 6, the appearance is from top down as apposed to say ultima5 where the camera looks strait on at characters. Each character tile in U6 is slanted at 45 degree angle. I have also made a step macro that allows the character to have "walking" tiles (12 tiles in all).
Image
What I want to know is, is it possible to have a creature step macro draw a direction tile depending on what direction they are facing the player?
If creatures animate four direction tiles, it looks as if they are just spinning around in place. But if they have a hit player macro, can we change the tile of the monster to the direction in which this hit took place?
Or is there any way to have creatures turn direction (remake their tile) without the standard animating 4 tiles?
Interesting. I had thought about this in the context of the player before, but not for creatures. Would you be wanting to have four separate sets of tiles for the creature (one regular and three animation for each direction the creature is facing) or just use each of the four current tiles as one static direction tile? You might burn through creature display tiles pretty quickly with the first approach. :)

The question would be how you determine which direction the creature is 'facing', since currently the engine doesn't track this. You could probably implement it as, whenever a creature moves in a given direction, switch its facing tile to that direction. Or whenever a creature attacks in a given direction, switch its facing tile to that direction. Is that what you had in mind?

The other question would be where to store this info in the creature field. Possibly in MP? But then you have the question of what exactly the starting value is, since the editor doesn't set it.

A simpler approach would be to make the creatures always display as if they are facing the player (or maybe only creature alignments that are hostile to the player). This doesn't help with friendly creatures, or when the player is invisible, or under similar circumstances, however.

Joebonked

Tile Facing Enemies

Post by Joebonked »

I would use the former. 4 tiles for 4 directions. I figure since the creature can be made to move in a direction, to use the direction as which tile to use.
I have come up with a complex way to do this now. Using patch commands to change the creature (and assign it the hit points it's former self had). Basically if aggro>0 and search the immediate area. If it finds a creature (and type) and it's location found on is above player then change the enemy into the version whos tiles face downward. Or whichever direction it is facing.
Before I found out about those draw 300 commands I came up with an even more complexe way to do it. Also using patch commands. Basically it would simulate a battle entirely in a macro. Basically where the location of the enemy is decides of a tile gets drawn. draw 999 1. And use getkey to cast spell or attack creature. It can simulate what weapons are used and randomly generates the results. It would even have the enemy retreat if almost dead.
To keep a tile from overwriting the screen, when battle first happens, savescr. And when lines repeat loadscr and then draw the new position of the enemy tile. This would have worked too, and I will still use it for large creature battles like dragons.

Making this short, the direction of enemy movement could trigger which tile it can be drawn with. If that can be implemented then a thousand thankyous. Perhaps the only way to make that happen is to trigger it with a hit player macro.

Post Reply