Assembly is sexciting

Good to know. It’d be fun to marry your familiar.

I have a new request.
There’s a huge explosion in a map and I want to inflict X damage to all the units within a certain area.
I’d need something like this:

_SETVAL 0x1 (XX coordinate of upper left corner)
_SETVAL 0x2 (YY coordinate of upper right corner)
_SETVAL 0x3 (width of area)
_SETVAL 0x4 (height of area)
_SETVAL 0x5 (damage inflicted)

Of course, it has to be polished but you get the general idea.
Aaaand… it’d be ideal if it displays graphically too. So, basically, like when you receive poison damage at the beginning of a turn, but without the poison animation.
Is this a challenge?

P.S. I know I’m a terrible person for not having tested out your events yet, I’ll get around those sooner or later I swear

Tequila actually did this (for our forum self-insert hack). Though he hardcoded the box in the code, it would be a very easy edit.

We haven’t figured out the graphic yet. If I do, I’ll let you know. For now, I’m doing this:

CAM1 [0x10, 0x2]
SOUN 0xAF //Wall/Snag breaking
FlashCursor(0xE, 0x1, 0x08)
FlashCursor(0xF, 0x1, 0x08)
SOUN 0xAF
FlashCursor(0x10, 0x1, 0x08)
FlashCursor(0x11, 0x1, 0x08)
SOUN 0xAF
FlashCursor(0x12, 0x1, 0x08)
FlashCursor(0xE, 0x2, 0x08)
SOUN 0xAF
FlashCursor(0xF, 0x2, 0x08)
FlashCursor(0x10, 0x2, 0x08)
SOUN 0xAF
FlashCursor(0x11, 0x2, 0x08)
FlashCursor(0x12, 0x2, 0x08)
ASMC (ChOne_DamageASMC|0x1)

@Tequila

Paste this in free space (make sure it’s word-aligned), then call it with ASMC. Takes the following parameters:

_SETVAL 0x1 (XX coordinate of upper left corner)
_SETVAL 0x2 (YY coordinate of upper left corner)
_SETVAL 0x3 (XX coordinate of bottom right corner)
_SETVAL 0x4 (YY coordinate of bottom right corner)
_SETVAL 0x5 (damage inflicted)

30 B5 00 24 13 4D 20 1C 13 49 00 F0 22 F8 00 28 1A D0 01 68 00 29 17 D0 10 21 41 56 2A 79 91 42 12 DB 2A 7B 91 42 0F DC 11 21 41 56 2A 7A 91 42 0A DB 2A 7C 91 42 07 DC 13 21 41 56 2A 7D 89 1A 00 29 00 DC 01 21 C1 74 01 34 FF 2C DB DD 30 BC 02 BC 08 47 B8 04 00 03 31 94 01 08

Notes:
This is untested, because I have no idea how to do events. Just let me know if it doesn’t work as expected.
There’s no graphics (yet), because graphics are hard.
This damages all units, regardless of allegiance. A check would be easy to add if you want one.
Finally, this doesn’t kill anyone, because you’ll get glitchy 0-hp units. It’ll leave them at 1 hp instead. If someone figures out graphics, then normal death can occur (unless, of course, you don’t want that).

Source:

.thumb
.org 0x0
@Paste into free space, call with ASMC OFFSET+1

push    {r4,r5,r14}
mov        r4,#0x0
ldr        r5,Memory_Slots
Loop_Through_Characters:
mov        r0,r4
ldr        r1,Get_Char_Pointer
bl        gotoR1
cmp        r0,#0x0            @is there actually a pointer
beq        Loop
ldr        r1,[r0]
cmp        r1,#0x0            @is there actually a character at this location
beq        Loop
mov r1, #0x10
ldsb    r1,[r0,r1]        @load x coordinate
ldrb    r2,[r5,#0x4]    @x min
cmp        r1,r2            
blt        Loop
ldrb    r2,[r5,#0xC]
cmp        r1,r2            @x max
bgt        Loop
mov r1, #0x11
ldsb    r1,[r0,r1]        @load y coordinate
ldrb    r2,[r5,#0x8]    @y min
cmp        r1,r2            
blt        Loop
ldrb    r2,[r5,#0x10]    @y max
cmp        r1,r2        
bgt        Loop
mov        r1,#0x13
ldsb    r1,[r0,r1]        @load current hp
ldrb    r2,[r5,#0x14]    @load damage
sub        r1,r1,r2
cmp        r1,#0x0
bgt        Store_Value
mov        r1,#0x1            @We don't want to kill them, do we now?
Store_Value:
strb    r1,[r0,#0x13]
Loop:
add        r4,#0x1
cmp        r4,#0xFF
ble Loop_Through_Characters
GoBack:
pop        {r4,r5}
pop        {r1}
gotoR1:
bx        r1

.align
Memory_Slots:
.long 0x030004B8
Get_Char_Pointer:
.long 0x08019431
1 Like

You’re a life-saver.
Thank you so much, @Tequila! I’ll let you know how this goes.

Can this script be modified to create an Earthquake/Geosphere effect tied to an item, i.e., damage all units on the map except for ones in certain classes?

Also, isn’t there a way to cycle through units on the map? So it should be possible to cycle through all of them, check which ones have HP = 0, and kill them using a command.

Sure.

There is a way to cycle through all units on the map; it’s used in the function. I just don’t know where the function that does the killing resides.

We could use the function that calls events and just dynamically generate events to kill…

If we write the proper unit-damage info to the trap execution queue and then execute the trap cycle, it should handle the damage/death part automatically. I’ll have to see if the trap execution cycle can be called from other places other than end-of-turn.

Edit:
Oh wait. This method is going to bring up the HP bar animation for every unit that gets hurt.
There’s nothing wrong with doing it that way, but it would be really obnoxious if the Geosphere is going to hit like 30 units. I’ll just isolate the “deal trap damage to unit” part so we can call it only for units that are going to die.