ID:150448
 
Hi, Im kalzimere and am just starting to learn how to code. I made 2 codes that seem like they should work but don't. Im pretty sure it must be becausesoemthing im doing lol. I placed the two codes under a proc like below:

proc
DeathCheck()
if(health <= 0)
usr.loc = locate("death")
world << "[src] dies!"
Expcheck()
if(usr.exp >= usr.expneed)
usr.health += 2
usr.str += 1/3
usr.speed += 1/3
usr.def += 1/4
usr.expneed += 200
usr.level += 1
usr<<"You have gained a Level"
Kalzimere wrote:
Hi, Im kalzimere and am just starting to learn how to code. I made 2 codes that seem like they should work but don't. Im pretty sure it must be becausesoemthing im doing lol. I placed the two codes under a proc like below:

proc
DeathCheck()
if(health <= 0)
<font color=red>usr.loc = locate("death")
world << "[src] dies!"</font>
Expcheck()
if(usr.exp >= usr.expneed)
usr.health += 2
usr.str += 1/3
usr.speed += 1/3
usr.def += 1/4
usr.expneed += 200
usr.level += 1
usr<<"You have gained a Level"

The highlighted lines should be indented over one tab because they are not under the if statement they are part of DeathCheck proc.
In response to Nadrew
wow lol thanks for responding so fast but now i got new problem lol. Ok I get no errors for this code:
proc
DeathCheck()
if(health <= 0)
usr.loc = locate("death")
world << "[src] dies!"
Expcheck()
if(usr.exp >= usr.expneed)
usr.health += 2
usr.str += 1/3
usr.speed += 1/3
usr.def += 1/4
usr.expneed += 200
usr.level += 1
usr<<"You have gained a lvl"

Ok i get no errors for this now but they don't seem to work, the chars get more exp then needed and nothng happens and then they get neg health, am i now suppose to apply the Expcheck(), and DeathCheck(). Sorry that i am so dumb :-(. and thanks again nandrew for that speedy responds it helped a lot.
-kalzimere
In response to Kalzimere
Kalzimere wrote:
wow lol thanks for responding so fast but now i got new problem lol. Ok I get no errors for this code:
proc
DeathCheck()
if(health <= 0)
usr.loc = locate("death")
world << "[src] dies!"
Expcheck()
if(usr.exp >= usr.expneed)
usr.health += 2
usr.str += 1/3
usr.speed += 1/3
usr.def += 1/4
usr.expneed += 200
usr.level += 1
usr<<"You have gained a lvl"

Ok i get no errors for this now but they don't seem to work, the chars get more exp then needed and nothng happens and then they get neg health, am i now suppose to apply the Expcheck(), and DeathCheck(). Sorry that i am so dumb :-(. and thanks again nandrew for that speedy responds it helped a lot.
-kalzimere

When ever you want to have it check for a proc just put Procname()

Example:

mob/verb/Attack(mob/M in oview(1))
var/damage=2*usr.Level
M.Health-=damage
DeathCheck()
proc
DeathCheck()
if(M.Health<=0)
//Some Death stuff here
In response to Nadrew
Thank you a ton nadrew now they both work perfectly well work real well i thank you again and again lol .
-kalzimere
In response to Kalzimere
Kalzimere wrote:
Thank you a ton nadrew now they both work perfectly well work real well i thank you again and again lol .
-kalzimere

Glad to help.
In response to Nadrew
i need to surf the boards more or something,
your definitely going to get guru

*cries*

--FIREking
In response to FIREking
FIREking wrote:
i need to surf the boards more or something,
your definitely going to get guru

*cries*

--FIREking

Wow you really think so?