I'm making a look verb but I need to know how to check if something is half like if(M.HP == half) or something
------------------------------------------------------
mob
verb/Look(mob/M in oview(7))
set category = "Commands"
set category = "Commands"
usr << "Name: [M.name]"
usr << "Health: [M.HP]"
usr << "Strength: [M.Str]"
usr << "Defense: [M.Def]"
if(M.HP == M.MaxHp)
usr << "He looks like he's in good condition"
if(M.HP == "10")
usr << "[M] is almost dead"
if(M.HP == "1")
usr << "[M] has seen his last sunrise"
if(M.HP == M.HP/2)
usr << "[M] is at half of his HP"
ID:266436
Mar 11 2002, 2:58 pm (Edited on Jun 18 2002, 3:49 pm)
|
|
In response to Richter
|
|
Richter wrote:
Thief jack wrote: if(M.HP <= M.MaxHP/2) |
You need to be using >= or <= for this. If you use ==, you're checking against specific values, which isn't what you want. Also you're comparing your values to strings (in double quotes), which won't work because HP should be a number, not text. Try something like this:
if(M.HP<=2) // very low Lummox JR |
instead of this if(M.HP == half)
try this
if(M.HP /2=M.MaxHP)
im not sure if that works but try it