LUA questions

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

LUA questions

Post by myers73 »

anyone know how to remove a weapon that a unit has via LUA. that is to say, like remove force from a jedi...i know how to change it to something different, not how to remove one
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: LUA questions

Post by Teancum »

Well, you could always set the values in that weapon to zero using SetProperty(). That would nullify the ability to force push/pull/choke/throw saber.
User avatar
eliminator
Second Lance Corporal
Second Lance Corporal
Posts: 118
Joined: Wed Aug 19, 2009 3:39 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Germany

Re: LUA questions

Post by eliminator »

why don't you make a force that doesn't do anything and change it then to it?
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: LUA questions

Post by myers73 »

Teancum wrote:Well, you could always set the values in that weapon to zero using SetProperty(). That would nullify the ability to force push/pull/choke/throw saber.
that would work, thanks. so I set it up like this?: SetProperty( "charactername", "Property", #) where # is the new value?
eliminator wrote:why don't you make a force that doesn't do anything and change it then to it?
that would work for a mod map, but would crash what i am trying to do.

EDIT: i think it would be SetProperty(weap_name, "variable_to_change, #) is t
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: LUA questions

Post by Fiodis »

Tean - I thought you couldn't edit weapons via lua?
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: LUA questions

Post by myers73 »

another question... what is the function for killing someone via lua, also to force spawn them would also be nice. basically i want to detect who they spawned as, and if it is the wrong unit kill and respawn them as the correct unit


EDIT
I have never really worked with timers. could someone please post a basic timer setup, ie when the map starts start the timer and when the time runs out end map? thanks in advance
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: LUA questions

Post by kinetosimpetus »

see hoth campaign script, it uses a timer just like that.
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: LUA questions

Post by myers73 »

^^ thanks, now would you know how to kill and respawn a player?

From Other Topic:
so i am attempting to kill someone when they spawn as hansolo. I didnt know the kill function, so i tried to set the health to zero. I am new to lua, so dont know if i did this right, please help.
Hidden/Spoiler:
[code]OnCharacterSpawn(
function(player)
if GetEntityClassName(GetCharacterUnit(player)) == all_hero_hansolo_tat then
then SetProperty(all_hero_hansolo_tat, "MaxHealth", 0)
end
end
end
)
[/code]
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: LUA questions

Post by [RDH]Zerted »

You would want to use CurHealth instead of MaxHealth, but KillObject() on the character's unit is simpler.

If GetEntityClassName() returns the class name and not the class ID number, then all_hero_hansolo_tat should be in quotes because it's a string. If that function returns the ID, then all_hero_hansolo_tat should be changed to that unit's ID number.

You have one two many thens.

Forced spawning has been posted a bunch of times to GT. It uses the SelectCharacter() and SpawnCharacter() functions. Search on GT or look at the ambush script.

You can't change weapon properties using SetProperty(). You can change which weapon a unit has in which weapon slot (that is changing a unit property not a weapon property), but those types of changes cause crashes in MP.
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: LUA questions

Post by myers73 »

so would this work?
Hidden/Spoiler:
[code]
OnCharacterSpawn(
function(player)
if GetEntityClassName(GetCharacterUnit(player)) == "all_hero_hansolo_tat" then
KillObject( "all_hero_hansolo_tat" )
end
if GetEntityClassName(GetCharacterUnit(player)) == "all_hero_leia" then
KillObject( "all_hero_leia" )
end
if GetEntityClassName(GetCharacterUnit(player)) == "all_hero_chewbacca" then
KillObject( "all_hero_chewbacca" )
end
if GetEntityClassName(GetCharacterUnit(player)) == "imp_hero_bobafett" then
KillObject( "imp_hero_bobafett" )
end
if GetEntityClassName(GetCharacterUnit(player)) == "cis_hero_jangofett" then
KillObject( "cis_hero_jangofett" )
end
end
end
)

[/code]
also, my timer istn working. it shows up, but never actually starts counting, it just stays at 15:00
Hidden/Spoiler:
[code]
timeoutTimer = CreateTimer("timeout")
SetTimerValue(timeoutTimer, 900)
ShowTimer(timeoutTimer)

OnTimerElapse(
function(timer)
MissionVictory(DEF)
ShowTimer(true)
DestroyTimer(timer)
end,
timeoutTimer
)
[/code]
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: LUA questions

Post by Fiodis »

I believe you need StartTimer("timeout") in there somewhere.

As for your killing thing, no. You need unit = GetCharacterUnit(player) and KillObject(unit). Or something like that; you need to kill the player's unit.
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: LUA questions

Post by myers73 »

Fiodis wrote:I believe you need StartTimer("timeout") in there somewhere.
duh *facepalm* my bad, but thanks a bunch anyway
Fiodis wrote:As for your killing thing, no. You need unit = GetCharacterUnit(player) and KillObject(unit). Or something like that; you need to kill the player's unit.
im guessing this goes right after function(player) ?


EDIT
so this is what i did, the time is working fine now (thanks), but the killing people isnt, i think its being ignored.
Hidden/Spoiler:
[code]
timeoutTimer = CreateTimer("timeout")
SetTimerValue(timeoutTimer, 600)
ShowTimer(timeoutTimer)
StartTimer("timeout")

OnTimerElapse(
function(timer)
MissionVictory(DEF)
ShowTimer(true)
DestroyTimer(timer)
end,
timeoutTimer
)
OnCharacterSpawn(
function(player)
unit1 = GetCharacterUnit(player)
if GetEntityClassName(GetCharacterUnit(player)) == "all_hero_hansolo_tat" then
KillObject(unit1)
end
unit2 = GetCharacterUnit(player)
if GetEntityClassName(GetCharacterUnit(player)) == "all_hero_leia" then
KillObject(unit2)
end
unit3 = GetCharacterUnit(player)
if GetEntityClassName(GetCharacterUnit(player)) == "all_hero_chewbacca" then
KillObject(unit3)
end
unit4 = GetCharacterUnit(player)
if GetEntityClassName(GetCharacterUnit(player)) == "imp_hero_bobafett" then
KillObject(unit4)
end
unit5 = GetCharacterUnit(player)
if GetEntityClassName(GetCharacterUnit(player)) == "cis_hero_jangofett" then
KillObject(unit5)
end
end
)

[/code]
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: LUA questions

Post by Fiodis »

You only need 1 GetCharacterUnit.
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: LUA questions

Post by myers73 »

it still is being ignored
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: LUA questions

Post by [RDH]Zerted »

Toss in a print("Player unit class is:, GetEntityClassName(unit)) after the local unit = GetCharacterUnit(player) line and check the debug log to review the output.
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: LUA questions

Post by myers73 »

here is the debug log, iv pulled out what seems to be the important parts, it was too big to post the whole thing
Hidden/Spoiler:
user_script_2: Entered
user_script_2: Taking control of ScriptPostLoad()...
user_script_2: Have control of ScriptPostLoad()
user_script_2: Exited
and this
Hidden/Spoiler:
Message Severity: 2
.\Source\LuaCallbacks_Mission.cpp(635)
Entity "CP6" not found
user_script_1: ScriptPostLoad(): Exited
ifs_sideselect_fnEnter(): Map does not support custom era teams
ifs_sideselect_fnEnter(): The award settings file does not exist
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
death region added
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
death region removed
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)

Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "Aimer" is full; raise count to at least 1

Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "Aimer" is full; raise count to at least 2
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)

Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "Weapon" is full; raise count to at least 201

Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "AmmoCounter" is full; raise count to at least 203

Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "EnergyBar" is full; raise count to at least 206

Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "Weapon" is full; raise count to at least 202

Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "Weapon" is full; raise count to at least 203

Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "Weapon" is full; raise count to at least 204

Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "AmmoCounter" is full; raise count to at least 206

Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "Weapon" is full; raise count to at least 205
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
death region added
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
death region removed
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
death region added
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
death region removed
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
death region added
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
EDIT: so i cleaned the log and then replayed the map to get one without extra stuff...
Hidden/Spoiler:
Opened logfile BFront2.log 2009-11-17 1621
...
the usual stuff
...
game_interface: Entered
utility_functions2: Listening on AddUnitClass() calls
utility_functions2: Listening on SetHeroClass() calls
utility_functions2: Listening on ReadDataFile() calls
game_interface: Reading in custom strings
game_interface: No user_script_0.lvl
game_interface: No user_script_1.lvl
game_interface: Found user_script_2.lvl
user_script_2: Entered
user_script_2: Taking control of ScriptPostLoad()...
user_script_1: Have control of ScriptPostLoad()
user_script_2: Exited
game_interface: No user_script_3.lvl
game_interface: No user_script_4.lvl
game_interface: No user_script_5.lvl
game_interface: No user_script_6.lvl
game_interface: No user_script_7.lvl
game_interface: No user_script_8.lvl
game_interface: No user_script_9.lvl
game_interface: No user_script_10.lvl
ifs_sideselect_fnBuildScreen()
game_interface: Exited

...
random severity 2s about particle memory pools
...
Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "ParticleTransformer::ColorTrans" is full; raise count to at least 1588
uf_updateClassIndex(): Added class: all_hero_hansolo_tat
uf_updateClassIndex(): Added class: all_hero_chewbacca
uf_updateClassIndex(): Added class: rep_hero_obiwan
uf_updateClassIndex(): Added class: all_hero_luke_jedi
uf_updateClassIndex(): Added class: rep_hero_yoda
uf_updateClassIndex(): Added class: rep_hero_macewindu
uf_updateClassIndex(): Added class: all_hero_leia
uf_updateClassIndex(): Added class: rep_hero_aalya
uf_updateClassIndex(): Added class: rep_hero_kiyadimundi
uf_updateClassIndex(): Added class: imp_hero_bobafett
uf_updateClassIndex(): Added class: imp_hero_darthvader
uf_updateClassIndex(): Added class: cis_hero_jangofett
uf_updateClassIndex(): Added class: cis_hero_darthmaul
uf_updateClassIndex(): Added class: cis_hero_grievous
uf_updateClassIndex(): Added class: imp_hero_emperor
uf_updateClassIndex(): Added class: rep_hero_anakin
uf_updateClassIndex(): Added class: cis_hero_countdooku
utility_functions2: ReadDataFile(): This map's code, mode: tat tat2_tdm

...
random severity 2s about renaming buildings
...

user_script_2: ScriptPostLoad(): Entered
fakeconsole_functions: AddCommand: Not adding command: Unlock Vehicles
fakeconsole_functions: AddCommand: Not adding command: Force No Views
fakeconsole_functions: AddCommand: Not adding command: Allow CP Capture
fakeconsole_functions: AddCommand: Not adding command: Not Immune To Mines
fakeconsole_functions: AddCommand: Not adding command: Disable Tumble Recovery
fakeconsole_functions: AddCommand: Not adding command: Allow AI Spawn 1
fakeconsole_functions: AddCommand: Not adding command: Allow AI Spawn 2
fakeconsole_functions: AddCommand: Not adding command: Team Auto-assign On
fakeconsole_functions: AddCommand: Not adding command: Heros SP Rules Off
fakeconsole_functions: AddCommand: Not adding command: Heros SP Scripted Off
fakeconsole_functions: AddCommand: Not adding command: Menu Sounds On
fakeconsole_functions: AddCommand: Not adding command: No Flee Just Die
fakeconsole_functions: AddCommand: Not adding command: Restore Award Effects
fakeconsole_functions: AddCommand: Not adding command: Allow Victory
fakeconsole_functions: AddCommand: Not adding command: AI AutoBalance Off
fakeconsole_functions: AddCommand: Not adding command: AI BlindJetJumps Off
fakeconsole_functions: AddCommand: Not adding command: Hide Team Points
fakeconsole_functions: AddCommand: Not adding command: Remove JetPacks
user_script_1: ScriptPostLoad(): Exited
ifs_sideselect_fnEnter(): Map does not support custom era teams
ifs_sideselect_fnEnter(): The award settings file does not exist
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)

Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "UnitController" is full; raise count to at least 24
Player unit class is:, GetEntityClassName(unit)

