Ask a simple question, get a simple answer

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
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

It also goes without saying... that the LoG1 asset pack is not directly importable to LoG2. :!:
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Well basically that was the part that confused me. Most of the contents was indeed already basic stuff available in the dungeon editor and then I stumbled on the snail and I was like huh.. that's new.

So basically, I don't have to worry about this asset pack for now and simply just keep building maps for now creating an openworld mod out there.

So no snails in my mod, easy. Best to keep it simple and able to understand it.

Thanx! :)
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

You can put snails in your mod, but it's best not to put them in proximity to doors. I don't recall offhand if the sound set for the snails exists in LoG2, but I think probably not. The snail monster definition would have to be defined in the LoG2 style, and sounds would have to be defined if they are to use them.

There are a lot of free sound effect libraries available online. Sonnis is very generous with theirs.
https://sonniss.com/gameaudiogdc18/

* If you are handy with Blender3D, it is possible to correct the snail animations, by using the Bitcopy import/export script, and Blender version 2.72.
viewtopic.php?f=22&t=8086
Last edited by Isaac on Sun Jun 24, 2018 8:06 pm, edited 1 time in total.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

It's okay, my mod is slowly progressing, whenever I have some spare time.

I don't even want the stupid snails anymore :lol:

With the many custom assets that I was able to properly implement, it's looking rather exotic already compared to the vanilla LoG2 experience. That was my main goal. A town and exotic/custom maps both outside and inside. I'm getting more experienced in the dungeon editor by experimenting and just building along in general.

Already implemented aztec (uD)? dungeons, asian dungeon/library map, an overrun asian town map, a castle town map. redwood forests and currently building a DM themed castle dungeon.

One day...
Last edited by Pompidom on Sun Jun 24, 2018 8:09 pm, edited 1 time in total.
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Even if you don't experiment with customized monsters —yet, The Blender links will allow you to add fully custom static assets like new walls, floors, and other objects. ;)
But the number 1 (and by far!) best and most useful asset, is becoming familiar with the Lua programming language; (which is what all of the game scripts are written in). With that, then the sky is the limit on custom assets, and game object behavior.
User avatar
Khollik
Posts: 171
Joined: Tue Aug 29, 2017 6:44 pm
Location: France

Re: Ask a simple question, get a simple answer

Post by Khollik »

Hi

For a mod I'm working on, I'm trying to create an item which augments the fire magic skill by one when equiped. Is there an easy way to do it ?

this does not work:

Code: Select all

{
class = "EquipmentItem",
protection = 3,
evasion = 3,
energy = 10,
fire_magic = 1,
},
Because it doesn't recognize "fire magic" as a valid component property of EquipmentItem.

I also tried :

Code: Select all

onRecomputeStats = function(self, champion)
champion:modifyBaseStat("fire_magic",1)
end
Or champion:upgradeBaseStat(name, value)
Or champion:addStatModifier(name, amount)

But none of this works (it seems that fire magic is not recognized as a base stat).

Champion:trainSkill(name, times) just upgrades the stat on and on as long as the item is equiped.

The most logical would be to use champion:trainSkill() when the item is equiped (and not onRecomputeStats) but then I didn't find a way to remove one skill point, so that I could check onUnequipItem().

Any advice here ?

Khollik
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Ask a simple question, get a simple answer

Post by akroma222 »

Khollik wrote: Mon Jun 25, 2018 7:59 pm For a mod I'm working on, I'm trying to create an item which augments the fire magic skill by one when equiped. Is there an easy way to do it ?
You can use the ItemComponent's onEquip / onUnequip hooks, eg:
SpoilerShow

Code: Select all

		onEquipItem = function(self, champion, slot)
	
			if slot == 1 or slot == 2 then 
	
				if champion:getRace() == "your_race" then	
					local item1 = champion:getItem(ItemSlot.Weapon)
					local item2 = champion:getItem(ItemSlot.OffHand)
					if item1 and item1:hasTrait("sword") and item2 and item2:hasTrait("sword") then
						traitManager.script.addTrait(champion,"traitytrait",false)
					end
				end
	
				if champion:getClass() == "this_class" or champion:getClass() == "that_class" then
					skillManager.script.skillUp(champion,"accuracy", 1, false)
				end
			end
		end,
		
		
		
		
		onUnequipItem = function(self, champion, slot)
	
			if slot == 1 or slot == 2 then 
				
				if champion:getRace() == "your_race" then
					local item1 = champion:getItem(ItemSlot.Weapon)
					local item2 = champion:getItem(ItemSlot.OffHand)
					if item1 and item1:hasTrait("sword") and item2 and item2:hasTrait("sword") then
						traitManager.script.removeTrait(champion,"traitytrait",false)
					end
				end
				
				if champion:getClass() == "this_class" or champion:getClass() == "that_class" then
					skillManager.script.skillDown(champion,"accuracy", 1, false)
				end
			end
		end,			
Youll notice the example uses some scripts named 'SkillManager' & 'TraitManager'
These are scripts that enable the equipping of items that raise / lower skills / stats / & add / remove traits safely
Do a quick search of this forum with those 2 key words and youll find a few helpful threads w links
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Here is a ring item that does this.

The relevant features are in the equipItem hooks.

Code: Select all

-- Deleted in favor of using an EquipmentItem component.
Last edited by Isaac on Mon Jun 25, 2018 10:27 pm, edited 3 times in total.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Ask a simple question, get a simple answer

Post by akroma222 »

Isaac / Khollik, I think using only:

Code: Select all

champion:trainSkill("fire_magic",1) and champion:trainSkill("fire_magic", -1)
....can result in some bugs....
for example: If champ is on skill lv5, equips the ring (staying at lv5) then unequips it... champ will go down to skill lv4 (essential losing points of skill)
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

akroma222 wrote: Mon Jun 25, 2018 8:57 pm ...
This is good to know. 8-)
I'll update it.

*There is also the 'Fire Mastery' trait to handle, when the ring is removed.
Last edited by Isaac on Mon Jun 25, 2018 10:25 pm, edited 2 times in total.
Post Reply