ID:149273
 
Well, I recently posted about having randomly generated stats, which I have now. The problem is, the stats get created and when the character logs into the game his Strength, Defence, Magic Strength and Magic Defence all get set as "0".

Here is what I have coded:

mob/creating_character

Login()
..()
src.Status()


Thats where the random stat proc is called upon.

    proc/Status()
var/rand1 = rand(5,15)
src.Str = rand1
src.Def = rand1
src.MStr = rand1
src.MDef = rand1


This is the random stat proc, this creates the status for the player.

mob/var
Str = 0
Def = 0
MStr = 0
MDef = 0


This is where the Strength, Defence, Magic Strength and Magic Defence vars are defined.

I have set the vars equal to "0" and null and when set at "0" the stats return to "0" once the player is in the game. The same goes for when the vars are set to null, but with null they have no number to represent the stat.

I am wondering if anyone can help me solve this problem and make sure the randomly generated status gets set and stored on the player's stats upon creation and to make sure that the stats do not return null or a "0".

--Lee
well, you're assigning the random stats to mob/creating_character, I'm assuming you're going through a character creation thing and passing the peopler to mob/player or something else like that? Then you'll have to take the stats with you.

If your using deadrons character handling, all you'd have to do is go to the lines where it says

// Set the attributes.
new_mob.name = char_name

and call the Status() proc just before that, then add
new_mob.Str = Str, and repeat for the other classes.

If you're not using deadrons stuff, well then I dunno, I'd have to see more of your creation stuff. :)
What Zagreus said... changing variables on the mob the player logs into, /creating_character, isn't going to do any good if you then connect the player to a different mob.

The other thing worth mentioning is that you set rand1 = rand(5,15), then set all four stats equal to rand1. Do you realize this means that all four stats will be exactly the same, no matter what? If you don't want to do this, skip the rand1 variable and just set each variable equal to rand(5,15)
In response to Lesbian Assassin
Lesbian Assassin wrote:
What Zagreus said... changing variables on the mob the player logs into, /creating_character, isn't going to do any good if you then connect the player to a different mob.

The other thing worth mentioning is that you set rand1 = rand(5,15), then set all four stats equal to rand1. Do you realize this means that all four stats will be exactly the same, no matter what? If you don't want to do this, skip the rand1 variable and just set each variable equal to rand(5,15)

Yea, thanks for that, Sariat told me to use rand1 = ran(5,15) as I originally had them all to equal rand(5,15)

I will try what you said too Zagreus.

Thanks again anyway...

--Lee
In response to Lesbian Assassin
Sorry about this, I tried what Zagreus said and I couldn't get it to work, not unless I went wrong somewhere.

I just can't seem to get it to work at all.

Sorry for the trouble :S

--Lee
In response to Mellifluous
*Cries* Nothing I say ever works. :)


But, in this case it should. What are the errors you are getting when your fiddling with the creation stuff like I mentioned?
In response to Zagreus
Zagreus wrote:
*Cries* Nothing I say ever works. :)


But, in this case it should. What are the errors you are getting when your fiddling with the creation stuff like I mentioned?

When I inputted the coding into Deadrons Character Handling I got undefined vars so I defined them and no success was made.

So I did it in my .dm files but compiling I get no errors and I don't get runtime errors either...The stats get generated but not kept.

--Lee