ID:144503
 
mob/var/trans_delay = 0

obj/Transform/Transform

verb
Transform()
set category = "Combat"

if(usr.doing == 1)
usr << "You are already doing something!"
return

if(usr.rest == 1)
usr << "You cannot Transform whilst resting!"
return

if(usr.trans_delay == 1)
usr << "You must wait again before Transforming!"
return

usr.trans_delay = 1
spawn(35) usr.trans_delay = 0

if(usr.race == "Namek")
usr.Namek_Trans()

if(usr.race == "Half Saiyan")
usr.Half_Saiyan_Trans()

if(usr.race == "Majin")
usr.Majin_Trans()

if(usr.race == "Changling")
usr.Changling_Trans()

if(usr.race == "Saiyan")
usr.Saiyan_Trans()

if(usr.race == "Human")
usr.Human_Trans()

if(usr.race == "Kat-mazon")
usr.Tuffle_Trans()

mob/proc/Namek_Trans()

if(src.doing == 1)
return
else
if(src.form_1 == 0)
if(src.powerlevel_max >= 100000 && src.level >= 100)

src.safe = 1
src.doing = 1
src.icon_state = "enrage"
src.frozen = 1
sleep(19)

src.powerlevel_max *= 30
src.ki_max *= 8
src.strength_max *= 5
src.defence_max *= 4
src.speed_max *= 4

src.powerlevel = src.powerlevel_max
src.ki = src.ki_max
src.strength = src.strength_max
src.defence = src.defence_max
src.speed = src.speed_max

view(6) << "<font color = green>[src.name] transforms into a Super Alien!"
src.icon_state = ""
new/obj/techs/Overlays/Crater_Small(src.loc)


src.transformed = 1
src.form_1 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
return
else
if(src.form_2 == 0)
if(src.powerlevel_max >= 5000000 && src.level >= 750)
src.safe = 1
src.doing = 1
src.icon_state = "enrage"
src.frozen = 1
sleep(19)

src.powerlevel_max *= 15
src.ki_max *= 15
src.strength_max *= 7
src.defence_max *= 6
src.speed_max *= 6

src.powerlevel = src.powerlevel_max
src.ki = src.ki_max
src.strength = src.strength_max
src.defence = src.defence_max
src.speed = src.speed_max

view(6) << "<font color = green>[src.name] transforms into a Ascended Alien!"
src.icon_state = ""

src.transformed = 1
src.form_2 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
return
else
if(src.form_3 == 0)
if(src.powerlevel_max >= 50000000 && src.level >= 1500)
src.safe = 1
src.doing = 1
src.icon_state = "enrage"
src.frozen = 1
sleep(19)

src.powerlevel_max *= 25
src.ki_max *= 25
src.strength_max *= 10
src.defence_max *= 8
src.speed_max *= 9
src.overlays += green_elec

src.powerlevel = src.powerlevel_max
src.ki = src.ki_max
src.strength = src.strength_max
src.defence = src.defence_max
src.speed = src.speed_max

view(6) << "<font color = green>[src.name] transforms into a Super Alien 2!"
src.icon_state = ""
src.icon = 'Namek - Super.dmi'

src.transformed = 1
src.form_3 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
return


my trans verb doesnt work if i use it ingame it says "u must wait before transforming again" but havent transed yet... help me plz

