salgue79 said:
Hello!! I would like to know, if it were possible that an enemy, Level Boss, could say something when defeated. As if it were an NPC. It would be for a phrase for each Level Boss.
Would it be possible?
Here a simple way to do that:
1) Open the "Project Settings" dialog and go to the "User Variables" tab. Check if you have a variable named "npc_autotext":
If you do NOT have it, create a "npc_autotext" with initial value "0".
2) Modify the "HandleDrops.asm" script that is assigned to the "Handle Drops" in your "Project Settings > Script Settings" (select the line and click ok the Edit button):
At the beginning of the "HandleDrops.asm" script, add this piece of code:
Code:
;; which text to use:
LDA Object_ID,x ;; the one assigned to the monster placement
STA textVar
LDA #$01
STA npc_autotext
;; display the text:
LDA gameHandler
ORA #%00100000
STA gameHandler
LDA #%10000000
STA textboxHandler
3) Modify your b_activate_text_box.asm in your "Scripts > Input Scripts" list:
(it is the script that show/close the NPC text box when you press B)
And replace with that script:
Code:
LDA textboxHandler ;; check if the text is completely displayed
AND #%11000000
BEQ +
RTS
+
LDA textboxHandler
AND #%00010000 ;; if the b button is pressed
;; but the box + text have been activated
;; and also the 'do box' bit is OFF
;; that means this is ready to "go away".
BEQ checkToTurnTheTextboxOn ;; hasn't started yet
;; begin turning the textbox off.
LDA gameHandler
ORA #%00100000
STA gameHandler
;;; are we turning this on or off?
;;; check for more
;;; check for 'choice'.
LDA #$00
STA updateNT_offset
STA updateNT_H_offset
STA updateNT_V_offset
STA npc_autotext ;;<-- dale_coop: for autotext tiles
LDA #%10001000
STA textboxHandler
RTS
checkToTurnTheTextboxOn:
LDA npc_autotext ;;<-- dale_coop: for autotext tiles
BEQ +
JMP ++
+
LDA npc_collision
BEQ noNPCcollision
++
LDA textboxHandler
AND #%10000000
BNE noNPCcollision
LDA gameHandler
ORA #%00100000
STA gameHandler
;;; are we turning this on or off?
;;; check for more
;;; check for 'choice'.
turnTheTextboxOn:
LDA #%10000000
STA textboxHandler
noNPCcollision:
RTS
4) Assign your Text to your Text Group... then, assign that Text Group to your screen, in the "Infos" dialog:
VoilĂ , now you should have a text that shows up when you kill a monster.
PS: don't forget to save your project.