Scripts help

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Scripts help

Post by Drakkan »

Hello everybody,
I started using editor, however I am total loser using scripts (no lua knowledge at all)

If somebody can help me, I need to do following

1. when I place "note" in the alcove, where and how I can define what will be typed in the note ?
SOLVED
2. It is possible to script somehow that object "spawner" (creature) will drop some item after killing ?
EDIT: solved for single monster. However still not working for group of single monsters (like skeleton_patrol)

thats all for now, thanks
Last edited by Drakkan on Mon Dec 31, 2012 1:58 am, edited 1 time in total.
Breath from the unpromising waters.
Eye of the Atlantis
xbdj
Posts: 32
Joined: Sun Dec 30, 2012 7:43 pm

Re: Scripts help

Post by xbdj »

Edit:

Sorry Drakkan - misunderstood your question, I think... :oops:
Last edited by xbdj on Mon Dec 31, 2012 1:08 am, edited 1 time in total.
User avatar
Sutekh
Posts: 129
Joined: Sun Nov 25, 2012 9:58 am
Location: UK

Re: Scripts help

Post by Sutekh »

http://www.grimrock.net/modding/how-to- ... an-alcove/

Works with notes as well as scrolls. ;)
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: Scripts help

Post by msyblade »

for text in an alcove use this code in a script entity:

Code: Select all

local message = spawn("scroll")
message:setScrollText("The treasures must be returned to gain access\n Start here, but beware.\nif you begin and do not have all 4 keys\nYour soul will be ripped apart, forever lost.")
dta_1:addItem(message)
Change the dta_1 line to whatever you've named your alcove. and change the text to whatever u need. the "\n"s are line breaks.

For the item drop, simply select the monster and on the right side, click on the little box and start to type something. it works like the asset browser (or an alcove, even), make sure to click "add" or it will not appear.

Hope those help
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Scripts help

Post by Drakkan »

Sutekh wrote:http://www.grimrock.net/modding/how-to- ... an-alcove/

Works with notes as well as scrolls. ;)
Great ! Thats for the Notes. Any ideas how to add items to Spawner monster ?
msyblade wrote:for text in an alcove use this code in a script entity:

Code: Select all

local message = spawn("scroll")
message:setScrollText("The treasures must be returned to gain access\n Start here, but beware.\nif you begin and do not have all 4 keys\nYour soul will be ripped apart, forever lost.")
dta_1:addItem(message)
Change the dta_1 line to whatever you've named your alcove. and change the text to whatever u need. the "\n"s are line breaks.

For the item drop, simply select the monster and on the right side, click on the little box and start to type something. it works like the asset browser (or an alcove, even), make sure to click "add" or it will not appear.

Hope those help
thanks man, but this is working jsut for regular creatures. When editing spawner, there is no item option :/
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Scripts help

Post by Drakkan »

msyblade wrote:for text in an alcove use this code in a script entity:

Code: Select all

local message = spawn("scroll")
message:setScrollText("The treasures must be returned to gain access\n Start here, but beware.\nif you begin and do not have all 4 keys\nYour soul will be ripped apart, forever lost.")
dta_1:addItem(message)
Change the dta_1 line to whatever you've named your alcove. and change the text to whatever u need. the "\n"s are line breaks.

For the item drop, simply select the monster and on the right side, click on the little box and start to type something. it works like the asset browser (or an alcove, even), make sure to click "add" or it will not appear.

Hope those help
working fine for alcoves, thanks. However still do not know hot to add items for Spawned creatures
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
Sutekh
Posts: 129
Joined: Sun Nov 25, 2012 9:58 am
Location: UK

Re: Scripts help

Post by Sutekh »

Hmm, not sure about adding items to a spawned monster, but you can do it another way:

Create a single square 'room' separate from the rest of your dungeon, then place a teleporter in that square and set it as inactive. Set the teleporter's target to the place you want the monster to 'spawn'. Connect the trigger (pressure plate, wall button or whatever) you want to use to 'spawn' your monster to the teleporter and set it to activate.
Now you just need to place your monster with it's item into this square and it will be 'spawned' to the teleporter's target once the trigger is activated.
xbdj
Posts: 32
Joined: Sun Dec 30, 2012 7:43 pm

Re: Scripts help

Post by xbdj »

I just got an answer to a similar question - sort of....

You can create your own creature type by using "cloneObject" in the monster.lua file in your dungeon's "mod_asset" folder

I needed for a door to open, when you killed a snail, so I made a new monster called snail_open to do this, by adding the code below

cloneObject{
name = "snail_open",
baseObject = "snail",
onDie = function()
dungeon_secret_door_5:open()
end,
}


Some similiar might be useful for you...will try to look into item spawning
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Scripts help

Post by Drakkan »

Sutekh wrote:Hmm, not sure about adding items to a spawned monster, but you can do it another way:

Create a single square 'room' separate from the rest of your dungeon, then place a teleporter in that square and set it as inactive. Set the teleporter's target to the place you want the monster to 'spawn'. Connect the trigger (pressure plate, wall button or whatever) you want to use to 'spawn' your monster to the teleporter and set it to activate.
Now you just need to place your monster with it's item into this square and it will be 'spawned' to the teleporter's target once the trigger is activated.
briliant idea :)
however when Iam trying to add item on creature Skeleton_patrol I am mission adding items option also :( (its not there for any monster group)
any other possibility ? cloning / spawning objects or something ?
Breath from the unpromising waters.
Eye of the Atlantis
xbdj
Posts: 32
Joined: Sun Dec 30, 2012 7:43 pm

Re: Scripts help

Post by xbdj »

Got it:

cloneObject{
name = "snail_drop",
baseObject = "snail",
onDie = function(self)
spawn("rock", self.level, self.x, self.y, self.facing)
end,
}


Add this to your monster.lua file (and edit text as necessary ofcourse)
and then simply spawn a "snail_drop" instead of a snail...or whatever monster it is you need to drop it
Post Reply

Return to “Modding”