Scripts help
Scripts help
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
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.
Re: Scripts help
Edit:
Sorry Drakkan - misunderstood your question, I think...
Sorry Drakkan - misunderstood your question, I think...

Last edited by xbdj on Mon Dec 31, 2012 1:08 am, edited 1 time in total.
Re: Scripts help
for text in an alcove use this code in a script entity:
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
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)
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
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Re: Scripts help
Great ! Thats for the Notes. Any ideas how to add items to Spawner monster ?Sutekh wrote:http://www.grimrock.net/modding/how-to- ... an-alcove/
Works with notes as well as scrolls.
thanks man, but this is working jsut for regular creatures. When editing spawner, there is no item option :/msyblade wrote:for text in an alcove use this code in a script entity:
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.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)
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
Re: Scripts help
working fine for alcoves, thanks. However still do not know hot to add items for Spawned creaturesmsyblade wrote:for text in an alcove use this code in a script entity:
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.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)
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
Re: Scripts help
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.
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.
Re: Scripts help
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
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
Re: Scripts help
briliant ideaSutekh 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.

however when Iam trying to add item on creature Skeleton_patrol I am mission adding items option also

any other possibility ? cloning / spawning objects or something ?
Re: Scripts help
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
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