Page 1 of 2
Scripts help
Posted: Mon Dec 31, 2012 12:30 am
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
Re: Scripts help
Posted: Mon Dec 31, 2012 12:37 am
by xbdj
Edit:
Sorry Drakkan - misunderstood your question, I think...

Re: Scripts help
Posted: Mon Dec 31, 2012 12:40 am
by Sutekh
Re: Scripts help
Posted: Mon Dec 31, 2012 12:48 am
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
Re: Scripts help
Posted: Mon Dec 31, 2012 12:53 am
by Drakkan
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 :/
Re: Scripts help
Posted: Mon Dec 31, 2012 12:55 am
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
Re: Scripts help
Posted: Mon Dec 31, 2012 1:16 am
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.
Re: Scripts help
Posted: Mon Dec 31, 2012 1:25 am
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
Re: Scripts help
Posted: Mon Dec 31, 2012 1:30 am
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 ?
Re: Scripts help
Posted: Mon Dec 31, 2012 1:31 am
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