ID:154260
 
I'm wondering something...
Will the follow code make M's damage only once? Or will it be a different number each time its called???

The 2nd one is what I'm looking for and if this won't do it then I'll just have to am a proc.

M.damage = (rand(1,3))

LJR
Each time it's called.
In response to Foomer
Foomer wrote:
Each time it's called.

Sweet and simple too! :)

LJR
In response to LordJR
damage = (rand(3,7))
error::expected a constant expression

Funny this is what I get when I try to do this for an NPC. Any ideas why it compiles fine for one and not the other??

LJR
In response to LordJR
You can only use it in a proc. You're not trying to randomize initial settings are you?
In response to Foomer
Foomer wrote:
You can only use it in a proc. You're not trying to randomize initial settings are you?
Aye, thats what I was hoping for, though I didn't think it would work. Maybe u misunderstood my question.

LJR
In response to LordJR
Initialize the value in the NPC's New() proc then.

New()
..()
damage = rand(1,3)

This will make each NPC have a different damage rating, but the damage will stay the same until something else changes it.
In response to Shadowdarke
I just made a lowdamage/damage which are predefined, and then placed those in the (rand(lowdamge,damage)). This works fine.

LJR