Skip to main content

Scripted mods

We picked our family: scripted mods. This lesson explains what that actually means, so you understand why programming is unavoidable from here on, and what kind of programming it is.

New behavior needs logic

Editing a config file changes a number the game already knows how to use. A scripted mod is different: it introduces behavior the game never had. A guard who follows you and fights back only against the person attacking you does not exist as a setting. Nobody left a dial for it. To make it happen, something has to decide, every frame, what that guard should do. That deciding is logic, and logic is code.

Your code runs inside the game

A scripted mod is not a separate program that talks to the game from outside. It runs inside the game process, invited in by ScriptHookVDotNet. Every tick, the engine gives your code a brief turn to act, then moves on. You read the world, make a decision, issue a command, and step aside. This is why timing, cleanup, and not blocking the loop matter so much: you are a guest running on the host's heartbeat.

You command, the engine executes

You rarely move a character pixel by pixel. Instead you hand the engine a task ("go to this point", "fight that ped") and it carries it out with its own animation and pathfinding. Your job is to decide which task, when, and against whom, then to notice when the situation changed and issue a new one. Good scripted mods are mostly good decisions, not clever motion.

Why this is real programming

Because you will hit every core idea in software here. State, to remember what your mod is doing. References, to point at entities that may vanish. Lifetimes, because a ped you spawned is your responsibility to clean up. Conditions and loops, to react. The game just makes these ideas visible and immediate, which is the best way to learn them.

What this means for you

From the next stage on, you write code. Not because code is the goal for its own sake, but because it is the only way to add behavior that did not exist. Before we get there, two last Discover questions: why GTA V is where we start, and where the modding world came from. Next up is the history that made all of this possible.