Energy Regeneration

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Energy Regeneration

Post by LordGarth »

I was hoping to make some necklaces that increase health and energy regeneration.

Does anyone know how to do this.

Thx,

LG
Dungeon Master and DOOM will live forever.
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: Energy Regeneration

Post by Diarmuid »

Until we get onEquipItem next update, you can set up a constant timer then call a function that checks if the amulet is worn and add health & energy to champions at the intervals you want. (For example, if you wish your Amulet of Regeneration to add 1hp every 30s, check every 30s).

For example, I have the following script in my dungeon which checks every 5s if an Amulet of Darkness is worn, and if there is a light spell on, puts it back in the inventory or on the ground if there's no space. Storywise, the idea is that the item is powerful, but the tradeoff is that ih has an "evil" aura which prevents you from casting light spells or wearing it while a light spell is active. You can adapt the search function to suit your needs, I took the code from somewhere in these forums:

Code: Select all

function amuletDark()
	local champion
	local slot
	local champID
	local placed = false
	local currentItem
	for champID=1,4 do
 		champion = party:getChampion(champID)
		currentItem = champion:getItem(6)
		if currentItem ~= nil and currentItem.name == "amulet_dark" then
			if lightTracker.lightLevel > 0 then
				champion:removeItem(6)
				hudPrint("You cannot wear the Amulet of Darkness while a light spell is active.")
				for slot =11,31 do
					currentItem = champion:getItem(slot)
					if currentItem == nil and placed == false then
						champion:insertItem(slot, spawn("amulet_dark"))
						placed = true
					end
					if placed == false then
						spawn("amulet_dark",party.level, party.x, party.y, party.facing)
					end				
				end
			end
   		end
	end
end
Post Reply