ID:266241
 
How would I go about adding Levels to attacks, what I mean is this:

These are some attacks:

Attack 1
Attack 2
Attack 3

and to use each one you would need these levels:

Attack 1 = level 10
Attack 2 = level 100
Attack 3 = level 1000

How would I be able to set it so that to use an "Attack" it says "You need to be at level 1000 to use this attack" and once the user reaches level 1000 he/she can then use the attack when ever he/she fells like doing it?

Please assist,

Lee
By checking the level of the person at the start of the attack..Use an if statement

Alathon
Evil_SSJ4Vegeta wrote:
How would I go about adding Levels to attacks, what I mean is this:

These are some attacks:

Attack 1
Attack 2
Attack 3

and to use each one you would need these levels:

Attack 1 = level 10
Attack 2 = level 100
Attack 3 = level 1000

How would I be able to set it so that to use an "Attack" it says "You need to be at level 1000 to use this attack" and once the user reaches level 1000 he/she can then use the attack when ever he/she fells like doing it?

Please assist,

Lee


It would be a few simple if and else like:

mob/verb/Attack1(mob/M in oview(1))
if(usr.Level>=10)//Makes it if the users level is wqual or more then 10
//Attack 1 things here
else
usr<<"Cannot use this attack"
mob/verb/Attack2(mob/M in oview(1))
if(usr.Level>=100)
//Attack 2's stuff
else
usr<<"Cannot use this attack"


I hope that will help you out..
In response to Alathon
Alathon wrote:
By checking the level of the person at the start of the attack..Use an if statement

Alathon

I done that but the beam still fires :(, tak a look here:
--------------------------
mob/verb/Ultra_Kamehameha()
set category = "Ki Techniques"
if(usr.Level <=1000)
usr << "I'm sorry this attack is far to strong for you to handle, train up to Level 1000, then you will be able to use it :)"
src.Health -= 1000
src.PL -= 1000000
In response to Evil_SSJ4Vegeta
Evil_SSJ4Vegeta wrote:
I done that but the beam still fires :(, tak a look here:
--------------------------
mob/verb/Ultra_Kamehameha()
set category = "Ki Techniques"
if(usr.Level <=1000)
usr << "I'm sorry this attack is far to strong for you to handle, train up to Level 1000, then you will be able to use it :)"
src.Health -= 1000
src.PL -= 1000000

The reason the beam still fires is that the routine is still running. You need a return statement after the message to the user, so the proc bails out.

Lummox JR
In response to Lummox JR
How would I do that, use an "else"?

if so what do I put after the "else" because I dont know what to put...also would the "else" go at the very end of the code or just before the firing part of the code?
In response to Evil_SSJ4Vegeta
Evil_SSJ4Vegeta wrote:
How would I do that, use an "else"?

if so what do I put after the "else" because I dont know what to put...also would the "else" go at the very end of the code or just before the firing part of the code?

The return statement should go right after the message to usr, indented the same way. What you want is for the level check to be done, then, if the level is insufficient, tell the user so and then quit the verb so it doesn't keep going. That means you need two statements in that if() block: One, the message to usr, which you have, and two, a return.

Lummox JR
In response to Lummox JR
like this Lummox:

mob/verb/Ultra_Kamehameha()
set category = "Ki Techniques"
if(usr.Level <=1000)
usr << "I'm sorry this attack is far to strong for you to handle, train up to Level 1000, then you will be able to use it :)"
return 0
if(usr.PL <=1000000)
usr << "You havent enough Ki to use this attack"
return 0
In response to Evil_SSJ4Vegeta
Evil_SSJ4Vegeta wrote:
like this Lummox:

mob/verb/Ultra_Kamehameha()
set category = "Ki Techniques"
if(usr.Level <=1000)
usr << "I'm sorry this attack is far to strong for you to handle, train up to Level 1000, then you will be able to use it :)"
return 0
if(usr.PL <=1000000)
usr << "You havent enough Ki to use this attack"
return 0

That's correct, although you shouldn't need the 0. just the return statement alone should suffice.

Lummox JR
In response to Lummox JR
ok, thanks