Tome of (Insertname)

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!
Post Reply
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Tome of (Insertname)

Post by Emera Nova »

So basically I'm wanting to blend different tomes together and see if they are able to have applied properitys that can also go into the negative.

Example being A health tome that gives say 50 hp instead of 25 but removes 25 energy.

Is this possible? if so how? And is it possible to do the same thing with protections and skill points?
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Tome of (Insertname)

Post by minmay »

Yes, by passing a negative number instead of a positive number, yes it works for protection/evasion/stats. You can take away skill points, but of course you also need to add code to take away a skill level, it makes no sense for the player to end up with negative skill points. And then you need to handle what happens when a level 1 farmer with no skills or points reads the tome. It also doesn't sound interesting in the first place.
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.
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Re: Tome of (Insertname)

Post by Emera Nova »

So this is the code I have atm for a tome that gives more hp but lowers the overall energy.

Code: Select all

defineObject{
	name = "Tome_health",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/tome.fbx",
		},
		{
			class = "Item",
			uiName = "Tome of Healths",
			description = "A thick tome that thoroughly describes the diet and excercises of the hermits of Basabua.",
			gfxIndex = 30,
			weight = 1.0,
			gameEffect = "Health +100","Energy -25",
			traits = { "tome" },
		},
		{
			class = "UsableItem",
			sound = "level_up",
			onUseItem = function(self, champion)
				hudPrint(champion:getName().." gained Health +100.")
				champion:modifyBaseStat("max_health", 100,"max_energy", -25)
				champion:modifyBaseStat("health", 100, "energy", -25)
				return true
			end,
		},
	},
}

When I go to place an item into the game tho it ends up crashing the game xD so I'm guessing something there isn't set correctly.
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Tome of (Insertname)

Post by minmay »

modifyBaseStat only takes two arguments, not four. You can't modify two different stats in the same call.
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.
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Re: Tome of (Insertname)

Post by Emera Nova »

Code: Select all

defineObject{
   name = "Tome_health",
   baseObject = "base_item",
   components = {
      {
         class = "Model",
         model = "assets/models/items/tome.fbx",
      },
      {
         class = "Item",
         uiName = "Tome of Healths",
         description = "A thick tome that thoroughly describes the diet and excercises of the hermits of Basabua.",
         gfxIndex = 30,
         weight = 1.0,
         gameEffect = "Health +100","Energy -25",
         traits = { "tome" },
      },
      {
         class = "UsableItem",
         sound = "level_up",
         onUseItem = function(self, champion)
            hudPrint(champion:getName().." gained Health +100.")
            champion:modifyBaseStat("max_health", 100,"max_energy", -25)
            champion:modifyBaseStat("health", 100, "energy", -25)
            return true
         end,
      },
   },
}
So should I change it to:

Code: Select all

champion:modifyBaseStat("max_health", 100)
champion:modifyBaseStat("max_energy", -25)
            champion:modifyBaseStat("health", 100)
champion:modifyBaseStat("energy",-25)
Also when I put in the negative sign in the modifyBaseStat it shows up as black vs the blue which is the number.
User avatar
Mutman
Posts: 73
Joined: Sun Apr 08, 2012 9:57 pm
Location: Krupka, Czech Republic

Re: Tome of (Insertname)

Post by Mutman »

You can also use my book skins I made to give them proper feel :)

Here: http://www.nexusmods.com/legendofgrimrock2/mods/13/?
Runebooks: http://www.nexusmods.com/legendofgrimrock2/mods/13/? for Legend of Grimrock 2
Runebooks and books: http://grimrock.nexusmods.com/mods/217/ for Legend of Grimrock 1
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Re: Tome of (Insertname)

Post by Emera Nova »

Soo my last idea of how to fix that didn't work... Any ideas?
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Re: Tome of (Insertname)

Post by Emera Nova »

How to I make it so it has a negative value? And is it possible to make it take energy awhile while increasing the health? From anything i've tried it won't run properly.
Post Reply

Return to “Mod Creation”