How to run a custom SRIV gameplay script

[V] IdolNinja

Volition Staff
NOTE: This tutorial only works for the new Modding Patch and Steam Workshop support. If you haven't already signed up to beta test, you'll want to do that first.
https://www.saintsrowmods.com/forum/threads/switching-to-the-modding-patch-test.9806/

HOW TO RUN A CUSTOM SRIV GAMEPLAY SCRIPT

Creating a Steam workshop item script that runs on city load is incredibly easy. Here's an example using the new time of day function that we just added in to the patch.

STEP 1:
Create a new lua file for your script. A lua script is simply a text file that you change the extension from .txt to .lua and add your code. For this example we'll name the new script:
gameplay_dynamic_tod.lua

*NOTE: The gameplay_ is important in the script name. Always name a modded script starting with gameplay_ so that the game knows to run the script on city load.

STEP 2:
Inside the script create a new function. This new function name should be the filename of the script, followed by _init.

Code:
function gameplay_dynamic_tod_init()

end

STEP 3:
Inside your new function put whatever lua commands you want to run. For this example, we'll enable the new dynamic time of day that was just added to the modding beta patch.

Code:
function gameplay_dynamic_tod_init()
   dynamic_tod_enable(true)
end

NOTE: See the lua reference from the SR3 SDK alpha tools for available commands:
https://www.saintsrowmods.com/Kinzies-Toy-Box/script_actions/_script_actions_index.html

STEP 4:
Package your new script and upload it as a workshop item

That's it! Easy, huh? Keep in mind that you want to make your script names as unique as possible so that they don't overwrite other modders' scripts that may have similar names (or be overwritten.)

NOTE: I've also attached the script itself for reference.
 

Attachments

  • gameplay_dynamic_tod.lua
    68 bytes · Views: 731
Last edited:
I followed this tutorial and the result of the gameplay code you provide seems to allow me to disable and enable the moon's movement in my game.

But when trying to add in the functionality listed in the lua reference from the SR3 SDK, so far all the functions I've tested on this page do not work. Including: message, players_naked, character_ragdoll, and character_kill.

So I just want to confirm if there are other steps that are not listed in the guide I need to follow to make these functions run properly.
 
I followed this tutorial and the result of the gameplay code you provide seems to allow me to disable and enable the moon's movement in my game.

But when trying to add in the functionality listed in the lua reference from the SR3 SDK, so far all the functions I've tested on this page do not work. Including: message, players_naked, character_ragdoll, and character_kill.

So I just want to confirm if there are other steps that are not listed in the guide I need to follow to make these functions run properly.
See my reply in your other topic.
 
NOTE: This tutorial only works for the new Modding Patch and Steam Workshop support. If you haven't already signed up to beta test, you'll want to do that first.
https://www.saintsrowmods.com/forum/threads/switching-to-the-modding-patch-test.9806/

HOW TO RUN A CUSTOM SRIV GAMEPLAY SCRIPT

Creating a Steam workshop item script that runs on city load is incredibly easy. Here's an example using the new time of day function that we just added in to the patch.

STEP 1:
Create a new lua file for your script. A lua script is simply a text file that you change the extension from .txt to .lua and add your code. For this example we'll name the new script:
gameplay_dynamic_tod.lua

*NOTE: The gameplay_ is important in the script name. Always name a modded script starting with gameplay_ so that the game knows to run the script on city load.

STEP 2:
Inside the script create a new function. This new function name should be the filename of the script, followed by _init.

Code:
function gameplay_dynamic_tod_init()

end

STEP 3:
Inside your new function put whatever lua commands you want to run. For this example, we'll enable the new dynamic time of day that was just added to the modding beta patch.

Code:
function gameplay_dynamic_tod_init()
   dynamic_tod_enable(true)
end

NOTE: See the lua reference from the SR3 SDK alpha tools for available commands:
https://www.saintsrowmods.com/Kinzies-Toy-Box/script_actions/_script_actions_index.html

STEP 4:
Package your new script and upload it as a workshop item

That's it! Easy, huh? Keep in mind that you want to make your script names as unique as possible so that they don't overwrite other modders' scripts that may have similar names (or be overwritten.)

NOTE: I've also attached the script itself for reference.
Hi Idol,
I would like to display this custom string in a mod with the mission_help_table.
I read the string tutorial already but it is relatet to the weapons clone stuff.
Please could you show how this would be coded?That would be very cool.
Thanks in advance
Edit:problem solved by @Henry08 . :)
 

Attachments

  • MSG_INFOPANEL_us.xml
    181 bytes · Views: 607
  • MSG_INFOPANEL_us.le_strings
    354 bytes · Views: 591
Last edited:
Back
Top