Page 1 of 2

Need "award EXP script"

Posted: Wed Oct 17, 2012 7:05 am
by imjodokast
I tried searching but I can't find a script to award experience points. Making a dungeon and I don't think It'll have much combat so I would like to award exp for solving puzzles and finding secrets. Scripting eludes me completely.

Re: Need "award EXP script"

Posted: Wed Oct 17, 2012 7:34 am
by Batty
All you need is:

Code: Select all

party:getChampion(slot):gainExp(amount)
slot is player #1-4

lots more in the reference:
http://www.grimrock.net/modding/scripting-reference/

Re: Need "award EXP script"

Posted: Wed Oct 17, 2012 7:59 am
by imjodokast
Yeah I keep looking the reference over, but I'm just completely lost when it comes to stringing things together. But thanks for that help. Now I just need to see how to make it stop awarding it each time my puzzles are done, or simply a one shot when stepping on a plate.

Re: Need "award EXP script"

Posted: Wed Oct 17, 2012 10:05 am
by Szragodesca
Being a similar coding newbie, I have trouble stringing things together myself. I'm more of a "chop-shop coder" since I haven't found any tutorials for any language that details more than one subject per tutorial. "In this tutorial we're going to cover Variables; next time, Lists!" you know? Nobody does a "Now that we've covered variables, lists, and for/while loops, I'll show you how to tie them together!" kind of tutorial.

You might try a "self.destroy" after awarding the XP, but I can't guarantee that's the correct code, or that it'll work. Like I said, coding newbie. :P

Re: Need "award EXP script"

Posted: Wed Oct 17, 2012 10:09 am
by Komag
I learn best from examples, so you might try working through a few of the basic scripts in the script repository, that will definitely help you get a better feel for how to tie things together

Re: Need "award EXP script"

Posted: Wed Oct 17, 2012 10:20 am
by Lollgramoth
Here is a beginnersguide, looks promising. Should be exactly what you asked for Szragodesca.

Re: Need "award EXP script"

Posted: Wed Oct 17, 2012 10:25 am
by Szragodesca
I'm not a book learner, I learn best through observation. I see something as it's done, whether it's explained or not, and as I see the actions taken to reach the final result my mind slips all the pieces into place. Looking at finished code (for me) is like looking at a finished game of Go and trying to figure out where they started and what was in the middle because, while the result works, it isn't as important as the path to reach it was. (Go is all about the strategy involved, not so much who won or lost as how they played the game. My brother's an addict. . . :roll: )

I'll try to get the asset pack while here at work tonight. . . it's too big for me to download at home until the weekend.

{Edit:} I'll give the guide a look-see Loll, thanks.

Re: Need "award EXP script"

Posted: Wed Oct 17, 2012 3:54 pm
by SpacialKatana
I fired this script for granting XP, for instance when a key is used to unlock a door etc.

I know it can be shortened with a loop, but in it's basic form it works fine, and you can easily change the figures to grant differing amounts to different chr.

Code: Select all

function exp1()
party:getChampion(1):gainExp(250)
party:getChampion(2):gainExp(250)
party:getChampion(3):gainExp(250)
party:getChampion(4):gainExp(250)
hudPrint("Progress Made : 250 XP Bonus")
playSound("secret")
end

Re: Need "award EXP script"

Posted: Wed Oct 17, 2012 4:17 pm
by Wolfrug

Code: Select all

for i=1,4 do  party:getChampion(i):gainExp(250)
-> All four champions get 250 xp. I love Lua code! It's so pretty. Except when I use it. Then it soon becomes ugly. :(

Re: Need "award EXP script"

Posted: Thu Oct 18, 2012 9:04 am
by msyblade
Wolfrugs is perfect. This is the complete script, hook it to whatever u like.

Code: Select all

function exp()   
  hudPrint ("Gained 250 exp.")
  for i=1,4 do
    party:getChampion(i):gainExp(250)
  end
end
(supposed to be an indent on the first "end", wont show in this format :(
(Komag - fixed code format)