Is there a way to retrieve Exp

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
xbdj
Posts: 32
Joined: Sun Dec 30, 2012 7:43 pm

Is there a way to retrieve Exp

Post 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?
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Is there a way to retrieve Exp

Post 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
Breath from the unpromising waters.
Eye of the Atlantis
xbdj
Posts: 32
Joined: Sun Dec 30, 2012 7:43 pm

Re: Is there a way to retrieve Exp

Post 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
wolfee
Posts: 12
Joined: Thu Jan 24, 2013 1:20 pm

Re: Is there a way to retrieve Exp

Post 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.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Is there a way to retrieve Exp

Post 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)
Finished Dungeons - complete mods to play
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: Is there a way to retrieve Exp

Post 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.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Post Reply