Oct 11, 2015 at 10:05 PM
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1642
Age: 27
so setting npc.inuse (as according to noxid's defines.txt) to 0 is suppose to make the NPC no longer appear on the map and makes the NPC's ID number avalible to be overwritten with another NPC by calling the NPC create command right?
Because it isn't doing it for me.
I made a simple NPC that moves around and creates children; the children display 4 sprites over 4 frames and then dissapears and sets NPC inuse to 0 the only issue is that after 100x0 entites spawn it stops and other NPC's on the map that create children NPC's stop doing so as well.
all children NPC's start with an ID above 100x0 for refrence.
I'm sorry to post all these issues that I can't figure out on my own, but It's not like I have someone I partner with that actually is good with asembly.
code for refrence:
Because it isn't doing it for me.
I made a simple NPC that moves around and creates children; the children display 4 sprites over 4 frames and then dissapears and sets NPC inuse to 0 the only issue is that after 100x0 entites spawn it stops and other NPC's on the map that create children NPC's stop doing so as well.
all children NPC's start with an ID above 100x0 for refrence.
I'm sorry to post all these issues that I can't figure out on my own, but It's not like I have someone I partner with that actually is good with asembly.
code for refrence:
Code:
offset NPC265 ;Replaces doctor Proj slow ball
#define
L_framerect_distance = 0
U_framerect_distance = 20
sprite height = 10
sprite width = 10
moveXvel = 20
maxmoveXvel = 500
moveYvel = 20
max frames = 4
npc.color = [ecx+48]
#enddefine
push ebp
mov ebp,esp
setpointer
cmp npc.parent, 1
jge :child
add edx, moveXvel
cmp edx, maxmoveXvel
jl :move_vel_ok
mov edx, maxmoveXvel
:move_vel_ok
cmp npc.direction, 2
jne :vel_left
neg edx
:vel_left
;U/D movement
cmp npc.directive, 0
jne :setup_movement
mov npc.objecttimer, 28
mov npc.directive, 1
:setup_movement
inc npc.objecttimer
cmp npc.objecttimer, 50
jl :moveU
cmp npc.objecttimer, A0
jl :moveD
xor eax, eax
mov npc.objecttimer, al
jmp :setup_movement
:moveU
add eax, moveYvel
jmp :add_vels
:moveD
add eax, -moveYvel
:add_vels
add npc.Y eax
add npc.X edx
push 100
;---
push 1
push 0
call RANDOM
add esp, 8
setpointer
xor edx, edx
;----
push eax ;parent
push 0
push 0
push 0
mov eax, npc.Y
push eax
mov eax, npc.X
push eax
push 109 ;265 dec spawns itself
call 46efd0
add esp,20
xor edx, edx
mov npc.DisplayU, edx
mov npc.DisplayD, edx
mov npc.DisplayL, edx
mov npc.DisplayR, edx
jmp :end_of_code
;-------------------------------------------------
:child
inc npc.framenum
cmp npc.framenum, max frames
jl :render
xor eax, eax
mov npc.inuse, eax
;-------------------------------------------------
:Render
xor edx, edx
mov npc.displayU, dl
mov edx, npc.framenum
imul dl, dl, sprite width
add dl, 80
mov npc.DisplayU, edx
add edx, sprite width
mov npc.displayD, edx
mov eax npc.parent
imul al, al, sprite height
sub al, 10 ;because npc.parent can't be 0 and sprites start at 0 on X axis
add npc.displayL, eax
add eax, sprite height
mov npc.displayR,eax
:end_of_code
mov esp, ebp
pop ebp
retn