HolyhaloIII wrote:
mob/var/trans_delay = 0
>
> obj/Transform/Transform
>
> verb
> Transform()
> set category = "Combat"
>
> if(usr.doing == 1)
> usr << "You are already doing something!"
> return
>
> if(usr.rest == 1)
> usr << "You cannot Transform whilst resting!"
> return
>
> if(usr.trans_delay == 1)
> usr << "You must wait again before Transforming!"
> return
>
> usr.trans_delay = 1
> spawn(35) usr.trans_delay = 0
>
> if(usr.race == "Namek")
> usr.Namek_Trans()
>
> if(usr.race == "Half Saiyan")
> usr.Half_Saiyan_Trans()
>
> if(usr.race == "Majin")
> usr.Majin_Trans()
>
> if(usr.race == "Changling")
> usr.Changling_Trans()
>
> if(usr.race == "Saiyan")
> usr.Saiyan_Trans()
>
> if(usr.race == "Human")
> usr.Human_Trans()
>
> if(usr.race == "Kat-mazon")
> usr.Tuffle_Trans()
>
> mob/proc/Namek_Trans()
>
> if(src.doing == 1)
> return
> else
> if(src.form_1 == 0)
> if(src.powerlevel_max >= 100000 && src.level >= 100)
>
> src.safe = 1
> src.doing = 1
> src.icon_state = "enrage"
> src.frozen = 1
> sleep(19)
>
> src.powerlevel_max *= 30
> src.ki_max *= 8
> src.strength_max *= 5
> src.defence_max *= 4
> src.speed_max *= 4
>
> src.powerlevel = src.powerlevel_max
> src.ki = src.ki_max
> src.strength = src.strength_max
> src.defence = src.defence_max
> src.speed = src.speed_max
>
> view(6) << "<font color = green>[src.name] transforms into a Super Alien!"
> src.icon_state = ""
> new/obj/techs/Overlays/Crater_Small(src.loc)
>
>
> src.transformed = 1
> src.form_1 = 1
> src.frozen = 0
> src.doing = 0
> src.safe = 0
> return
> else
> if(src.form_2 == 0)
> if(src.powerlevel_max >= 5000000 && src.level >= 750)
> src.safe = 1
> src.doing = 1
> src.icon_state = "enrage"
> src.frozen = 1
> sleep(19)
>
> src.powerlevel_max *= 15
> src.ki_max *= 15
> src.strength_max *= 7
> src.defence_max *= 6
> src.speed_max *= 6
>
> src.powerlevel = src.powerlevel_max
> src.ki = src.ki_max
> src.strength = src.strength_max
> src.defence = src.defence_max
> src.speed = src.speed_max
>
> view(6) << "<font color = green>[src.name] transforms into a Ascended Alien!"
> src.icon_state = ""
>
> src.transformed = 1
> src.form_2 = 1
> src.frozen = 0
> src.doing = 0
> src.safe = 0
> return
> else
> if(src.form_3 == 0)
> if(src.powerlevel_max >= 50000000 && src.level >= 1500)
> src.safe = 1
> src.doing = 1
> src.icon_state = "enrage"
> src.frozen = 1
> sleep(19)
>
> src.powerlevel_max *= 25
> src.ki_max *= 25
> src.strength_max *= 10
> src.defence_max *= 8
> src.speed_max *= 9
> src.overlays += green_elec
>
> src.powerlevel = src.powerlevel_max
> src.ki = src.ki_max
> src.strength = src.strength_max
> src.defence = src.defence_max
> src.speed = src.speed_max
>
> view(6) << "<font color = green>[src.name] transforms into a Super Alien 2!"
> src.icon_state = ""
> src.icon = 'Namek - Super.dmi'
>
> src.transformed = 1
> src.form_3 = 1
> src.frozen = 0
> src.doing = 0
> src.safe = 0
> return

my trans verb doesnt work if i use it ingame it says "u must wait before transforming again" but havent transed yet... help me plz


Well, obviously - the first thing you might want to look at is why that message is being displayed.

if(usr.trans_delay == 1)
usr << "You must wait again before Transforming!"
return


If that message is being displayed it means somewhere's in your code "trans_delay" is being set to 1. Personally, I'm not a fan of setting boolean variables. For sensitive stuff such as delay timers, I use time stamps. That way, if the proc stops or that variable isn't set back to its original value, checking against a time stamp to current time is more safe. EX:

#define SECOND              10 //one second
#define MINUTE 600 //one minute
#define HOUR 36000 //one hour
#define DAY 24*HOUR //one day
//This is how you check against the variable that you set below
if(usr.trans_delay>=world.realtime)
usr<<"You must wait again before Transforming!"
return

//This is how you set the variable
usr.trans_delay=world.realtime+(SECOND*3.5) //This is just an example but this shows that you won't be able to transform for another 3.5 seconds.


Also, your design for the one transform verb is flawed. Instead of doing a bunch of different if(race=="blah") just make an individual "obj" for each race.

ex:
obj
transformations
proc
Use() //the parent proc
verb
Transform()
usr.Use()
saiyan
Use() //This is where you do all the specifics for each race by over-riding the original "Use()" proc we defined earlier
var/mob/M=src.loc //Since this "obj" should be in the players contents, we can define a variable to make sure we've got the owner
if(ismob(M)) //make sure it's actually a "mob"
M<<"You transformed!"
namek
//Then you do the same for the rest


Then, all you do is give each race its appropriate transformation "obj" when they achieve it.