Page 1 of 1

Difference in Scripting Reference

Posted: Fri Oct 17, 2014 4:49 pm
by Siron2k
Is there any differnce in the Scription Reference (http://www.grimrock.net/modding_log1/sc ... reference/)?

I tried to reward a character with a small XP Bonus for an Action. I created a script and tried to call the character but all i receive is an error message.

Code: Select all

function finishedRiddle()
    party:getChampion(1):gainExp(100)
end
All i get is 'attempt to call method 'getChampion' (a Nil value)'.
It was working in Grimlock 1 but in Grimlock 2 it's not working anymore.

Did the function name change?

Re: Difference in Scripting Reference

Posted: Fri Oct 17, 2014 4:54 pm
by antti
A lot of things on the scripting side have changed. We're working on updating the modding guide and scripting reference

Re: Difference in Scripting Reference

Posted: Fri Oct 17, 2014 5:44 pm
by JohnWordsworth
With the component system, you need to also query for the specific component on an entity first. This is just a complete random post from work, but something like...

Code: Select all

party.party:getChampion(1):gainExp(100);
Might do it!

Re: Difference in Scripting Reference

Posted: Fri Oct 17, 2014 6:46 pm
by Doridion
Not sure, but as i seen in the dungeon.lua ( I'm actually manually converting some datas from LoG to LoG2 ) that most of item's option are coded in class form like :

Code: Select all

spawn("torch_holder",14,15,3,0,"torch_holder_1")
torch_holder_1.controller:setHasTorch(true)
spawn("tomb_stairs_down",15,13,0,0,"tomb_stairs_down_1")
tomb_stairs_down_1.stairs:setTeleportTarget(2,16,17,0)
So JohnWordsworth, I think it'll be more like :
party.champion:gainExp(100);
After all, we can look while AH implement the reference part of the website ^^

Re: Difference in Scripting Reference

Posted: Fri Oct 17, 2014 7:59 pm
by Siron2k
antti wrote:A lot of things on the scripting side have changed. We're working on updating the modding guide and scripting reference
good to know.
JohnWordsworth wrote:With the component system, you need to also query for the specific component on an entity first. This is just a complete random post from work, but something like...

Code: Select all

party.party:getChampion(1):gainExp(100);
Might do it!
Thanks John, your example is working

Re: Difference in Scripting Reference

Posted: Fri Oct 17, 2014 8:48 pm
by Jhaelen
antti wrote:A lot of things on the scripting side have changed. We're working on updating the modding guide and scripting reference
Great ! I'm already playing with the editor in order to create a mod ;-). I know, I should play the game before, but I can't fight with myself on this matter...

Do you have by any chance a release date for this updated guide ?