Undocumented Lua functions?
Moderator: Moderators
- AnthonyBF2
- Sith

- Posts: 1255
- Joined: Wed Aug 21, 2013 3:55 pm
- Projects :: PS2+PSP Overhaul
Undocumented Lua functions?
As just about any one knows, On can be combined with lots of things to do different things, like OnCharacterSpawn or OnObjectDeath. I was digging around in the game executable and located some things that I did not find in the documentation. I am wondering if any one else has found these and attempted to do anything with them...
ScoreChange -- find when player's current point count change?
DeathsChange -- find when player's current death count changes?
KillsChange -- find when player's current kill count changes?
TargetChange -- when player locks on and changes target?
PlayerChange -- no idea
WeaponChange -- player changes weapons?
FlagReset -- flag goes back to home space
FlagPickUp -- flag gets grabbed
TeamPointsChange
TicketBleedChange
TicketCountChange
ScoreChange -- find when player's current point count change?
DeathsChange -- find when player's current death count changes?
KillsChange -- find when player's current kill count changes?
TargetChange -- when player locks on and changes target?
PlayerChange -- no idea
WeaponChange -- player changes weapons?
FlagReset -- flag goes back to home space
FlagPickUp -- flag gets grabbed
TeamPointsChange
TicketBleedChange
TicketCountChange
-
jedimoose32
- Field Commander

- Posts: 938
- Joined: Thu Jan 24, 2008 12:41 am
- Projects :: Engineering Degree
- Location: The Flatlands of Canada
Re: Undocumented Lua functions?
I have worked with FlagReset and FlagPickup. They are self-explanatory. I forget what the arguments are at the moment but you can find examples of them in the stock CTF scripts.
I browsed through the executable a long time ago and don't remember seeing KillsChange or DeathsChange... those sound very useful, if they are usable. I can't say I've ever seen them used in any of the scripts that shipped with the mod tools so maybe they aren't fully implemented... and even if they are I guess someone would have to play around with them to determine what their arguments are. Maybe I'll give that a try this afternoon.
I browsed through the executable a long time ago and don't remember seeing KillsChange or DeathsChange... those sound very useful, if they are usable. I can't say I've ever seen them used in any of the scripts that shipped with the mod tools so maybe they aren't fully implemented... and even if they are I guess someone would have to play around with them to determine what their arguments are. Maybe I'll give that a try this afternoon.
- Nedarb7
- Lieutenant General

- Posts: 676
- Joined: Sat Sep 22, 2012 3:41 pm
Re: Undocumented Lua functions?
If I recall correctly PlayerChange is when you swap classes; however, there may not be too many uses for it considering CharacterSpawn can be used for class swaps as well.
- AnthonyBF2
- Sith

- Posts: 1255
- Joined: Wed Aug 21, 2013 3:55 pm
- Projects :: PS2+PSP Overhaul
Re: Undocumented Lua functions?
Would you mind writing a quick use of PlayerChange? I may have a wonderful use for this but I suck bad at Lua.Nedarb7 wrote:If I recall correctly PlayerChange is when you swap classes; however, there may not be too many uses for it considering CharacterSpawn can be used for class swaps as well.
-
jedimoose32
- Field Commander

- Posts: 938
- Joined: Thu Jan 24, 2008 12:41 am
- Projects :: Engineering Degree
- Location: The Flatlands of Canada
Re: Undocumented Lua functions?
I highly recommend Zerted's Example Finder. That's how I check for usage of Lua functions I'm unfamiliar with.
- AnthonyBF2
- Sith

- Posts: 1255
- Joined: Wed Aug 21, 2013 3:55 pm
- Projects :: PS2+PSP Overhaul
Re: Undocumented Lua functions?
Says I need Java... -_-"
-
jedimoose32
- Field Commander

- Posts: 938
- Joined: Thu Jan 24, 2008 12:41 am
- Projects :: Engineering Degree
- Location: The Flatlands of Canada
Re: Undocumented Lua functions?
Congrats on your 500th post!
I'll check right now to see if I can find an example.
I'll check right now to see if I can find an example.
- AnthonyBF2
- Sith

- Posts: 1255
- Joined: Wed Aug 21, 2013 3:55 pm
- Projects :: PS2+PSP Overhaul
Re: Undocumented Lua functions?
Sorry but I am on my phone hotspot that is 25kbs... Not going to be updating anything until I pay my next phone bill to reset data.
-
jedimoose32
- Field Commander

- Posts: 938
- Joined: Thu Jan 24, 2008 12:41 am
- Projects :: Engineering Degree
- Location: The Flatlands of Canada
Re: Undocumented Lua functions?
Fair enough.
Well unfortunately I was unable to find any examples of how the function is used.
Well unfortunately I was unable to find any examples of how the function is used.
- AnthonyBF2
- Sith

- Posts: 1255
- Joined: Wed Aug 21, 2013 3:55 pm
- Projects :: PS2+PSP Overhaul
Re: Undocumented Lua functions?
Thanks anyway. I'll fool around with it later on my own.
EDIT: Failed.
I used:
And the debugger cries:
EDIT: Failed.
I used:
Code: Select all
OnPlayerChange(function(player)
if GetCharacterUnit(player) and
IsCharacterHuman(player) then
KillObject(GetCharacterUnit(player))
end
end
)Code: Select all
Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to call global `OnPlayerChange' (a nil value)
stack traceback:
(none): in function `ScriptPostLoad'