Yanzari's-Modder/SRB2Python/Documentation
This is a documentation of all the things you can edit with python code.
Currently, all you can edit is the player object.
Functions
get_player()
Usage: srb2.get_player(node)
Example:
playerobj = srb2.get_player(0)
This gets the player with the node 0, which is you in single player mode.
set_player()
Usage: srb2.set_player(node, playerobject)
Example:
playerobj srb2.get_player(0)
playerobj.lives -= 1
set_player(0, playerobj)
- Here, we use get_player() to get a player object.
- We set the lives of the player to 1 less than what they already were, because we're evil.
- We then use set_player() to apply the changes.
Variables
Player Object
playerstate
health
The player's ring count. When changing this, player.mo.health must also be updated.
Example: See SRB2PythonPageRemake#Example
currentweapon
ringweapons
tossstrength
powers
pflags
skincolor
skin
score
dashspeed
runspeed
thrustfactor
accelstart
acceleration
charability
charability2
charflags
thokitem
spinitem
actionspd
mindash
maxdash
jumpfactor
starttranscolor
prefcolor
lives
The number of lives the current player has.
Example:
playerobj srb2.get_player(0)
playerobj.lives -= 1
set_player(0, playerobj)
- Here, we use get_player() to get a player object.
- We set the lives of the player to 1 less than what they already were, because we're evil.
- We then use set_player() to apply the changes.
continues
The number of continues the player has collected.
Example:
playerobj = srb2.get_player(0) playerobj.continues += 1 srb2.set_player(0,playerobj)
- We get the player object for node 0
- We give the player an extra continue
- We push our modified data back into the game.
xtralife
speed
Player's speed (distance formula of MOMX and MOMY values)
jumping
secondjump
fly1
Tails flying
scoreadd
Used for multiple enemy attack bonus
glidetime
Glide counter for thrust
climbing
Are you climbing?
deadtimer
End game if game over lasts too long
splish
Don't make splish repeat tons
exiting
Exitlevel timer
blackow
homing
Are you homing?
Conveyor Belt Movement
cmomx
Conveyor momx
cmomy
Conveyor momy
rmomx
"Real" momx (momx - cmomx)
rmomy
"Real" momy (momy - cmomy)
Race Mode Stuff
numboxes
Number of item boxes obtained for Race Mode
totalring
Total number of rings obtained for Race Mode
realtime
integer replacement for leveltime
racescore
Total of won categories
laps
Number of laps (optional)
Tag Mode Stuff
tagzone
Tag Zone timer
taglag
Don't go back in the tag zone too early
CTF Mode Stuff
ctfteam
0 - Spectator 1 - Red 2 - Blue
gotflag
1 - Red 2 - Blue
Do you have the flag?
dbginfo
emeraldhunt
Number of Chaos Emeralds found.
weapondelay
Delay (if any) to fire the weapon again
tossdelay
Delay (if any) to toss a flag/emeralds again
shielddelay
force shield counter
taunttimer
Delay before you can use the taunt again
Starpost information
starpostx
long starposty
long starpostz
long starpostnum
The number of the last starpost you hit
starposttime
Your time when you hit the starpost
starpostangle
Angle that the starpost is facing - you respawn facing this way
starpostbit
List of starposts hit
NiGHTS Stuff
angle_pos
old_angle_pos
axis1
axis2
bumpertime
Currently being bounced by MT_NIGHTSBUMPER
flyangle
drilltimer
linkcount
linktimer
anotherflyangle
nightstime
How long you can fly as NiGHTS.
drillmeter
drilldelay
bonustime
Capsule destroyed, now it's bonus time!
capsule
Go inside the capsule
mare
Current mare
lastsidehit
lastlinehit
losscount
Number of times you've lost only 1 ring
currentthing
For the object placement mode
onconveyor
You are on a conveyor belt if not zero.
awayviewmobj
awayviewtics
spectator
jointime
Timer when player joins game to change skin/color