Page 1 of 1

Help with the basics

Posted: Mon Mar 18, 2013 8:46 am
by Izy
Hi,

I'm new to the boards and also to modding. I was wondering if someone could point me in the right direction on how to set a few things up? Firstly, I've never done any scripting before so I'm learning that from scratch, and I've watched the tutorial videos done by Komag (which are awesome by the way).

In the retail game, it's possible to push a secret button which opens a door, plays a sound, and prints a message on the HUD. How would I go about scripting that since buttons don't really have an on or off state, and toggle just returns a nil value if used in the getState part of the code?

Also, how would I script a gem eye socket puzzle? I'm not after doing anything that requires custom gems, just using the stock ones and trying to make it work like the gem puzzle towards the end of level 1 in the retail version. Again, I've tried looking around on the forums but couldn't really find anything outside of how to make the socket accept only a specific custom gem. Would scripting be the answer or is it done through using a counter to increment/decrement when the gem is placed or removed?

What I'm trying to do in this is to understand how it's done in the retail release before I adapt it to something else.

Re: Help with the basics

Posted: Mon Mar 18, 2013 11:14 am
by alois
Hi Izy. To open a door, you should:

1) Place a script_entity somewhere on the map, and script it as follows:

Code: Select all

function pushedButton()
    my_door_to_open:open()
    playSound("gate_open") -- this may be omitted since the door already makes a noise while opening...
    hudPrint("You hear a door opening")
end
2) Place a secret button on the map (the asset is called "xxx_secret_button_yyy", where "xxx" is dungeon, or temple, or prison, and "yyy" is large, small or tiny);
3) Click on the button you just placed on the map, and then click on "Add Connector"; click on the script_entity; after doing so, in the 'connector' drop down menu the 'pushedButton' function should be selected (if it is not, select it!);
3bis - optional) Click on "Activate once" if you want the button to be one shot (i.e.: once opened, the door stays open);
4) Place a secret door on the map, and set its ID to "my_door_to_open".

That should do the trick :)

Keep in mind that if you do not need the message to be printed on screen, you could connect the button directly to the door (using the Connector), and there is no need for the door to be renamed.

alois :)

Re: Help with the basics

Posted: Mon Mar 18, 2013 11:25 am
by Numberouane
There is also this viewtopic.php?f=14&t=3240 gathering knowledge.

:)

Re: Help with the basics

Posted: Mon Mar 18, 2013 12:11 pm
by Komag
You might want to download the Grimrock Remake SOURCE to look at how the original dungeon works in the editor:
viewtopic.php?f=14&t=5154

For secrets all you do it put a secret and connect to it, nothing more (It's already set up to make the sound, print the "Secret Found" message, and only work once)

For the daemon eye puzzle, see the SOURCE to see exactly how to set it up :)

Re: Help with the basics

Posted: Mon Mar 18, 2013 12:17 pm
by Izy
Awesome, thanks for that guys. I'll be sure to give that a go when I get home tonight. Also, thanks for the info on the Source Komag, I didn't realise I could get my hands on that, it's really going to help me out a lot.

Like I said, I'm new to modding and scripting (only started on Saturday night really), but it's really good fun. The help is really appreciated.