user variables and custom scripts...

digit2600

Member
So, I'm trying to figure out how to specifically target certain objects and or tiles with certain scripts, in particular, scripts that set user variables... anyone figure out how to do this ?

For example, I have a script for weapons pickups that is reusable for each different weapon pickup

Ie

Lda room
Cmp#$01
Beq weapon 1
Cmp #$02
Beq weapon w

Thing is, how do I call a user variable on the fly at any point in the game efficiently, in this instance, the user var room ?
 

dale_coop

Moderator
Staff member
Depends when you want this script to execute? If you want it when the player arrives at certain coords in the script, you could use a tile to execute the script, if you want on a delay, use a monster timer or a modify the game timer. If you want on collecting the item, use pickup, if when a screen loads, needs to add some code in the HandleScreenLoads script,...

A LOT of way to execute scripts (using user cars / constants) in gameplay.
 

digit2600

Member
I totally get that, but my question is more of, If I create said object, how do I point to that in a script? Can it be targeted with lda myMonster_object or myTile_object?
 

dale_coop

Moderator
Staff member
You could loop all the objects on the screen and if one is the object you want (checking "LDA object_type, x") you could execute some op codes.
Or another possibiilty would be to use a variable mySpecificObect to keep track of your object you will create, in the createobject script,jsut after the line CreateObject xx,xx,xx... add:
Code:
TXA
STA mySpecificObect

Now you can easily compare any object loaded in X with that variable, or load that variable in X to execute something with that object, ...
But you will add to set this variable to #$FF when the object is destroyed, or not yet created, ...
 
Top Bottom