Run a script automatically when the game starts?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Starnice
Posts: 13
Joined: Thu Sep 13, 2012 7:08 pm
Contact:

Run a script automatically when the game starts?

Post by Starnice »

To equip the team or delete a champion, etc.

I tried in init.lua, but it does not work.

An idea?

:?:
Magus
Posts: 56
Joined: Wed Sep 12, 2012 6:05 pm

Re: Run a script automatically when the game starts?

Post by Magus »

simply add a lua code without making it a function.
Or call itself for example:

Code: Select all

function exampleLua()
   print("This code runs once.")
end
exampleLua()
User avatar
Starnice
Posts: 13
Joined: Thu Sep 13, 2012 7:08 pm
Contact:

Re: Run a script automatically when the game starts?

Post by Starnice »

Thank You!!! :o
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Run a script automatically when the game starts?

Post by Komag »

does that need another "end" on it? (I'm not able to test it right now)
Finished Dungeons - complete mods to play
Magus
Posts: 56
Joined: Wed Sep 12, 2012 6:05 pm

Re: Run a script automatically when the game starts?

Post by Magus »

end for what?
The exampleLua() just calls the function after the lua runs(basically after the map loads).
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Run a script automatically when the game starts?

Post by Komag »

I thought the code needed another "end" at the end, after exampleLua(), but it doesn't after all. I'm no programmer, I just copy, paste, and extrapolate a little here and there :)
Finished Dungeons - complete mods to play
Post Reply