Skip to main content

World natives

A scene that ignores the world reads fake. These are the light-weight world-readers real mods call constantly to place their stories in a believable city: time, zone, ground, road and orientation.

Time of day

GET_CLOCK_HOURS() (and GET_CLOCK_MINUTES) read the game clock.

When you need it: deciding what may happen at all. Real code gates whole behaviors on the hour — convoys run at night, patrols only by day, bar scenes never at midday. It is also the cheapest way to make your world different at 4am than at 4pm without orchestrating anything.

int hour = Function.Call<int>(Hash.GET_CLOCK_HOURS);

Where we are

GET_NAME_OF_ZONE(x, y, z) returns the GTA zone code ("SANDY", "ZANCUDO", "ELYSIAN", …).

When you need it: territory and flavor. Faction patrols spawn by zone, dialogue reacts to the neighborhood ("we're off the map here"), and log lines annotate positions in readable terms instead of raw coordinates. It is the standard "which part of the map am I in" primitive.

Is there ground

GET_GROUND_Z_FOR_3D_COORD(x, y, z, outZ, unk) projects a point down to the floor.

When you need it: placing anything that must not be in the air — spawns, cover points, bodies dropped, heli landing pads. Real code checks it before committing to a spot, then uses the returned height instead of a guess.

Road vs not

IS_POINT_ON_ROAD(x, y, z, p4) answers exactly the question "is this point part of a road".

When you need it: placement. Bodies dragged off the street, escorts kept off running lanes, parking logic preferring sidewalk spots. It is complementary to ground projection: ground says there is floor, road says what kind of floor.

Facing a direction

GET_HEADING_FROM_VECTOR_2D(x, y) converts a direction vector into a heading angle.

When you need it: orienting actors without a target entity — a cop facing the direction the crowd is, a gang staring the player's escape vector down. Cheaper than giving everyone a full target and works when the point of interest is just a direction.

What not to do

Don't poll these every frame when the result cannot change: zone and hour are interval facts. Real mods cache the zone, refresh the hour only when a minute passes, and batch ground/road queries — the machine is fast, but thousands of mods each polling area-wise nothing is how long frametimes die.