Difference in Scripting Reference

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
Siron2k
Posts: 2
Joined: Fri Oct 17, 2014 4:37 pm

Difference in Scripting Reference

Post by Siron2k » Fri Oct 17, 2014 4:49 pm

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?

User avatar
antti
Posts: 685
Joined: Thu Feb 23, 2012 1:43 pm
Location: Espoo, Finland
Contact:

Re: Difference in Scripting Reference

Post by antti » Fri Oct 17, 2014 4:54 pm

A lot of things on the scripting side have changed. We're working on updating the modding guide and scripting reference
Steven Seagal of gaming industry

User avatar
JohnWordsworth
Posts: 1387
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: Difference in Scripting Reference

Post by JohnWordsworth » Fri Oct 17, 2014 5:44 pm

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!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.

User avatar
Doridion
Posts: 256
Joined: Tue Jun 10, 2014 9:23 pm

Re: Difference in Scripting Reference

Post by Doridion » Fri Oct 17, 2014 6:46 pm

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 ^^

Siron2k
Posts: 2
Joined: Fri Oct 17, 2014 4:37 pm

Re: Difference in Scripting Reference

Post by Siron2k » Fri Oct 17, 2014 7:59 pm

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

User avatar
Jhaelen
Posts: 74
Joined: Fri Oct 19, 2012 10:49 am
Location: Paris, France

Re: Difference in Scripting Reference

Post by Jhaelen » Fri Oct 17, 2014 8:48 pm

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 ?

Post Reply