SRTT Lua Scripting - Events/Hooks

Hey,

First of all, I am a big fan of the Saints Row series (SR2 is still the best imho, too bad the PC version is a lousy port).

Anyways.... I read about Volition going to help the modding community, and immediatly I got psyched.
And then I read that SRTT actually uses Lua as a scripting language, which got me even more psyched as I've got alot of Lua experience.

In the pre-alpha SDK release (Or whatever you want to call it), I only found a (massive) list of Lua functions.

But I found no events, or ways to create hooks..
So is there any list for those, with some extra information as to how SRTT expects these events to be linked to a Lua function?

I was also wondering if we are going to get some small extra page of information that explains how Saints Row 3 handles Lua in general (Like any abnormalities compared to how most software use Lua).

Regards,
Some Lua scripter that absolutely can't wait to start scripting for SRTT.
 
Generally all the event hooks take the form of a function call to something starting with "on_": on_trigger, on_damage, on_killed, etc. They take the name of a function and possibly other parameters. When the event occurs the function is called with some additional parameters depending on what the event is. All the specific information for each callback should be documented in the SDK.
 
Thanks for the fast answer!

So a simple script like...

Code:
function customKillEvent(deathString)
  outputText(deathString) --I know this function doesn't exist.
end

function on_death(victim,attacker)
  local deathString = "Kill: "..attacker.." killed "..victim.."!"
  customKillEvent(deathString)
end
Lets say the function outputText existed, would this code work with saints row 3?
 
on_death is a function itself which registers another function when someone dies and after it executes,2 parameters(victim first and then the attacker) are entering in the function registered by on_death which is in case kill_register().

Example:

Code:
function customKillEvent(deathString)
  outputText(deathString) --I know this function doesn't exist.
end

function kill_register(victim,attacker)
  local deathString = "Kill: "..attacker.." killed "..victim.."!"
  customKillEvent(deathString)
end

on_death("kill_register",victim)

Don't know if it's 100% correct still.
 
on_death is a function itself which registers another function when someone dies and after it executes,2 parameters(victim first and then the attacker) are entering in the function registered by on_death which is in case kill_register().

Example:

Code:
function customKillEvent(deathString)
  outputText(deathString) --I know this function doesn't exist.
end

function kill_register(victim,attacker)
  local deathString = "Kill: "..attacker.." killed "..victim.."!"
  customKillEvent(deathString)
end

on_death("kill_register",victim)

Don't know if it's 100% correct still.
Ah, now I get it!
Thanks mate.
 
I didn't explain it very well in the previous post because I was in a rush...

To be more precise and clear you can name the function that gets called by on_death what ever the hell you want as long as the function's name is the same as the one that gets called by on_death.It can be pretty much like this:

Code:
function bitch_killed(prey,hunter) -- Keep in mind that the first parameter is the name of the npc that gets killed and the second one is the killer
blah blah
end

on_death("bitch_killed",the_victim) -- Keep in mind that the second parameter is the victim here

Good luck !
 
Back
Top