cloneObject

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
tyterrio
Posts: 7
Joined: Wed Sep 26, 2012 7:20 am

cloneObject

Post 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!
User avatar
Blichew
Posts: 157
Joined: Thu Sep 27, 2012 12:39 am

Re: cloneObject

Post 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) :wink: :wink: ?
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: cloneObject

Post 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
Finished Dungeons - complete mods to play
tyterrio
Posts: 7
Joined: Wed Sep 26, 2012 7:20 am

Re: cloneObject

Post 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....
SpacialKatana
Posts: 163
Joined: Fri Sep 14, 2012 6:20 pm

Re: cloneObject

Post 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
}
tyterrio
Posts: 7
Joined: Wed Sep 26, 2012 7:20 am

Re: cloneObject

Post by tyterrio »

Perfect! Thank you so much :)
Post Reply