LOG 2 Scripting

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
User avatar
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

LOG 2 Scripting

Post by Mysterious » Thu Oct 16, 2014 11:03 pm

Hi guys I have created my first script in LOG 2 and took me awhile lol. Everything has changed so much that all the scripts from LOG 1, well most of them don't work anymore sad :(

Ok Script (Monster Spawn)

1 x Script Entity called: start
1 x floor trigger called: MonSpwn, connect to Script: function MonsSpawn1()
(Don't forget to click disableself on) and triggered buy party.

1 x Timer called: timer_1 (Connects to Script called: hello1() )
Here is something I found out about the timer under the title (components) unclick the (timer square) otherwise the timer will activate straight away for some reason. When the Monster dies the timer will activate.

1 x Door does not matter, but the door name must be the same in the script below. This can be changed to what name you want latter.

The Monster spawns on the 1st level in the game at the start. notice the (-1) this is because the Monster is spawned below floor level. (Check out Skuggs tutorial, it's spawned in the water section of the first level he created).

The coding has changed so much for monsters eg: The onDie hook can be added to normal Scripts, I added them to the Monster Object in LOG 1.

Code: Select all

function MonsSpawn1()

spawn("herder", 1,10,12,1,-1, "herder_2")
herder_2.monster:setAIState("guard")
herder_2.monster:setLevel(2)
spawn("rock",1,10,12,1,-1,"rock_3")
herder_2.monster:addItem(rock_3.item)
herder_2.monster:addConnector("onDie", "dungeon_door_wooden_1", "open")
herder_2.monster:addConnector("onDie", "timer_1", "start")
	end

--- Testing Code ---
function hello1()

hudPrint("hello")
playSound("level_up")
end
I hope this all makes sense to you :)

Post Reply