Page 2 of 2

Posted: Mon Mar 10, 2014 9:40 pm
by Garth's Equipment Shop
Ok so far from my battle tests with various enemies attacking me with various types of ranged weapons only cone shaped area-of-effect attacks are being misdirected based on the last direction i attacked. So something in the code that Chris was messing with for area-of-effect attacks by enemies somehow got linked to the direction of the player's last attack.

I also tested this with the player-character using normal melee attacks as well as ranged. Same thing happens. So long as the enemy is using a cone shaped or area-of-effect attack it becomes misdirected away from the player-character every time whether the PC attacks with a ranged or normal attack.

I attempted to trick them into attacking in my direction or at least randomize their attack directions by creating an invisible good npc character with zero hp to make him invincible and gave him a ranged weapon that does the least amount of damage possible. I placed a few copies of him around the perimeter outside the immediate area of my battle test. They attacked my enemies repeatedly as i fought them as I expected and the enemies were able to target these invisible guys with no problem to retaliate. But when I attacked any of them their retaliatory move was always misdirected away from me.

I named the invisible good guys "Your alter-ego" so when they attacked it would say "Your alter-ego hits evil minion for 4 points of damage." I wish it would include what he is attacking with in the message. I called his weapon "insults" and made it a ranged weapon. Would be funny if it read "Your alter-ego attacks the evil minion with a barrage of insults!" The attack message could depend on the type of weapon.

For ranged weapons there is already the setting to choose what kind of ranged attack it is whether a stream, blast radius, a cone, or pinpoint. I guess stream would be the closest thing to automatic fire. So the barrage message could be associated with streamed attacks. Though I guess they are also used for laser beams so perhaps an option for that case too for streamed attacks.

Pinpoint would just be "shoots" or "fires" a [name of ranged weapon or it's ammo if it has any] at [name of target] for [damage] points of damage. Or even cooler, include an optional setting in the weapon creation dialog for custom transitive verbs to be used in the attack message.

Now I'm reminiscing about classic Wasteland's randomized damage descriptions such as "and explodes like a blood-sausage" following an attack that scored devastating damage to your opponent.

Posted: Tue Mar 11, 2014 3:43 pm
by joebonk
LOL. Thats funny. Oh the possibilities :)
Thank you for testing it. Thought I had busted something.
I too noticed that the counter attack is always opposite from the last direction player used weapon. Even would walk into the spread of the enemy weapon just to see if it was working in that direction.
They still can attack npcs! Hmm. Wonder if making invisible characters that are evil and have weapons that can do no damage may make them follow the player, and so other visible enemies will shoot in the same direction as you because right next to you is a ghost dummy.
Interesting to note is that we can set up enemy reactions unknown to the player.
Or they can somehow be visible to player because they have something to do with the environment. Frogs in a swamp.
Or ants at a picnic.
:::
I came up with a simple idea for a quick contest quest. Next weekend I will try to get it out.
:::
About the weapon changes.
I wonder if I could get at the files of the stand alone U4.2 and copy paste the portions pertaining to the weapons and again get that function back. To me it does not matter if enemies can cause other enemies damage. Orks are dumb minded anyways :)

Posted: Fri Apr 04, 2014 10:12 am
by Admiral Ackguh
Remember that the original ACK combat engine code was from the early 1990s. Chris had to cut many corners to make it run reasonably fast on affordable home computers back then. Hence the freakiness with ranged weapons, especially NPC use of area-attack weapons.

I can suggest some new features:

1) Allow stream weapons to fire diagonally.

2) Specify a Penetration value for stream and cone weapons. That would be the number of targets hit starting with the nearest one; a value of 0 would mean all possible targets in the area.

3) Specify a Friendly Fire value for creatures (0 to 10) - its willingness to hit allies when firing area weapons at enemies.

Posted: Fri Apr 04, 2014 10:20 am
by Admiral Ackguh
If you need to have a dragon or some other boss monster have an area attack, it can be done this way. Give the monster normal attacks, and put in a step macro to simulate the area attacks. The step macro code can decide if/when/where to attack, and use DRAW or mosaics for the visual effect. The ACK patch that allows creature HP to be seen and changed will be needed to deal damage to NPCs. (Although ordinary ACK can randomly kill creatures by using MAPDEL.)

