Bombchu Link's Open source Mods!

Jan 9, 2016 at 4:58 PM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 26
@Thomas Xin

NPC's treat slopes kinda weird because how their collision is different from the player, but here you go:

Code:
offset NPC---

#define


L_framerect_distance = 0
U_framerect_distance = 10

sprite_width         = 10
sprite_heigth        = 10
#enddefine


push ebp                      
mov ebp, esp
sub esp, 10

mov dword [EBP-10],0  
mov dword [EBP-C],0    
mov dword [EBP-8],0    
mov dword [EBP-4],0
setpointer
;----------------------------------------
cmp npc.scriptstate, 1
je :velXset
mov eax npc.EntityID
imul eax eax 10
mov npc.moveX, eax
mov npc.scriptstate, 1
:velXset

add npc.moveY, 3FF

mov edx, npc.collision
and edx, 5
je :no_hit_wall

inc npc.scripttimer
cmp npc.scripttimer, 3
jl :not_yet
neg npc.moveX
mov npc.scripttimer, 0
jmp :no_hit_wall
:not_yet
add npc.Y -F00
mov npc.moveY, 0
:no_hit_wall


;----------------------------------------

:add_vels
mov eax, npc.moveX
mov edx, npc.moveY
add npc.X eax
add npc.Y edx

inc npc.frametimer
cmp npc.frametimer, A
jl :render
mov npc.frametimer, 0
cmp npc.framenum, 1
je :2_0
inc npc.framenum
jmp :render
:2_0
mov npc.framenum, 0
:render
xor eax, eax
mov eax,npc.framenum
imul al, al, sprite_width
mov npc.DisplayL,eax
add eax, sprite_width
mov npc.displayR,eax
mov eax, U_framerect_distance
mov npc.displayU,eax
add eax,sprite_heigth
mov npc.displayD,eax

:end_of_code
mov esp, ebp
pop ebp
retn

it works on, but doesn't like slopes very well.

E: well apparently I only read half of your post; welp
 
Jan 10, 2016 at 1:12 AM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 23
@Bombchu Link:

Thanks for replying; I had thought that you'd ignored me.
However, it's kinda not working because it crashes when I assemble it (yes, the assembler crashes)!
Also, could you tell me how the sprites thingy works? I don't understand the abstract asm guides
 
Jan 10, 2016 at 3:30 AM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 26
well you gotta put an offset in such as NPC001 at the top; I just blanked it out so you can set it where you want.

Also

Everything in the defines should be self explanitory, just remember to work in x10 and not decimal.

except this part; after imul al, al, sprite_width put the line of code
add eax, L_framerect_distance because I forgot that if you want the sprite to not be jammed up against the left side of the spritesheet.

and you need noxid's defines text, and yes I'm to lazy to go dig up the link right now; but it's part of nox's open source assembly; it packaged in one of the .zip files.


Actually Noxid's assembly defines should just be packaged by default with the assembler...


E: and yeah, no I don't usually ignore people who are polite; work has just been hectic and I usually don't have access to my desktop during the week anymore...
 
Last edited:
Jan 10, 2016 at 5:21 AM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 23
I SAID BOUNCE OFF WALLS, NOT KEEP SPAZZING AROUND FOREVER AFTER HITTING A WALL

No, it actually does, it it's velocity doesn't match. Is there any way to fix that?

EDIT: Setting its velocity to 128 or something like that seemed to fix the spazzing issue. Is there any way to stop it bouncing really weirdly when it hits a wall? Sorry if that's asking too much.
 

Attachments

  • Capture.PNG
    Capture.PNG
    1.9 KB · Views: 5
Last edited:
Jan 10, 2016 at 6:07 AM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 26
huh, I had it working at just 40 but huh

Like I said; collision is really wonky on NPC's and I tend to avoid it altogether;

flying flames that go through walls? no problem.

something that slowly drains health when in water below a certain position? easy peasy.

unless being on the ground is a stagnant state or doesn't have to work with slopes, it can be like hell because of how the collision system works, every npc is just a box that can be modified in the npc.tbl

Speaking of, mess around with the npc.tbl of your NPC; I had mine at 8 for all sides then


It's just a bitch to work with the said system imao; I should prolly look at the Curly NPC (that folows you in the labyrinth) code sometime...
 
Jan 10, 2016 at 9:43 AM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 23
Would it be possible for you to double the size of it for me? Including the sprites please. Also maybe it would be better if you could make it cause a sound when it hits a wall, maybe sound effect 12 would do. Also if it's possible, can you make a third sprite for it, with the sprites shifting between them faster.
 
Last edited:
Jan 10, 2016 at 4:25 PM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 26
Change the defines man, it doesn't take a rocket scientist to figure out what sprite_width and sprite_height and what the npc.tbl editor does in boosters lab.

Hitboxes have nothing to do with the code.
 
