ID:145718
 
Code:
mob/proc/Demon_Trans()

if(src.doing == 1)
return
else
if(src.form_1 == 0)
if(src.powerlevel_max >= 100000)
src.underlays -= src.aura
src.aura = 0
src.safe = 1
src.doing = 1
src.icon_state = "sbomb"
src.frozen = 1
sleep(10)

src.powerlevel *= 100
src.ki *= 15
src.strength *= 3
src.defence *= 3
src.speed *= 2.5

view(6) << "<font color = #800080>[src.name]'s power surges as he changes into his Second Form!"
src.icon_state = ""
src.icon = 'Demon - form 2.dmi'
new/obj/techs/Overlays/Crater_Small(src.loc)


src.transformed = 1
src.form_1 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
src.aura = 1
src.underlays += src.aura
spawn() src.Changling_Upkeep()
return
else
if(src.form_2 == 0)
if(src.powerlevel_max >= 300000)
src.underlays -= src.aura
src.aura = 0
src.safe = 1
src.doing = 1
src.icon_state = "sbomb"
src.frozen = 1
sleep(10)

src.powerlevel = src.powerlevel_max
src.powerlevel *= 20
src.ki *= 20
src.strength *= 7
src.defence *= 5
src.speed *= 6

view(6) << "<font color = #800080>[src.name]'s power surges as he changes into his Third Form!"
src.icon_state = ""
src.icon = 'Demon - form 3.dmi'

src.transformed = 1
src.form_2 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
src.aura = 1
src.underlays += src.aura
return
else
if(src.form_3 == 0)
if(src.powerlevel_max >= 500000)
src.underlays -= src.aura
src.aura = 0
src.safe = 1
src.doing = 1
src.icon_state = "sbomb"
src.frozen = 1
sleep(10)

src.powerlevel *= 26
src.ki *= 26
src.strength *= 10
src.defence *= 8
src.speed *= 9

view(6) << "<font color = #800080>[src.name]'s power surges as he changes into his Forth Form!"
src.icon_state = ""
src.icon = 'Demon - form 4.dmi'

src.transformed = 1
src.form_3 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
src.aura = 1
src.underlays += src.aura
return
else
if(src.form_4 == 0)
if(src.powerlevel_max >= 1000000)
src.underlays -= src.aura
src.aura = 0
src.safe = 1
src.doing = 1
src.icon_state = "sbomb"
src.frozen = 1
sleep(10)

src.powerlevel *= 32
src.ki *= 32
src.strength *= 13
src.defence *= 12
src.speed *= 13

view(6) << "<font color = #800080>[src.name]'s power surges as he changes into his Forth Form (100% Power)!"
src.icon_state = ""
src.icon = 'Demon - form 5.dmi'

src.transformed = 1
src.form_4 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
src.aura = 1
src.underlays += src.aura
return


Problem description:i keep getting this error
Commands\Transform\Demon Trans.dm:3:error: proc definition not allowed inside another proc
anyone know how to fix this?????? i would really appreciate the help

showing the actual error would help - thats just you being told you have one. look above that.
In response to JMT
the actual error is
if(src.doing == 1)

that wich is at almost the very top of this code
mob/proc/Demon_Trans()

if(src.doing == 1)
return
else
if(src.form_1 == 0)
if(src.powerlevel_max >= 100000)
src.underlays -= src.aura
src.aura = 0
src.safe = 1
src.doing = 1
src.icon_state = "sbomb"
src.frozen = 1
sleep(10)

src.powerlevel *= 100
src.ki *= 15
src.strength *= 3
src.defence *= 3
src.speed *= 2.5

view(6) << "<font color = #800080>[src.name]'s power surges as he changes into his Second Form!"
src.icon_state = ""
src.icon = 'Demon - form 2.dmi'
new/obj/techs/Overlays/Crater_Small(src.loc)


src.transformed = 1
src.form_1 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
src.aura = 1
src.underlays += src.aura
spawn() src.Changling_Upkeep()
return
else
if(src.form_2 == 0)
if(src.powerlevel_max >= 300000)
src.underlays -= src.aura
src.aura = 0
src.safe = 1
src.doing = 1
src.icon_state = "sbomb"
src.frozen = 1
sleep(10)

src.powerlevel = src.powerlevel_max
src.powerlevel *= 20
src.ki *= 20
src.strength *= 7
src.defence *= 5
src.speed *= 6

view(6) << "<font color = #800080>[src.name]'s power surges as he changes into his Third Form!"
src.icon_state = ""
src.icon = 'Demon - form 3.dmi'

src.transformed = 1
src.form_2 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
src.aura = 1
src.underlays += src.aura
return
else
if(src.form_3 == 0)
if(src.powerlevel_max >= 500000)
src.underlays -= src.aura
src.aura = 0
src.safe = 1
src.doing = 1
src.icon_state = "sbomb"
src.frozen = 1
sleep(10)

src.powerlevel *= 26
src.ki *= 26
src.strength *= 10
src.defence *= 8
src.speed *= 9