skull

Posted: Fri Aug 15, 2014 4:00 am
by joebonked
I want to make an evil object misc. "Skull Of Mondain", which in Ultima killed every enemy in sight. Lore says that it can kill whole towns. I think in Ultima4 you lost all of your karma if you used it The character in my present game is a zombie of some kind and could care less about karma, but using it will still cost him plenty (because the weapon is too powerful for game play). To rid the viewing area of any creature, what is the macro command for deleting npcs? Does the macro have to scan every visible tile for an NPC and then delete them? Or is there a similar command to "remove everything underneath" that addresses all present?
The item is only plot related but I do have to give it powers resembling the original purpose it had with Ultima. My revision for the character is to loose a level and a point from each attribute. And if player is too low already to finally kill them without being able to continue the game. Otherwise the weapon is too powerful, and it did cost the player in the original Ultima.

Re: skull

Posted: Sun Sep 28, 2014 10:00 pm
by Admiral Ackguh
joebonked wrote:I want to make an evil object misc. "Skull Of Mondain", which in Ultima killed every enemy in sight.
If you intend to kill all creatures in a certain area, you could use the following code:

Code: Select all

        1: IF LOC[RG] = 7 THEN 3
        2: STOP 
        3: SOUND 47
        4: TBMP 51
        5: PAUSE 6
        6: SET U2 = LOC[X] + 4
        7: IF U2 > 48 THEN 
        8: SET U2 = 48
        9: SET V2 = LOC[Y] + 4
        10: IF V2 > 48 THEN 
        11: SET V2 = 48
        12: SET X2 = LOC[X] - 3
        13&#58; IF X2 < 1 THEN 
        14&#58; SET X2 = 1
        15&#58; SET Y2 = LOC&#91;Y&#93; - 3
        16&#58; IF Y2 < 1 THEN 
        17&#58; SET Y2 = 1
        18&#58; IF X2 = 27 THEN 34
        19&#58; MAPCHK X2 Y2 Z2
        20&#58; IF Z2 ! 255 THEN 32
        21&#58; MAPTAKE X2 Y2 #255-
        22&#58; SET W2 = LOC&#91;X&#93; - X2
        23&#58; SET Z2 = LOC&#91;Y&#93; - Y2
        24&#58; SET W2 = W2 * 16
        25&#58; SET Z2 = Z2 * 16
        26&#58; SET W2 = 131 - W2
        27&#58; SET Z2 = 90 - Z2
        28&#58; DRAW W2 Z2 TO W2 Z2 OF 4 5
        29&#58; SOUND 0
        30&#58; SOUND 16
        31&#58; PAUSE 2
        32&#58; SET Y2 = Y2 + 1
        33&#58; IF Y2 < V2 THEN 19
        34&#58; SET X2 = X2 + 1
        35&#58; IF X2 < U2 THEN 15
        36&#58; SOUND 0
        37&#58; STOP 
This was for a device that killed everything in sight, in (worldmap) Region 7. I had to skip a few spaces where I had indestructible creatures. Note that basic ACK has no way of distinguishing creatures - they are all Object #255. You will need the Mega Patches in order to retrieve creature number, HP, or max HP.

bug

Posted: Sat Dec 26, 2015 2:29 pm
by Joe_Bonk
Recently there was someone here act jolt Ack describing a macro bug, but for the life of me can't find it.
Think I've ran into it myself.

This is what happened. I wrote a Macro up to some 180 or more lines. Only to find out later that it will cut off Macros at LINE:99. With no warning either. But that does not bother me in the least.

But is happening now is that I rewrote the new version to try to get as much as a working macro into 99 lines.
This Macro is my baby. Had the most fun planning it and writing it. Using variables to instead of more codes and such. Anyways I did manage to get it all into every single 99 lines. At times I was able to cut it down to 93, but fixing quickly dipped it back up to 97.

