LUA Problem (Solved)

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
Aman/Pinguin
Jedi
Jedi
Posts: 1104
Joined: Tue Jan 30, 2007 6:04 am
Projects :: Inactive
Location: Germany

LUA Problem (Solved)

Post by Aman/Pinguin »

Error Message:

Code: Select all

Message Severity: 3
C:\Battlefront2\main\Battlefront2\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to perform arithmetic on a function value
stack traceback:
	(none): in function `ScriptPostLoad'
Function:

Code: Select all

OnCharacterChangeClass(
	-function(player)
			if StopEEUnits == true then
				print("StopEEUnits is working!")

				if GetCharacterClass(player)  == 8 and GetCharacterTeam(player) == 2 then
				print("haha_inf_penguin check is working!")
					AddReinforcements(CIS, 1 )
					KillObject( GetCharacterUnit(player) )
					SelectCharacterClass(player, "cis_inf_trooper")
					SpawnCharacter(player, GetPathPoint("penguin_spawn", 0))

				elseif GetCharacterClass(player)  == 8 and GetCharacterTeam(player) == 1 then
					AddReinforcements(REP, 1 )
					KillObject( GetCharacterUnit(player) )
					SelectCharacterClass(player, "rep_inf_ep3_rifleman")
					SpawnCharacter(player, GetPathPoint("golem_spawn", 0))
				end
			elseif StopEEUnits == false then return
			end
	end
			)
Problem is that the whole function isn't running, but I guess that's because of that error message.
So, is there anything wrong? Yes StopEEUnits is true when I try to test it. (It becomes true as a result of an event)

The function is located in ScriptPostLoad() below conquest:Start().
If you need any other information just tell me and I will post it.
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 Problem

Post by [RDH]Zerted »

You cannot take the negative of a function. What would that even be? Check your second line.
Aman/Pinguin
Jedi
Jedi
Posts: 1104
Joined: Tue Jan 30, 2007 6:04 am
Projects :: Inactive
Location: Germany

Re: LUA Problem

Post by Aman/Pinguin »

Oh! Didn't notice that... how did that come there. Rofl. Typo I guess... thanks.
Post Reply