Page 1 of 1

Why does this script crash the game

Posted: Sat Mar 02, 2013 4:31 pm
by hades200082
When the script below executes it crashes the game in the editor preview ... no warnings/errors .. just stops.

I'm probably missing something really obvious here but I just can't see why it's crashing. Any help is appreciated.

Code: Select all

function AwardXp(XpToAward)
	XpToAward = math.floor((XpToAward / 4) + 0.5)
	party:getChampion(1):gainExp(XpToAward)
	party:getChampion(2):gainExp(XpToAward)
	party:getChampion(3):gainExp(XpToAward)
	party:getChampion(4):gainExp(XpToAward)
end
Level = 2
XP = 100 * Level
AwardXP(XP)
Edit: Just to note... the AwardXp function works when used elsewhere.

Re: Why does this script crash the game

Posted: Sat Mar 02, 2013 4:43 pm
by Neikun
Is your end in the wrong place?

Re: Why does this script crash the game

Posted: Sat Mar 02, 2013 5:15 pm
by Vice Dellos
should it maybe be "local level = 2"?

Re: Why does this script crash the game

Posted: Sat Mar 02, 2013 6:17 pm
by Xanathar
I didn't try.
But I would bet my 1€ on "AwardXP" - that is, the P in AwardXp is written once lower-case and the other upper-case. I wouldn't bet more than 1€ though ;)

Re: Why does this script crash the game

Posted: Sat Mar 02, 2013 6:33 pm
by Vice Dellos
ugh I hate having to watch caps

Re: Why does this script crash the game

Posted: Sat Mar 02, 2013 8:05 pm
by hades200082
Xanathar wrote:I didn't try.
But I would bet my 1€ on "AwardXP" - that is, the P in AwardXp is written once lower-case and the other upper-case. I wouldn't bet more than 1€ though ;)
That was it! Ugh that sucked up hours!

Thank you so much for helping. Thanks to all the others that replied too. I never fail to be amazed by how helpful this community is :)