Reworking the thing the line count floated between 94 and 103 lines, several times and always managing to shrink it back to 99 before saving.
The final result was 94 lines. But line 95 96 97 98 99 are repeats of one line.
I delete them and they return.
I opened Ack launcher one at a time for ten times and opening Macro editor ten separate times in a row to delete those lines,
(thinking they are remnants of something that may have went further.)
But they always show up again.
Most of the items the Macro needs are not even ready yet so I can't test the thing properly.
But the physics of it seems to have trouble anyways but that may just be not having my stuff ready yet.
In the end my question is:
Is this Macro screwed for life?
Or, can a macro be screwed for life?
Should I start over... again (sigh)?

Only reason I ask is if someone else had run into lines repeating themselves before. If they know that it is a real problem then I can move on and rewrite it.

Re: bug

Posted: Tue Dec 29, 2015 3:37 am
by Admiral Ackguh
Joe_Bonk wrote:In the end my question is:
Is this Macro screwed for life?
Or, can a macro be screwed for life?
I don't think so.
Should I start over... again (sigh)?
Only if you're sure that its "screwed-up" structure is causing problems.
Only reason I ask is if someone else had run into lines repeating themselves before. If they know that it is a real problem then I can move on and rewrite it.
That has happened to me many times. Once you put over 99 lines in a macro, it will store the last line, and repeatedly copy it to the lines before it. If you delete a line, than it will again copy the last line into the new extra space at the end of the macro.

If you make sure that your last line is STOP before the repeated line at the end of the maco, then you should have no problem.

Posted: Tue Dec 29, 2015 4:10 am
by joebonkt
Thank you Admiral.
I was so paranoid that I rewrote the whole macro files.
I made a new game. And made one macro, then looked into the game folder, found the files last updated, copied and renamed them and paste them over my old game macro files. It was two of them. Took me an hour or two.

Guess that was a waste. But there were macros I wanted to eliminate anyways. Now it's tidy.

Mainly I deleted all the Macros that were tile swaps, since they can all be made into one macro.

The Big project I was working on is my spell book object macro. I did away with the cast command and using bitwise variables made an elaborate system that overlays tbmps on top of a blank spell book bmp.

32 spells. Even have four page turning bmps that animate nicely. It uses two variables.

If there is a way to cycle test a variable for it's bit flag to be set, I haven't found it yet. Instead I had to check one line at a time. Just getting the display to unfold took all 99 lines. I had to put the page turning backward onto it's own macro.

Then the display is divided into 4 open books displays. And then it took again 99 lines just make selecting each spell with a little movable dot. I wanted to use the keypress variable but it wasn't registering key presses so I used savescr and loadscr to keep the dot moving.

Took forever but now it's perfect. It will take several more to get the spells to function. Looks real pertty.

Is there a secondary savescr or loadscr. Can more then one screen be saved at a time?

I have 32 little spell bmps that overlay the book. But once it is finished, I have 32 more little bmps that sit at the side of the screen showing the spell is ready for casting. But I want to return the player screen right away instead of waiting for the player to move one step.

When the spell book displays, it does so over the screen but allowing some of the action to still be seen at the sides. But I can't use loadscr after the book closes because I needed it for to replace the last spot the selector dot used to be. Instead, now, when the book closes, the game play area goes black.

I made a copy of the wskin and added to each spell icon bmp the displays at the side so that still shows up.

Entrance Macro

Posted: Fri Jan 08, 2016 6:30 pm
by Joeboncked
Sorry for double posting.
Macros don't know what region player is in till after the macro is finished.

If there was one large macro for all entrances..
Then in the macro:
if loc[rg] = 2 then (goto what happens)

(what happens)
Give player (somesuch item)

Result.
No item given because the macro
doesn't know you are there yet till after it finishes running.
How I discovered it was Tile Swapping.
Macro 50: ENTRANCE MACRO
1: IF LOC[RG] = 1 THEN 4
2: IF LOC[RG] = 3 THEN 7
3: STOP
4: DRAW 999 100 TO 1 0 OF 0 0
5: DRAW 999 101 TO 1 0 OF 0 0
6: STOP
7: DRAW 999 100 TO 2 0 OF 0 0
8: DRAW 999 100 TO 2 0 OF 0 0
9: STOP
The macro gives the wrong one because
as it fires it still believes player is in last map.

