Race Result Entry - Grisgram/gml-raptor GitHub Wiki
There are two ways to get a random result from Race
:
- You let the
RaceController
andRaceTable
objects do the work for you by placing them in a room and triggering theRaceTable
. - You invoke
race_query(...)
manually because you want to modify things in the result or perform more actions on the dropped items.
In the latter case, you will receive an array of race_result_entry
struct instances.
name |
item name |
type |
objecttype (asset name) |
data |
race data_struct (enabled, chance, ...) |
attributes |
attributes of this item (= data.attributes ) |
instance |
dropped instance (or undefined ) |
All contained objects already exist on the layer and are instantiated.
Their onCreate
and onQueryHit
events have already been executed.
If no drop was generated, instance
contains undefined
.
A note on attributes
: If the race entry had no attributes, this member contains {}
an empty struct and is never undefined
.
To avoid confusion about item name
and asset name
, I want to post a simple example here demonstrating the link between one item line in the json file of a race table and the result struct when this item drops.
If this item
"EpicWeapon1": {"type": "Thunderstrike", "always": 0, "unique": 1, "enabled": 1, "chance": 1.05,
"attributes" : { "base_damage": 1250.0, },
},
drops in a query, the result struct looks like this:
name |
string "EpicWeapon1" |
type |
string "Thunderstrike" |
data |
struct {"type": "Thunderstrike", "always": 0, "unique": 1, "enabled": 1, "chance": 1.05, "attributes" : { "base_damage": 1250.0, } }
|
attributes |
struct { "base_damage": 1250.0, }
|
instance |
Thunderstrike(1000036) <- a "living" instance in the room (or undefined ) |