4.5.6 Using User Screen Bytes to Make a Monster!

TolerantX

Active member
If you've been following my videos on Youtube, you'll notice they aren't well documented or spoken in. My sincerest apologies for that.
I have in some videos shown use of screenbytes 0 and 1 to make things happen. They simply are user variables that are screen specific.
In today's video I show some randomness, but more importantly the screen bytes creating monsters!

An AI Script for Objects/Monsters : They act as a monster spawner and using UserScreenBytes to limit the number of objects they spawn. (object #16 or your first monster in MONSTERS).

I use an AI script to create the monster, but if you are especially creative you may think of other ways.

This is literally one of those "many ways to do this" methods...
Make sure you go in "Project Settings" then "Script Settings" and assign this script to an "Ai Behavior" (I use small i because it's easier for you to read)
Ai Script is below:

Code:
;;; this script is for an AI script on an action step that spawns a monster. ;;;

            LDA userScreenByte1            ;; Knight01_limit ;;
            CMP #$00
            BEQ +endOfScript                ;; end of this script ;;
            ;; so then we create monster     ;;
                    LDA Object_x_hi,x
                    STA tempA
                    LDA Object_y_hi,x
                    STA tempB
                    TXA
                    PHA
                         CreateObject tempA, tempB, #$14, #$00                 ;; tempA and tempB is next to spawner monster ;;
                ;; arg0 = x  , arg1 = y  , arg2 = object  , arg3 = beginning state ;;     ;;This creates monster in object slot 20 ;;
                          
                    PLA
                    TAX
                    DEC userScreenByte1        ;;  the monster make limit ;;
+endOfScript

In my handle Hurt Monster Script, I put one line (or I guess 2 if you like my commented stuff).
This can essentially be put almost anywhere. all it does is adds to the user screen byte variable:

Code:
;;;;; HERE IS KNIGHT01_LIMIT AKA MONSTER CREATE STUFF ;;;;;
    INC userScreenByte1

UPDATED SCRIPT DOWNLOAD HERE : https://drive.google.com/file/d/1evLJDPMqI47q6-JH8-JABqpn6joRumb3/view?usp=sharing

As long as you have user bytes set up use user bytes on the screen, it should work with the script on a monster in an action step:
Monster "Action Step" AI Behavior "Create Monster" End Action or Animation as a tip for fun, DO NOT LOOP, anything else works...

View: https://youtu.be/yTmxcy2xHVI
 
Last edited:

mouse spirit

Well-known member
Im sorry to ask such a basic question, but what exactly are you doing?
What i mean is, i don't understand what is going on here. I am not privvy.
But i want to know because it's probly useful.
Are they spawning in 2 specific spots, and those spots are "user screen bytes"?
I did watch the vid i just want to be sure what i'm understanding.
 

TolerantX

Active member
mouse spirit said:
Im sorry to ask such a basic question, but what exactly are you doing?
What i mean is, i don't understand what is going on here. I am not privvy.
But i want to know because it's probly useful.
Are they spawning in 2 specific spots, and those spots are "user screen bytes"?
I did watch the vid i just want to be sure what i'm understanding.
Userbytes to limit a designated object number. The AI creates an object endlessly.
 
Last edited:
Top Bottom