Hope there is a way to have one macro for all regions.

PS.
rld wrote:Looking at some of the macros in the ZOMO game
(which is very cool, btw) and I had a question:
I see the line
SET 0 = 0
repeated in several macros. Was there a reason for this?
Thanks!
When I do this it is to delete a line without losing it's place.
That way if we need it again we can write over it.
The danger of inserting lines is that even though gotos and if thens get updated when new lines are added, sometimes they loose there place.
However I have stopped this because macros, being only 99 lines, ever line is precious.

Re: Entrance Macro

Posted: Sat Jan 09, 2016 12:47 am
by Admiral Ackguh
Joeboncked wrote:Sorry for double posting.
Macros don't know what region player is in till after the macro is finished.
That is only true if the player's region or room is changed in that particular macro. The typical series of events:

1) Macro A starts.
2) Location changes in Macro A.
3) Macro A continues, with old LOC values.
4) ACK fires entrance macro for new region, with new LOC values loaded.

This is true even when an entrance macro changes player location. It finished with the old location, then runs again with the new one.
If there was one large macro for all entrances..
Then in the macro:
if loc[rg] = 2 then (goto what happens)
My code seems to run properly that way.
How I discovered it was Tile Swapping.
Macro 50: ENTRANCE MACRO
1: IF LOC[RG] = 1 THEN 4
2: IF LOC[RG] = 3 THEN 7
3: STOP
4: DRAW 999 100 TO 1 0 OF 0 0
5: DRAW 999 101 TO 1 0 OF 0 0
6: STOP
7: DRAW 999 100 TO 2 0 OF 0 0
8: DRAW 999 100 TO 2 0 OF 0 0
9: STOP
The macro gives the wrong one because
as it fires it still believes player is in last map.
Perhaps tile swapping interferes with entrance macros?
I haven't used tile swapping (yet), and using a common entrance macro with LOC[RG] works just fine.

As for the "SET 0=0" dummy statements, please see my reply to rld in the Revenge of the Zomos thread.

tileswapping

Posted: Fri Jan 29, 2016 6:17 pm
by joebokn
Otherwise will have to make an entrance macro for every tile set. And I have some 50 or more tile sets. Its just I wanted every map to have something unique to it. Should have thought about a problem emerging before I went tile commando. Come to think of it only about 3 or 4 maps actually share a tileset with another.

entrance macros

Posted: Sat Feb 13, 2016 6:34 pm
by Joebankh
Did some testing with macros and entrances.
And made a video with the results.

View My Video

First with no macros running.

Then second with only a portal macro.

Then third with only an entrance macro.

The first test had no problems.
The second and third had exactly the same results.
Then macro had only one line:

set loc[y] = loc[y] + 1

I set the portal to run it second, and the made it an entrance macro the third.

In both cases then map would change for just a brief second but then
when it went to set the loc[y] + 1
it did so on the previous map, leaving the player to still be on the previous map.
So it did change maps.
But changed it right back when the macro completed it's task.
And it completed it's task on the first map.

So this may be a problem for setting new conditions once someone has arrived on a new map.
It messes with a lot of my bmp triggers and such.

Also, unrelated note, I lost my password which is why I've been
always signing in as a guest.
The reason for this is because my email provider keeps asking for a
secret question to verify it's me but I forgot the answer I gave.
Guess I will have to make a new account.

Posted: Thu Feb 18, 2016 2:27 am
by Admiral Ackguh
Joe: I'll look into all this when I have more time.

The actual Entry Macro fires when the region is not completely loaded. The LOC variables are current, but not the terrain. Use the Step Macro (and the following technique) for a true post-entry macro for region / room.

At the end of the step macro, save current region and room to variables:

SET R = LOC[RG]
SET R2 = LOC[RM]

At the beginning of the step macro, compare current room and region to R and R2. If they are different, then put in code for any action to be taken.