ID:263623
 
Code:
                    if("Water")

var/Poke_Prob3 = rand(1,10)
src.Type = "Water"

if(Poke_Prob3)
new_mob = new /mob/player/Pokemon/Squirtle
if(Poke_Prob3 == 2)
new_mob = new /mob/player/Pokemon/Tododile
if(Poke_Prob3 == 3)
new_mob = new /mob/player/Pokemon/Dratini
if(Poke_Prob3 == 4)
new_mob = new /mob/player/Pokemon/Seel
if(Poke_Prob3 == 5)
new_mob = new /mob/player/Pokemon/Mudkip
if(Poke_Prob3 == 6)
new_mob = new /mob/player/Pokemon/Horsea
if(Poke_Prob3 == 7)
new_mob = new /mob/player/Pokemon/Psyduck
if(Poke_Prob3 == 8)
new_mob = new /mob/player/Pokemon/Marill
if(Poke_Prob3 == 9)
new_mob = new /mob/player/Pokemon/Politode
if(Poke_Prob3 == 10)
new_mob = new /mob/player/Pokemon/Tentacool
if(Poke_Prob3 == 11)
new_mob = new /mob/player/Pokemon/Poliwag


Problem description:I have a pokemon game with some kool features coded in but the next thing I wanna add are attacks but whenever I make it so when u pick you wanna be a water type I made a var called mob/var/type = ""
And when you select water I put src.type = "Water" but when I finished creating my character the var was src.type = "" how do I make it so it keeps the var I really wanna add attacks like water gun,hydro pump,etc.(I got 0 Errors and 0 Warnings)

Because any changes to src are made to a mob that you are, presumably, discarding.

Additionally: if(Poke_Prob3) will be true if Poke_Prob3 is anything but 0, and so you'll be creating a Squirtle every single time, regardless of what should be being created.
In response to Garthor
Garthor wrote:
you'll be creating a Squirtle every single time, regardless of what should be being created.

Actually, he'll be creating whatever the rand var was (except Poliwag). if(Poke_Prob3) is at the beginning of it so it'll make new_mob a Squirtle then change it later on down to something like a Mudkip.
In response to Ol' Yeller
thats not what im talking about im talking about the var(The type of pokemon)(it restarts the var when I finish making my char)
In response to Element Hero creator
Because any changes to src are made to a mob that you are, presumably, discarding.

You're assigning type "water" to src (src being the source mobile), then you're discarding the previous mob src and replacing it with new_mob. new_mob, of course, will not have a type if you don't assign it one.

In any case, I suggest assigning 'type' to the mobile type itself, so you don't have to modify it later.

Example:

mob
Water
type = "water"
Squirtle


This way, when you create the Squirtle, or any other mobile under mob/Water, it's type will be "water" by default.

edit: I'm not 100% sure you can even modify an atom's type variable, so you might want to change that to your own.
In response to Keeth
Thanks Keeth that worked ^^.
In response to Ol' Yeller
Ol' Yeller wrote:
Garthor wrote:
you'll be creating a Squirtle every single time, regardless of what should be being created.

Actually, he'll be creating whatever the rand var was (except Poliwag). if(Poke_Prob3) is at the beginning of it so it'll make new_mob a Squirtle then change it later on down to something like a Mudkip.

No, actually nothing. He will be creating a Squirtle every single time, regardless of what else happens. Whether or not he actually is assigned that mob later is irrelevant.
Element Hero creator wrote:
Code:
                    if("Water")
>
> var/Poke_Prob3 = rand(1,10)
> src.Type = "Water"
>
> if(Poke_Prob3)
> new_mob = new /mob/player/Pokemon/Squirtle
> if(Poke_Prob3 == 2)
> new_mob = new /mob/player/Pokemon/Tododile
> if(Poke_Prob3 == 3)
> new_mob = new /mob/player/Pokemon/Dratini
> if(Poke_Prob3 == 4)
> new_mob = new /mob/player/Pokemon/Seel
> if(Poke_Prob3 == 5)
> new_mob = new /mob/player/Pokemon/Mudkip
> if(Poke_Prob3 == 6)
> new_mob = new /mob/player/Pokemon/Horsea
> if(Poke_Prob3 == 7)
> new_mob = new /mob/player/Pokemon/Psyduck
> if(Poke_Prob3 == 8)
> new_mob = new /mob/player/Pokemon/Marill
> if(Poke_Prob3 == 9)
> new_mob = new /mob/player/Pokemon/Politode
> if(Poke_Prob3 == 10)
> new_mob = new /mob/player/Pokemon/Tentacool
> if(Poke_Prob3 == 11)
> new_mob = new /mob/player/Pokemon/Poliwag
>

Problem description:I have a pokemon game with some kool features coded in but the next thing I wanna add are attacks but whenever I make it so when u pick you wanna be a water type I made a var called mob/var/type = ""
And when you select water I put src.type = "Water" but when I finished creating my character the var was src.type = "" how do I make it so it keeps the var I really wanna add attacks like water gun,hydro pump,etc.(I got 0 Errors and 0 Warnings)


now do what Keeth said, and instad of making a var/Poke_Prob3=rand(1,10) you should just do this, its simpiler and more efficient
switch(rand(1,10))//switches into a random "proc"
if(1)//if the result is 1
new_mob = new /mob/player/Pokemon/Squirtle//player becomes a squritle, yay!