Message Severity: 2
.\Memory\RedMemoryPool.cpp(170)
Memory pool "UnitAgent" is full; raise count to at least 24
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
Player unit class is:, GetEntityClassName(unit)
shell_interface: Entered
shell_interface: gPlatformStr, gOnlineServiceStr, gLangStr, gLangEnum: PC GameSpy english 0
ifs_era_handler - Entered
ifs_era_handler - Exited
shell_interface: No custom_gc_0.lvl
shell_interface: No custom_gc_1.lvl
shell_interface: No custom_gc_2.lvl
shell_interface: No custom_gc_3.lvl
shell_interface: No custom_gc_4.lvl
shell_interface: No custom_gc_5.lvl
shell_interface: No custom_gc_6.lvl
shell_interface: No custom_gc_7.lvl
shell_interface: No custom_gc_8.lvl
shell_interface: No custom_gc_9.lvl
shell_interface: No custom_gc_10.lvl
custom_EraButtonList(): Finished building era button table Known eras buttons: 28
custom_GetGMapEras(): Finished building era table Known eras: 28
custom_GetGMapModes(): Finished building game mode table Known Modes: 39
custom_GetMPGameModeList(): Finished building game mode list table List Length: 40
custom_SetMovieLocation()
custom_GetGCButtonList()
custom_SetMovieLocation()
custom_GetFreeformBattleModeList(): Finished building freeform battle mode list Known Modes: 39
ingame stream movies\crawl.mvs
shell_interface: Opening movie: movies\shell.mvs
shell_interface: Leaving
Found side\rvs.lvl. Adding BRO's extra KotOR missions
Cannot find ..\..\addon\BDT\data\_LVL_PC\SIDE\dark.lvl. Skipping BRO's extra Dark Times missions
ifs_legal.Exit

