ID:158508
 
Right so basically i am looking for a code that transforms the user to make them stronger.

Right i will just explain the kind of Transformation code i am looking for.

The verb may be called Tramsform (or somehting like that) and what it does is that it changes the user's icon to something different. I have got the whole icon changing codes but i dont know how to improve their stats like to make the user stronger and better defense e.t.c. and also i would like the transformation to only last for atleast 3 minutes.

SUMMARY!
i need a good transformation code that changes the user's icon and stats (strength, defense e.t.c.)

Please i need your help
Thank-You in Advance
mob/verb/transform()         
icon='transform.dmi' //changes icon
str = str + 5 //or whatever number you want
def = def + 5 //same for defense
sleep(1800) //waits three minutes
str = str - 5
def = def -5
In response to Donut_eater
Donut_eater wrote:
> mob/verb/transform()         
> icon='transform.dmi' //changes icon
> str = str + 5 //or whatever number you want
> def = def + 5 //same for defense
> sleep(1800) //waits three minutes
> str = str - 5
> def = def -5


Right the stat changing thing works, but i just realised 3 minutes is a bit long for this transformation so could you (or someone) tell me how to change it to last for 1 minute?

Also when i transform and the transformation comes to an end my icon does not change back to its original icon. how do i fix this problem?
In response to Runney001
Runney001 wrote:
Donut_eater wrote:
> > mob/verb/transform()         
> > icon='transform.dmi' //changes icon
> > str = str + 5 //or whatever number you want
> > def = def + 5 //same for defense
> > sleep(1800) //waits three minutes
> > str = str - 5
> > def = def -5

Right the stat changing thing works, but i just realised 3 minutes is a bit long for this transformation so could you (or someone) tell me how to change it to last for 1 minute?

Also when i transform and the transformation comes to an end my icon does not change back to its original icon. how do i fix this problem?

Ok
sleep(time)
BTW time in byond is 1/10ths of a second. so 600 = 1 minute.
as ur your changing back icon

 mob/verb/transform()
> > var/IconStore = usr.icon
> > icon='transform.dmi' //changes icon
> > str = str + 5 //or whatever number you want
> > def = def + 5 //same for defense
> > sleep(600) //waits one minutes
> > str = str - 5
> > def = def -5
> > icon = IconStore


This should work
In response to Gamemakingdude
Don't post things that "should" work. Test it yourself!
mob
var
oldicon
oldiconstate
transforming
verb/transform()
if(src.transforming) return //they're transforming, don't let them
else
src.trasforming=1
src.oldicon=src.icon //store the current icon in the oldicon var
src.oldiconstate=src.icon_state //along with the icon_state
src.icon='transform.dmi'
//do your staff stuff here. remember += is short hand for
//var = var + number
sleep(600) //sleep is in 1/10th a second
//so sleep(10) = 1 second.
src.icon=src.oldicon
src.icon_state=src.oldiconstate

THAT works, and is actually commented and has a much better way of going about that.
In response to Runney001
In response to Vic Rattlehead
Vic Rattlehead wrote:
Don't post things that "should" work. Test it yourself!
> mob
> var
> oldicon
> oldiconstate
> transforming
> verb/transform()
> if(src.transforming) return //they're transforming, don't let them
> else
> src.trasforming=1
> src.oldicon=src.icon //store the current icon in the oldicon var
> src.oldiconstate=src.icon_state //along with the icon_state
> src.icon='transform.dmi'
> //do your staff stuff here. remember += is short hand for
> //var = var + number
> sleep(600) //sleep is in 1/10th a second
> //so sleep(10) = 1 second.
> src.icon=src.oldicon
> src.icon_state=src.oldiconstate
>

THAT works, and is actually commented and has a much better way of going about that.

Yeah thanks it worked, but i have another issue, when i click transform i transform and gain stats and a change of icon but if i keep clicking transform he keeps transforming and gaining stats, how do i make it that you can only transform once then the next time you can transform is after the transformation has ended?
In response to Runney001
mob
var
oldicon
oldiconstate
transforming
transformed//new var
verb/transform()
if(src.transformed) return
if(src.transforming) return //they're transforming, don't let them
else
src.trasforming=1
src.oldicon=src.icon //store the current icon in the oldicon var
src.oldiconstate=src.icon_state //along with the icon_state
src.icon='transform.dmi'
src.transformed=1//new var
//do your staff stuff here. remember += is short hand for
//var = var + number
sleep(600) //sleep is in 1/10th a second
//so sleep(10) = 1 second.
src.icon=src.oldicon
src.icon_state=src.oldiconstate

There, I added the transformed var in there that it should read... i didnt test it out, but eh, its just one var, not hard to change or take out... To prevent it from happening though, you have to put certain things like transformed=1 after so much coding.... (Future reference that is).... that should now prevent it from continuing to repeatedly transform
In response to Seteden
Didn't really seem like you test your work either(Though I don't think 95% of the people do). You only need one /transforming variable, and then set it to 1 at the beginning and back to 0 at the end(Which you forgot). Having two of them is a waste of variables. Also the better way to do it I think is if Transform() was pressed again they revert. But so far Garthor has been the most correct in this post...