ID:262259
 
Code:it is a monster I am trying to make his exp and gold random numbers.
mob/Monsters
death_angel
icon = 'Monster.dmi'
icon_state = "death angel"
gold=rand(1250,2300)
HP = 2300
MHP = 2300
player = 0
Str = 463
Def = 499
Expg=rand(2000,3783)
level = 185
monster = 1
PK = 1
NPC = 0
New()
. = ..()
spawn()
Wander()
proc/Wander(var/mob/You/P)
while(src)
if(P in oview(5))
step_towards(src,P)
for(P in oview(1))
break
for(P in oview(2))
break
for(P in oview(3))
break
for(P in oview(4))
break
else
step_rand(src)
sleep(5)
for(P in oview(5))
break
sleep(5)
spawn(5)
Wander()
Bump(mob/M)
if(M.player == 1)
Fight(M)
else
return
proc/Fight()
for(var/mob/E in get_step(usr,usr.dir))
var/damage = src.Str - src.Def
E.HP -= damage
UserDcheck(E)


Problem description:
for some reason the program says that it expected a constant expression where the rand(#,#) things are at. What expressions do i need?

When you define a variable, you cannot use a procedure, as the variable is supposed to be pre-defined before the world starts up.

Just make the variable, and define the number in a procedure somewhere during the world's life.
mob
var
gold=rand(1250,2300) // incorrect
mob
var
gold

New()
..()
gold=rand(1250,2300) // correct


DM can't handle dynamic variable definitions, meaning, you can't set a variable's initial value to something that isn't concrete outside of a proc. To set your random values, define the variable without a value first, then set the random value in the New() proc.

~X