-
Notifications
You must be signed in to change notification settings - Fork 13
Library: Ratchet & Clank (PAL, NPEA00385)
Lua library for the PAL version of Ratchet & Clank for PS3. It will not work with the NTSC version of the game.
The objects documented underneath are globally available for Lua automations running against the game. To read and set properties or call functions of the objects you work with them like this example:
ratchet.bolts = 1000 -- Set bolt count to 1000
if game.planet == 3 then -- If planet is Kerwan
game:loadPlanet(4) -- Load Eudora
end
Note the : (colon) instead of . (dot) when calling functions as opposed to reading/setting properties.
Globally available object to manipulate the player object. With this you can set the bolt count and player position and stuff like that.
x
: float
– Player's X-position
y
: float
– Player's Y-position
z
: float
– Player's Z-position
rotation_z
: float
– Player's Z-rotation
bolts
: int
– Bolt count
health
: int
– Current player health
state
: int
– Player state, if they're locked in place, in bonking-animation, etc.
Globally available object to manipulate general game stuff.
planet
: int
– ID of current planet/level you're on.
state
: int
– Current game state, like if currently playing (0) or in a cut scene (2) or in the pause menu (3).
fov
: float
– Camera Field-of-View
_time
: int
– Global timer used for some shit. Don't set this, you'll have a bad time.
game:loadPlanet(id)
Loads the level ID you specify in the argument.
game:setFastLoads(enabled)
Enabled or disables fast loads based on argument as a boolean value (
true
orfalse
). These fast loads do not work for levels 0 and 1 (Veldin 1 and Novalis).
Moby
is a globally available class that you instantiate using the in-game address of a Moby. Mobys are what Insomniac named their game objects. If you're familiar with game engines like Unity, it's Insomniac-flavored GameObject
. They are objects that can be moved about in the game, have animations and/or have code related to them that updates their behavior.
You can also use the static functions Moby:findFirst(moby_id)
and Moby:findAll(moby_id)
to find the first Moby or get an array of all matching Mobys, respectively.
moby = Moby:findFirst(0) -- Finding the Ratchet moby (the Ratchet moby has ID 0)
moby = Moby:findAll(0xb) -- Get an array of all the vendors in current level
moby = Moby(0xac1010) -- Instantiate a moby with the absolute address of 0xac1010
To find Moby IDs present in a particular level, use Replanetizer to load the level files and look through Models viewer
.
x
: float
– Moby X-position
y
: float
– Moby Y-position
z
: float
– Moby Z-position
state
: int
– Moby state, 0xff
means the object is destroyed. All other values depend on what type of moby it is, there is no standard for what any state means.
group
: int
– idk tbh
m_class
: int
– Moby class identifier in the current level. Might vary for the same moby in different levels.
alpha
: int
– Transparency level for the moby. Goes from 0 (fully transparent) to 128 (fully visible)
p_class
: int
– Can't remember, it does something.
scale
: float
– Scale of the moby. Mobys have different scale levels by default, 1.0 does not mean 100% scale, for most mobys 1.0 is larger than its default.
update_distance
: int
– The distance Ratchet/camera can be from the moby and it will still update (walk around, attack, etc.). Goes from 0 to 255.
enabled
: int
– Might be misnamed, idk what it truly does.
draw_distance
: int
– The distance Ratchet/camera can be from the moby and it will be drawn on screen. 0 means it will not draw anywhere. Maximum value is 65535.
rotation_x
: float
– X rotation of moby.
rotation_y
: float
– Y rotation of moby.
rotation_z
: float
– X rotation of moby.
update_func_ptr_ptr
: int
– Pointer (address) to the pointer of the update function.
Moby:findFirst(moby_id)
Returns the first moby matching the supplied ID. This is a static function, you use it on the class, not an instantiated object. See above for examples.
Moby:findAll(moby_id)
Returns the all mobys matching the supplied ID in an array. This is a static function, you use it on the class, not an instantiated object. See above for examples. If you set
moby_id
as -1, this will return all mobys.
- Lua automations and limitations
- Quickstart: Making your first automation
- Reading and writing memory
- Lua libraries
- Making a game library
- Game patches
- Quickstart: Simple game patches
- Quickstart: Compiling a mod