Need "award EXP script"

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
imjodokast
Posts: 3
Joined: Wed Oct 17, 2012 6:59 am

Need "award EXP script"

Post 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.
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Need "award EXP script"

Post 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/
imjodokast
Posts: 3
Joined: Wed Oct 17, 2012 6:59 am

Re: Need "award EXP script"

Post 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.
Szragodesca
Posts: 59
Joined: Sun Oct 14, 2012 7:13 am

Re: Need "award EXP script"

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

Re: Need "award EXP script"

Post 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
Finished Dungeons - complete mods to play
Lollgramoth
Posts: 35
Joined: Fri Jun 15, 2012 7:31 am
Location: Germany

Re: Need "award EXP script"

Post by Lollgramoth »

Here is a beginnersguide, looks promising. Should be exactly what you asked for Szragodesca.
Szragodesca
Posts: 59
Joined: Sun Oct 14, 2012 7:13 am

Re: Need "award EXP script"

Post 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.
SpacialKatana
Posts: 163
Joined: Fri Sep 14, 2012 6:20 pm

Re: Need "award EXP script"

Post 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
User avatar
Wolfrug
Posts: 55
Joined: Wed Oct 03, 2012 6:56 pm

Re: Need "award EXP script"

Post 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. :(
Try my Mordor: Depths of Dejenol LoG-ification. Feedback much appreciated!
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: Need "award EXP script"

Post 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)
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