Jan 10, 2016 at 11:10 PM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 23
@Bombchu Link:
Ummm... You'd only read half my post just then.
I know how to do the double size thing already, but I ceebs doing it and I wanted to do more than that...
 
Jan 11, 2016 at 12:36 AM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 26
Code:
offset NPC---

#define

L_framerect_distance = 0
U_framerect_distance = 10

sprite_width         = 10
sprite_heigth        = 10

max_frames       = 4
frame_shift_time = A
frames_until_end = F00
hit_sound        = C
#enddefine


push ebp                   
mov ebp, esp
sub esp, 10

mov dword [EBP-10],0
mov dword [EBP-C],0 
mov dword [EBP-8],0 
mov dword [EBP-4],0
setpointer
;----------------------------------------

inc npc.directive
cmp npc.directive, frames_until_end
jl :is_ok
mov npc.inuse 0
push 100
push 0
push 0
push 0
push 0
mov eax npc.Y
push eax
mov eax npc.X
push eax
push 4
call 46efd0      ;create npc function
add esp,20
setpointer
jmp :end_of_code
:is_ok
cmp npc.scriptstate, 1
je :velXset
mov eax npc.EntityID
imul eax eax 10
mov npc.moveX, eax
mov npc.scriptstate, 1
:velXset

add npc.moveY, 3FF

mov edx, npc.collision
and edx, 5
je :no_hit_wall

inc npc.scripttimer
cmp npc.scripttimer, 3
jl :not_yet
neg npc.moveX
mov npc.scripttimer, 0
push 1
push hit_sound
call Playsound
add esp, 8
setpointer
jmp :no_hit_wall
:not_yet
add npc.Y -F00
mov npc.moveY, 0
:no_hit_wall


;----------------------------------------

:add_vels
mov eax, npc.moveX
mov edx, npc.moveY
add npc.X eax
add npc.Y edx

inc npc.frametimer
cmp npc.frametimer, frame_shift_time
jl :render
inc npc.framenum
cmp npc.framenum, max_frames
jle :render
mov npc.framenum, 0
:render
xor eax, eax
mov eax,npc.framenum
imul al, al, sprite_width
add eax, L_framerect_distance
mov npc.DisplayL,eax
add eax, sprite_width
mov npc.displayR,eax
mov eax, U_framerect_distance
mov npc.displayU,eax
add eax,sprite_heigth
mov npc.displayD,eax

:end_of_code
mov esp, ebp
pop ebp
retn

they don't disappear offscreen, but do after a certain amount of frames now (and create smoke when they dissappear) as well as a few more stuff you can change around to your liking in the defines...

I'm bad at reading
 
Jan 11, 2016 at 9:32 AM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 23
I feel sorta dumb asking this question, but I never understood how you can access the NPC files. For example, how would I look up the AI of NPC 64 (Basic Critter)?
 
Jan 11, 2016 at 1:41 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
you just use ollydbg or some similar disassembler and go to its address, there are guides listing all of them
 
Jan 11, 2016 at 3:01 PM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 23
@Noxid:
Could you probably tell me which guides have the NPC codes?
The thing I wanted to do was make a new critter separate from the others, that flew like the Grasstown Critters, while shooting the Labyrinth Critter Projectiles. I wanted to see if I could find the codes for both NPCs and somehow mix them together without messing up everything.
 
Last edited:
Jan 11, 2016 at 4:08 PM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 26
@Thomas Xin If you want to learn about this stuff you should really look at CarrotLord's Guide to ASM and my guide to NPC hacking (right bolow my post in the sig) if you want to know more about how this stuff works.

@Noxid Unrelated, but have you ever bothered to look at my code before? I was wondering if it looked clean enough and was easy to read by another coder/and or was optimized and proficient enough.
 
Jan 11, 2016 at 4:20 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
it's alright. It could stand to be better commented, and you do framerects the naiive way. You can also save space by using XOR EAX, EAX to set EAX to zero and then push/mov EAX to different things. That way it doesn't need to hard-code a dword zero in some cases.
 
Jan 11, 2016 at 4:58 PM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 23
Jan 14, 2016 at 2:08 AM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 26
@Thomas Xin why would you be asking me for an NPC then if you've read and understood the guides?
 
Jan 14, 2016 at 4:44 AM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 23
@Bombchu Link:
Because I still can't really make a working one without making really silly mistakes, resulting either in a crash entity or a screwup of the entire NPC table.
Plus, I don't really have that much free time to do modding, let alone experiment with NPC offsets and stuff.
Thank you for the spiked ball anyway
 
Jan 14, 2016 at 5:49 AM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 26
Ehh, it would have been more fun to have just helped you make it, you and possibly some lurkers would have learned something this time around, and besides:

Give a man a fish and you feed him for a day, but teach him to fish and you feed him for a lifetime.
 
Top