• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua adding maxhealth and maxmana to an item

RazorBlade

Retired Snek
Joined
Nov 7, 2009
Messages
2,015
Solutions
3
Reaction score
629
Location
Canada
I'm having trouble with a script. It doesn't add health/mana when it's told to.
Code:
local choice2 = math.random(1, 2)
				if (choice2 == 1) then
					maxhp = math.random(250, 500)
					hp = (hp + maxhp)
					doItemSetAttribute(itemEx.uid, 'maxhealthpoints', hp)
					points2 = (jewel2Point + 1)
					doItemSetAttribute(itemEx.uid, "jewel2", points2)
					doSendAnimatedText(toPosition, "Upgraded!", TEXTCOLOR_GREEN)
					doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
It's supposed to add a random amount of maxhealth or maxmana between 250 and 500 (code above is just the maxhealth part) There are no console errors and it sends the magic effect so I know it gets past adding the health, it just doesn't add it. what's wrong?
I'm using TFS 0.4, some rev in the 8.62 range.
 

Similar threads

Back
Top