Page 1 of 1
Is there a way to retrieve Exp
Posted: Mon Dec 31, 2012 2:46 pm
by xbdj
I need a function like getExp
But I only see getLevel f.ex.
I want to find the character in the party with the least experience points...any suggestions?
Re: Is there a way to retrieve Exp
Posted: Mon Dec 31, 2012 11:59 pm
by Drakkan
I suppose you know function below or I understood you incorectly ? To search min exp person is too complicated for me sory
-- XP gain for all members + text and music
function xpaward()
party:getChampion(1):gainExp(50)
party:getChampion(2):gainExp(50)
party:getChampion(3):gainExp(50)
party:getChampion(4):gainExp(50)
hudPrint("You have discovered Secret. 50xp gained !")
playSound("secret")
end
Re: Is there a way to retrieve Exp
Posted: Tue Jan 01, 2013 3:08 pm
by xbdj
Yeah - I want to give some exp to the one with the lowest amount
For now I can only check for level, so it doesnt do exactly what I want
Code: Select all
function secretLevel()
minLevel = 9999
for i = 1,4 do
print(party:getChampion(i):getLevel())
if party:getChampion(i):getLevel() <= minLevel then
minLevel = party:getChampion(i):getLevel()
luckyChamp = i
end
end
party:getChampion(luckyChamp):gainExp(200+100*minLevel)
playSound("level_up")
hudPrint(party:getChampion(luckyChamp):getName().." gained "..200+100*minLevel.." exp")
--party:getChampion(luckyChamp):getExp()
timer_1:deactivate()
timer_1:setTimerInterval(1)
end
For now it gives exp to the character with the lowest level, and if more have the same level it gives to the last character (as I use "<=" and not just "<"), depending on their placement number:
1 2
3 4
Re: Is there a way to retrieve Exp
Posted: Tue Jan 29, 2013 10:18 pm
by wolfee
Drakkan wrote:I suppose you know function below or I understood you incorectly ? To search min exp person is too complicated for me sory
-- XP gain for all members + text and music
function xpaward()
party:getChampion(1):gainExp(50)
party:getChampion(2):gainExp(50)
party:getChampion(3):gainExp(50)
party:getChampion(4):gainExp(50)
hudPrint("You have discovered Secret. 50xp gained !")
playSound("secret")
end
Does a "secret" grant experience? I know in a modded game I played, it did but does it grant experience by default? If not, how would I add something like this function to the discovery of a secret? The "secret" in the dropdown for 'logic' doesn't have anywhere to add a function. I was going to try the cloneobject but not sure how to do it. Thanks for any help.
Re: Is there a way to retrieve Exp
Posted: Tue Jan 29, 2013 10:30 pm
by Komag
You would have to set it up yourself for each secret, not by editing anything with the "secret" directly but just by having the same hidden pressure plate (or whatever triggers the secret) also trigger your script to add the XP (and maybe a hudPrint message about it)
Re: Is there a way to retrieve Exp
Posted: Tue Jan 29, 2013 11:44 pm
by msyblade
and when u add the exp script (Drakkan's above works just fine, u can change the amount, or the hudPrint), make sure the trigger only activates once, or is connected to a counter set to 1 to trigger the script, or you will have an unlimited exp loop. Also, the script can be triggered from multiple connectors, so you do not need to make dozens of them.