Page 1 of 1
cloneObject
Posted: Fri Sep 28, 2012 12:45 pm
by tyterrio
hey guys, simple question about cloneObjects. "Where" exactly does that code go?
Does it go into a lua script, or am I creating a new file to add to the in game assets? I've found plenty of code on how to clone objects, just not what to do with the code. Thanks!
Re: cloneObject
Posted: Fri Sep 28, 2012 12:49 pm
by Blichew
You put every cloneObject block into .\mod_assets\scripts\objects.lua file in your mod directory.
Remember that for editor to see the items you've added you have to reload project from the file menu.
I think you may also put those definitions in any other lua script i guess (in the same directory) - like customObjects.lua (you can easilly move various object definitions between projects that way)
Then just put import "mod_assets/scripts/customObjects.lua" into your init.lua script which loads when the mam starts.
Maybe you'd want to share a few of your ideas (not going into specifics of course)
?
Re: cloneObject
Posted: Fri Sep 28, 2012 1:04 pm
by Komag
this official doc page explains about that:
http://www.grimrock.net/modding/creating-custom-assets/
the folder they're referring to is within your Documents folder, on Windows 7 or Vista something like:
C:\Users\YOURNAME\Documents\Almost Human\Legend of Grimrock\Dungeons\YOURDUNGEON\mod_assets
Re: cloneObject
Posted: Fri Sep 28, 2012 1:26 pm
by tyterrio
awesome! thanks guys
quick followup question regarding the spider hatchlings
function breakEggs(level, x, y)
local facing = (party.facing + 2)%4
spawn("spider", level, x, y, facing)
end
im crashing the game with this:
function breakEggs(level, x, y)
local facing = (party.facing + 2)%4
spawn("spider", 1, 4, 14, 1)
end
any idea whats wrong? the "level, x, y" is defining parameters correct? so if I input the rest, this should work....
Re: cloneObject
Posted: Fri Sep 28, 2012 1:42 pm
by SpacialKatana
tyterrio wrote:
im crashing the game with this:
function breakEggs(level, x, y)
local facing = (party.facing + 2)%4
spawn("spider", 1, 4, 14, 1)
end
any idea whats wrong? the "level, x, y" is defining parameters correct? so if I input the rest, this should work....
Should be ----> spawn("spider", self.level,self.x,self.y,self.facing)
You're likely spawning into a closed square with your coords, which will crash the game.
Working code for hatcing eggs is :-
Code: Select all
cloneObject{
name = "Spider_eggs_hatching",
baseObject = "spider_eggs",
health = 20,
evasion = -1000,
hitSound = "spider_eggs_hit",
hitEffect = "hit_goo",
editorIcon = 56,
onDie = function(self)
local facing = (party.facing + 2)%4
spawn("spider", self.level, self.x, self.y, facing)
end
}
Re: cloneObject
Posted: Fri Sep 28, 2012 1:50 pm
by tyterrio
Perfect! Thank you so much