ID:157811
 
obj/potion/lucky
verb/drink()
usr.AddLife(rand(-20,20))
mob
var
usr.HP = usr.MaxHP
usr.MaxHP = 100
usr.AddHP = usr.HP + usr.AddHP
usr.damage


Basically I want to create an HP and a MaxHP, and have a potion that affects it. Well, this really isnt working out at all..... maybe someone else knows how
Why don't you just make a var call X like so

var/x = rand(1,20)
usr.MaxHP += x
In response to Gr1m d4 r34p3r
He obviously has syntax issues as well, along with various other issues. Do not help someone if you don't even know what is wrong. Giving them some random snippet that is totally unrelated to their problem doesn't help.
In response to Spunky_Girl
My problem is that I have no idea how to code this.... =(
I am RTFM too, but im getting confused
In response to Darkjohn66
In response to Spunky_Girl
See?He has no idea how to code this, so that fixed his problem!
In response to Gr1m d4 r34p3r
Um, no it didn't... In fact it would make his problem even worse, if he uses it the way I believe he is going to try to. If he truly wants to learn how to program in DM, he'll go through the link I posted.
In response to Spunky_Girl
Spunky_Girl wrote:
Um, no it didn't... In fact it would make his problem even worse, if he uses it the way I believe he is going to try to. If he truly wants to learn how to program in DM, he'll go through the link I posted.

He was doing it wrong, I just showed him a easier way.
In response to Gr1m d4 r34p3r
...an easier way of doing it wrong.
In response to Spunky_Girl
=_+

thanks grim.
You cannot set a dynamic value at the time when you are defining a variable that is not under a procedure >.>
In response to GhostAnime
ok i used zilals tutorial partialy. There is code elsewhere for a bunch of other stuff like my icon and a stat panel with an iventory but here iis what I got:

mob
var
HP = 30
verb
attack(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
usr << "You attack [M]!" //send this message to the usr
oview() << "[usr] attacks [M]!" //send this message to everybody else
var/damage = rand(1,10) //assign a random # to a new variable
world << "[damage] damage!" //tell the damage to the world
M.HP -= damage
M.DeathCheck()
proc
DeathCheck()
if(HP <= 0)
world << "[src] dies!"

obj/potion/lucky
icon = 'grass.dmi'
icon_state = "potion"
verb/drink()
var/damage = (rand(-20,20))

Iconning.dm:1169:warning: damage: variable defined but not used


My issue is that the potion doesnt affect my hp @ all. I have it set up so i can check my hp when i target myself here (Maybe this is what is wrong???)
mob/var
mob/enemy
enemy_marker
targetable
client/DblClick(mob/M)
if(istype(M))

del usr.enemy_marker
usr.enemy = M
usr.enemy_marker = image('outline.dmi', M)
usr << usr.enemy_marker
usr << "[src]'s HP: [M.HP]"
mob
var
HP
MaxHP


obj
potions
var
min = 0 // deafult
max = 10 // deafult

lucky // defining potion named lucky
icon = ''
icon_state = ""
min = -20
max = 20


verb // will effect all potions
drink()
set category = null // make the verb not to appear in a tab
set src in usr // make sure the item is in player inventory
usr.hp += rand(min, max)