Editor Tutorials on YouTube - part 13 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
Skuggasveinn
Posts: 545
Joined: Wed Sep 26, 2012 5:28 pm

Re: Editor Tutorials on YouTube - part 12 is out

Post by Skuggasveinn » Sun Nov 09, 2014 6:01 am

Matlock19 wrote:
The cube wrote: How am i supposed to know the position of the item in the graphic atlas for example? How do i know all the things i need to put in there to make it work?
I'm interested in this, too. I don't want to import new models or 2D sprites, I just want to know how to reference the ones that already exist when defining new weapons/armor/etc. I need like a big sheet that shows examples of new objects that have been created, especially how to reference the graphics files when defining an object. How can I tell what sprite and model the items use?
Until the asset pack gets released people need to do some legwork.

The file structure of Log2 is very much the same as Log1.
In LoG1 you had gfxAtlas = "assets/textures/gui/items.tga", and items_2.tga
In LoG2 its items.tga, items_2.tga and items_3.tga (error if you try 4 so I guess it stops at 3)
index 0 for items.tga is the Schimitar, just change your gfxIndex and refresh (ctrl+r) , you will see that the next one is the Shamans Staff and gfxIndex 2 is the Elemental Shield, continue that way until you reach 168, then change to index_2 and do the same for index_3.
after you have done that and noted it all down, you will have what you need, an overview of all the gfxIndexes in the game.

regarding the models, again the file structure is the same as it was in LoG1, item are assets/models/items and environment objects are assets/models/env
The name if the asset in the editor is a good indicator of the file name, battle_axe has the model name of battle_axe.fbx, blackmoss is blackmoss.fbx, fjeld_warg_meat is (you guessed it) fjeld_warg_meat.fbx
You can also use bitcpy python script for Blender that lists out the path and filename in the dialog window before importing if you run into naming discrepancy.

Skuggasveinn.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.

minmay
Posts: 2656
Joined: Mon Sep 23, 2013 2:24 am

Re: Editor Tutorials on YouTube - part 12 is out

Post by minmay » Sun Nov 09, 2014 6:09 am

Alternatively, now that we have the scripting reference we know that you can just do this:

Code: Select all

print(spawn("fjeld_warg_meat").model:getModel())
assets/models/items/fjeld_warg_meat.fbx
(and so on for the gfxIndex, gfxAtlas, etc...)
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.

User avatar
Skuggasveinn
Posts: 545
Joined: Wed Sep 26, 2012 5:28 pm

Re: Editor Tutorials on YouTube - part 12 is out

Post by Skuggasveinn » Sun Nov 09, 2014 6:15 am

minmay wrote:Alternatively, now that we have the scripting reference we know that you can just do this:

Code: Select all

print(spawn("fjeld_warg_meat").model:getModel())
assets/models/items/fjeld_warg_meat.fbx
(and so on for the gfxIndex, gfxAtlas, etc...)

That's excellent minmay, being more at home with Blender and Photoshop I often forget the simplicity of scripting :D
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.

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 » Sun Nov 09, 2014 7:20 am

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 » Sun Nov 09, 2014 10:43 am

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 » Sun Nov 09, 2014 1:45 pm

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 » Fri Nov 21, 2014 7:48 pm

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 » Fri Nov 28, 2014 12:22 am

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: 1130
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Editor Tutorials on YouTube - part 12 is out

Post by THOM » Fri Nov 28, 2014 12:47 am

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 » Fri Nov 28, 2014 12:52 am

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). :)

Post Reply