Message Severity: 2
.\Source\GameMovie.cpp(399)
Unable to find open movie segment shell_main

ifs_sp_campaign: Input_Accept(): Entered: _tab_quit

EDIT2
sry to double post, but the last post was full.

this seems to not work in my user script ff_healthRegen( 100, "humans" ), any clue why.
also when i use this SetClassProperty("all_hero_hansolo_tat", MaxHealth, 5) in my user script it is being ignored, and when i use it everything that comes after it is ignored... very odd
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: LUA questions

Post by [RDH]Zerted »

Oh, I forgot a ". Here is the code

Code: Select all

OnCharacterSpawn(
   function(player)
      local unit = GetCharacterUnit(player)
      local name = GetEntityClassName(unit)

      print("Spawned a character unit with the entity class name:", name)

      if name == "all_hero_hansolo_tat" then
         KillObject(unit)
      elseif name == "all_hero_leia" then
         KillObject(unit)
      elseif name == "all_hero_chewbacca" then
         KillObject(unit)
      elseif name == "imp_hero_bobafett" then
         KillObject(unit)
      elseif name == "cis_hero_jangofett" then
         KillObject(unit)
      end
   end
)
You could also reduce the if/elseif statements into one if statement using ors.

You need to understand the difference between variables and strings. SetClassProperty("all_hero_hansolo_tat", MaxHealth, 5) is wrong. In that code, MaxHealth is a variable which contains nil unless you set it to something else using MaxHealth =. What you want is the string MaxHealth which is "MaxHealth" (with quotes).
myers73
Lieutenant General
Lieutenant General
Posts: 690
Joined: Fri Apr 03, 2009 11:04 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Atlanta, GA xfire=myers73 IngameName=mYers

Re: LUA questions

Post by myers73 »

ok, all of that makes sense.
Post Reply