Editor Tutorials on YouTube - part 15 is out

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
Matlock19
Posts: 23
Joined: Sun Nov 02, 2014 2:11 am

Re: Editor Tutorials on YouTube - part 12 is out

Post by Matlock19 »

Thanks for the answers, that was exactly what I needed to get started figuring it all out. The game will have custom items after all! :!:

Your videos are really great, Skuggasveinn, I look forward to more.
User avatar
The cube
Posts: 94
Joined: Tue Apr 23, 2013 6:09 pm
Location: Barren Desert

Re: Editor Tutorials on YouTube - part 12 is out

Post by The cube »

That's awesome for checking models, but i am not sure how to do it for gfxIndex and -Atlas

Code: Select all

function getGraphicAtlas()
	print(spawn("assassin_dagger").gfxAtlas:getGfxAtlas())
end

function getGraphicIndex()
	print(spawn("assassin_dagger").gfxIndex:getGfxIndex())
end
Neither works.

Thanks.
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: Editor Tutorials on YouTube - part 12 is out

Post by Grimfan »

It's

Code: Select all

print(spawn("assassin_dagger").item:getGfxIndex())
Before you were pretty much trying to get the GfxIndex of the GfxIndex.
User avatar
spacecookie
Posts: 26
Joined: Tue Sep 18, 2012 4:23 pm
Location: SW Ingalund, innit.
Contact:

Re: Editor Tutorials on YouTube - part 12 is out

Post by spacecookie »

I'm subscribed to you on youtube. You're really helping. Looking forward to the release of each new video constantly.
User avatar
blob
Posts: 50
Joined: Fri Aug 02, 2013 9:34 am

Re: Editor Tutorials on YouTube - part 12 is out

Post by blob »

Hi!
I'm unable to make the alcove code work.
I basically just copied the script from your video and changed the name of items to fit my map as a test but I get " attempt to call method 'contents' ( a nil value) " on line 2.

Code: Select all

function surfaceContains(surface, item)
   for v,i in surface:contents() do
   if i.go.name == item then return true
   end
end
end

function openPowerGemDoor()
	if surfaceContains(castle_alcove_2,"peasant_cap_1") then
	castle_door_portcullis_10.door:open()
end
end
Did I miss something? :S
(castle alcove 2 calls function openpowergemdoor on insert items)
User avatar
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Editor Tutorials on YouTube - part 12 is out

Post by THOM »

peasant_cap_1 is the name of the item with a number that the engine gives every item to make it unique (if you do not give it a personal name). But in case of the alcove-puzzle you don't want to call for that single item but for any item of that kind. So you have to script "peasant_cap"
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Editor Tutorials on YouTube - part 12 is out

Post by Batty »

blob wrote:Hi!
I'm unable to make the alcove code work.
I basically just copied the script from your video and changed the name of items to fit my map as a test but I get " attempt to call method 'contents' ( a nil value) " on line 2.
Tested this, it works:

Code: Select all

function surfaceContains(object, item)
   for _, i in object.surface:contents() do
      if i.go.id == item then return true end
   end
end

function openPowerGemDoor()
   if surfaceContains(castle_alcove_2, "peasant_cap_1") then
      castle_door_portcullis_10.door:open()
   end
end
In first function, you forgot the alcove object that the surface class is referencing. Also, i.go.name was changed to i.go.id because you're comparing IDs. I changed your surface parameter in the first function to object because I'm not sure surface.surface:contents() would work (maybe it will, try it). :)
User avatar
blob
Posts: 50
Joined: Fri Aug 02, 2013 9:34 am

Re: Editor Tutorials on YouTube - part 12 is out

Post by blob »

Ah! Thanks a ton to the two of you! :)

I now understand my confusion with name and Ids, thanks.

surface.surface:contents() does work too btw! But now I'm confused as to why the example from the tutorial is missing the reference and seemed to be working for Skugga.
User avatar
QuintinStone
Posts: 72
Joined: Sat Nov 01, 2014 9:58 pm

Re: Editor Tutorials on YouTube - part 12 is out

Post by QuintinStone »

blob wrote:Ah! Thanks a ton to the two of you! :)

I now understand my confusion with name and Ids, thanks.

surface.surface:contents() does work too btw! But now I'm confused as to why the example from the tutorial is missing the reference and seemed to be working for Skugga.
Me too! I had trouble with coding surfaces because contents() is not listed in the reference. :?
Crypt of Zulfar
User avatar
Skuggasveinn
Posts: 562
Joined: Wed Sep 26, 2012 5:28 pm

Re: Editor Tutorials on YouTube - part 12 is out

Post by Skuggasveinn »

Thanks for kind words.

I've not done a tut in some time but I'm far from "gone" (got a PM asking if I was gone from LoG2 modding :D )
I've just been working on some things like waterfalls, you can take a look at them here http://youtu.be/96v6ZV2R14I

I've also been working on a urban town creating kit, it's a model set that uses the existing log2 models and textures and lets you create houses, its modular so you can create any layout, multible floors etc.
Since its all existing stuff its footprint size has minimal impact on your mods size.
Screen of a house is here http://www.zorglubb.net/grimrock/images ... ouse_2.jpg

but just wanted to jump in and say I'm far from gone :D
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
Post Reply