VDfreesince1983
New member
This might just be a engine script oversight on my part. I use the b_create_melee script for a player attack for a platformer, my Melee object is in spot 01 (2) in the game object section, its animation is set to 00 (1) in its object details, but the script errors out during the compiling process
Routines\Basic\ModuleScripts\InputScripts\b_create_melee.asm(56):CreateObject(36): Unknown label.
Routines\Basic\ModuleScripts\InputScripts\b_create_melee.asm(73):CreateObject(36): Unknown label.
I cant find any issue with either line 56 or 73
CreateObject temp, temp1, #$01, #$00
CreateObject temp, temp1, #$02, #$00 ; I have tried switching those values around to 01 and 00
Aside from Dale_Coop's custom script for 4.0.11 this is almost identical to what worked in previous versions. I might have a simple (almost code free) solution for the Astynax-esque weapon arcs I have been working on, If I can get over this little Hiccup. Here is the entire script:
LDA gameHandler
AND #%00100000
BEQ notNPCstate_attack
JMP doneAttacking
notNPCstate_attack
LDA weaponsUnlocked
AND #%00000001
BNE canAttack
JMP doneAttacking
canAttack:
LDX player1_object
GetCurrentActionType player1_object
CMP #$02
BNE notAlreadyAttacking
JMP doneAttacking
notAlreadyAttacking
;;; don't attack if already attacking.
;;; do we have to check for hurt here?
;;;;; Here, we WOULD create melee
ChangeObjectState #$02, #$02
LDA Object_movement,x
AND #%00001111
STA Object_movement,x
LDA #$00
STA Object_h_speed_hi,x
STA Object_h_speed_lo,x
STA Object_v_speed_hi,x
STA Object_v_speed_lo,x
LDA Object_x_hi,x
STA temp
LDA Object_y_hi,x
STA temp1
LDA Object_movement,x
AND #%00000111
STA temp2
AND #%00000010 ;; this will be 0 on up and down, but 1 on left right
BNE createLRmelee
LDA temp2
TAY
LDA temp
SEC
SBC #$08 ;; width of weapon
CLC
ADC weaponOffsetTableX,y
STA temp
LDA temp1
SEC
SBC #$10
CLC
ADC weaponOffsetTableY,y
STA temp1
CreateObject temp, temp1, #$01, #$00
JMP meleeCreated
createLRmelee:
LDA temp2
TAY
LDA temp
SEC
SBC #$10 ;; width of weapon
CLC
ADC projOffsetTableX,y
STA temp
LDA temp1
SEC
SBC #$08
CLC
ADC projOffsetTableY,y
STA temp1
CreateObject temp, temp1, #$01, #$00
meleeCreated:
;;;; x is now the newly created object's x.
LDA Object_movement,x
ORA temp2
STA Object_movement,x
PlaySound #sfx_slash
doneAttacking:
RTS
;;000 down
;010 right
;100 up
;110 left
Routines\Basic\ModuleScripts\InputScripts\b_create_melee.asm(56):CreateObject(36): Unknown label.
Routines\Basic\ModuleScripts\InputScripts\b_create_melee.asm(73):CreateObject(36): Unknown label.
I cant find any issue with either line 56 or 73
CreateObject temp, temp1, #$01, #$00
CreateObject temp, temp1, #$02, #$00 ; I have tried switching those values around to 01 and 00
Aside from Dale_Coop's custom script for 4.0.11 this is almost identical to what worked in previous versions. I might have a simple (almost code free) solution for the Astynax-esque weapon arcs I have been working on, If I can get over this little Hiccup. Here is the entire script:
LDA gameHandler
AND #%00100000
BEQ notNPCstate_attack
JMP doneAttacking
notNPCstate_attack
LDA weaponsUnlocked
AND #%00000001
BNE canAttack
JMP doneAttacking
canAttack:
LDX player1_object
GetCurrentActionType player1_object
CMP #$02
BNE notAlreadyAttacking
JMP doneAttacking
notAlreadyAttacking
;;; don't attack if already attacking.
;;; do we have to check for hurt here?
;;;;; Here, we WOULD create melee
ChangeObjectState #$02, #$02
LDA Object_movement,x
AND #%00001111
STA Object_movement,x
LDA #$00
STA Object_h_speed_hi,x
STA Object_h_speed_lo,x
STA Object_v_speed_hi,x
STA Object_v_speed_lo,x
LDA Object_x_hi,x
STA temp
LDA Object_y_hi,x
STA temp1
LDA Object_movement,x
AND #%00000111
STA temp2
AND #%00000010 ;; this will be 0 on up and down, but 1 on left right
BNE createLRmelee
LDA temp2
TAY
LDA temp
SEC
SBC #$08 ;; width of weapon
CLC
ADC weaponOffsetTableX,y
STA temp
LDA temp1
SEC
SBC #$10
CLC
ADC weaponOffsetTableY,y
STA temp1
CreateObject temp, temp1, #$01, #$00
JMP meleeCreated
createLRmelee:
LDA temp2
TAY
LDA temp
SEC
SBC #$10 ;; width of weapon
CLC
ADC projOffsetTableX,y
STA temp
LDA temp1
SEC
SBC #$08
CLC
ADC projOffsetTableY,y
STA temp1
CreateObject temp, temp1, #$01, #$00
meleeCreated:
;;;; x is now the newly created object's x.
LDA Object_movement,x
ORA temp2
STA Object_movement,x
PlaySound #sfx_slash
doneAttacking:
RTS
;;000 down
;010 right
;100 up
;110 left