view(6) << "<font color = #800080>[src.name]'s power surges as he changes into his Forth Form!"
src.icon_state = ""
src.icon = 'Demon - form 4.dmi'

src.transformed = 1
src.form_3 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
src.aura = 1
src.underlays += src.aura
return
else
if(src.form_4 == 0)
if(src.powerlevel_max >= 1000000)
src.underlays -= src.aura
src.aura = 0
src.safe = 1
src.doing = 1
src.icon_state = "sbomb"
src.frozen = 1
sleep(10)

src.powerlevel *= 32
src.ki *= 32
src.strength *= 13
src.defence *= 12
src.speed *= 13

view(6) << "<font color = #800080>[src.name]'s power surges as he changes into his Forth Form (100% Power)!"
src.icon_state = ""
src.icon = 'Demon - form 5.dmi'

src.transformed = 1
src.form_4 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
src.aura = 1
src.underlays += src.aura
return

the error says
Commands\Transform\Demon Trans.dm:3:error: proc definition not allowed inside another proc
You've indented way too far after the
mob/proc/Demon_Trans() line.

It should be if(doing), or if you should prefer, if(src.doing). You should also be if(form_1) or if(!src.form_1). It's just more robust. The reason you don't need src. is because if no global variable is found with the name, it defaults to src.

Also, I hate your idea for variables form_1, form_2, form_3, form_4, etc... You should really be using a single variable and adding and subtracting from it when you should need to.

Last but not least, you have no else statement proceding all those if() procs. So why not save yourself some horizontal space and use if(src.form && src.powerlevel_max>=1000000)? Much simplier.
In response to CaptFalcon33035
thanks alot but can u show me an idea of what your talking about?? because now dream maker gave me 4 new errors

Commands\Transform\Demon Trans.dm:1:error:mob/proc/Demon_Trans:undefined var

Commands\Transform\Revert.dm:36:error:usr.Demon_Revert:undefined proc

Commands\Transform\Transformation.dm:43:error:usr.Demon_Trans:undefined proc

Commands\Transform\Demon Trans.dm:6:error:else :'else' clause without preceding 'if' statement


for this code
    mob/proc/Demon_Trans()

if(src.doing == 1)
return

else
if(src.form_1 == 0)
if(src.powerlevel_max >= 100000)
src.underlays -= src.aura
src.aura = 0
src.safe = 1
src.doing = 1
src.icon_state = "sbomb"
src.frozen = 1
sleep(10)

src.powerlevel *= 100
src.ki *= 15
src.strength *= 3
src.defence *= 3
src.speed *= 2.5

view(6) << "<font color = #800080>[src.name]'s power surges as he changes into his Second Form!"
src.icon_state = ""
src.icon = 'Demon - form 2.dmi'
new/obj/techs/Overlays/Crater_Small(src.loc)


src.transformed = 1
src.form_1 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
src.aura = 1
src.underlays += src.aura
spawn() src.Changling_Upkeep()
return
else
if(src.form_2 == 0)
if(src.powerlevel_max >= 300000)
src.underlays -= src.aura
src.aura = 0
src.safe = 1
src.doing = 1
src.icon_state = "sbomb"
src.frozen = 1
sleep(10)

src.powerlevel = src.powerlevel_max
src.powerlevel *= 20
src.ki *= 20
src.strength *= 7
src.defence *= 5
src.speed *= 6

view(6) << "<font color = #800080>[src.name]'s power surges as he changes into his Third Form!"
src.icon_state = ""
src.icon = 'Demon - form 3.dmi'

src.transformed = 1
src.form_2 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
src.aura = 1
src.underlays += src.aura
return
else
if(src.form_3 == 0)
if(src.powerlevel_max >= 500000)
src.underlays -= src.aura
src.aura = 0
src.safe = 1
src.doing = 1
src.icon_state = "sbomb"
src.frozen = 1
sleep(10)

src.powerlevel *= 26
src.ki *= 26
src.strength *= 10
src.defence *= 8
src.speed *= 9

view(6) << "<font color = #800080>[src.name]'s power surges as he changes into his Forth Form!"
src.icon_state = ""
src.icon = 'Demon - form 4.dmi'

src.transformed = 1
src.form_3 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
src.aura = 1
src.underlays += src.aura
return
else
if(src.form_4 == 0)
if(src.powerlevel_max >= 1000000)
src.underlays -= src.aura
src.aura = 0
src.safe = 1
src.doing = 1
src.icon_state = "sbomb"
src.frozen = 1
sleep(10)

src.powerlevel *= 32
src.ki *= 32
src.strength *= 13
src.defence *= 12
src.speed *= 13

view(6) << "<font color = #800080>[src.name]'s power surges as he changes into his Forth Form (100% Power)!"
src.icon_state = ""
src.icon = 'Demon - form 5.dmi'

src.transformed = 1
src.form_4 = 1
src.frozen = 0
src.doing = 0
src.safe = 0
src.aura = 1
src.underlays += src.aura
return

In response to C0rrupt3d
Every line under that is messed up, not the actualy line. Then everything else I said.