Page 1 of 1

LUA Problem (Solved)

Posted: Mon Sep 29, 2008 12:35 pm
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.

Re: LUA Problem

Posted: Mon Sep 29, 2008 1:31 pm
by [RDH]Zerted
You cannot take the negative of a function. What would that even be? Check your second line.

Re: LUA Problem

Posted: Mon Sep 29, 2008 1:37 pm
by Aman/Pinguin
Oh! Didn't notice that... how did that come there. Rofl. Typo I guess... thanks.