ID:145257
 
Code:
mob/verb
Drive_Check()
if(usr.drive >= 10)
usr << ("Yes, I have the Drive attack")
Special_Attack()
for(var/mob/M in get_step(usr,usr.dir))//This makes it so you have to be facing your opponent to attack
if(!M.client)//Checks to see if the opponent is a npc or player
if(M.mon)//Checks to see if the opponent is an enemy
if(!M.dead)//Checks to see if the enemy is dead or not
var/dmg = usr.str - M.def
usr<<"You did [dmg] damage to [M]."
M.Hp -= dmg
if(M.Hp <= 0)
drive += rand(0,1)
drive = 0
del(M)
return ..()


Problem description:I want it so that the verb, check_drive, to check and see if I have 10 drive in my stat and if I do, I get the secial attack. Can anyone tell me what I have wrong here. I know it's alot of things wrong but I just tried it. And I added the drive = 0 in the end there to make the drive bar to go back down to 0, don't know if that's correct.

Well. The if() statement in Drive_Check isn't checking anything.

the usr<<"" has parenthesis.

mob/verb
Drive_Check()
if(usr.drive < 11 && usr.drive > 0) // less then eleven, and greater then zero.
usr << "Yes, I have the Drive attack"
else
usr << "Drive attack is offline."


That is how I would have handled that.

So. You need to learn about greater then and less then values.

The pointy side is ALWAYS pointing to the lower number.

So. 1 is less then 2. 1 < 2. 2 is greater then 1. 2 > 1.

1 is greater then or equal to (k). 1 >= (k). 1 is less then or equal to (k). 1 <= (k).
Bamrulez wrote:
Code:
mob/verb
> Drive_Check()
> if(usr.drive >= 10)
> usr << ("Yes, I have the Drive attack")
> Special_Attack()
> for(var/mob/M in get_step(usr,usr.dir))//This makes it so you have to be facing your opponent to attack
> if(!M.client)//Checks to see if the opponent is a npc or player
> if(M.mon)//Checks to see if the opponent is an enemy
> if(!M.dead)//Checks to see if the enemy is dead or not
> var/dmg = usr.str - M.def
> usr<<"You did [dmg] damage to [M]."
> M.Hp -= dmg
> if(M.Hp <= 0)
> drive += rand(0,1)
> drive = 0
> del(M)
> return ..()
>

Problem description:I want it so that the verb, check_drive, to check and see if I have 10 drive in my stat and if I do, I get the secial attack. Can anyone tell me what I have wrong here. I know it's alot of things wrong but I just tried it. And I added the drive = 0 in the end there to make the drive bar to go back down to 0, don't know if that's correct.



Check the above corrected code, spacing is wrong for the usr << "Yes..." part.
In response to Xoule
                        if(M.Hp <= 0)
drive += rand(0,1)
drive = 0
del(M)
return ..()


maybe..

                        if(M.Hp <= 0)
drive -= 10 // you lose 10 for using drive
drive += rand(0,1) // you gain 0 or 1 for killing the monster with drive.
del(M)
return ..()

In response to Xoule
Xoule wrote:
Check the above corrected code, spacing is wrong for the usr << "Yes..." part.

Uhh that doesn't matter one single bit


>                         if(M.Hp <= 0)
> drive -= 10 // you lose 10 for using drive
> drive += rand(0,1) // you gain 0 or 1 for killing the monster with drive.
> del(M)
> return ..()
>


Read his post agian Problem description:I want it so that the verb, check_drive, to check and see if I have 10 drive in my stat and if I do, I get the secial attack. Can anyone tell me what I have wrong here. I know it's alot of things wrong but I just tried it. And I added the drive = 0 in the end there to make the drive bar to go back down to 0, don't know if that's correct.
In response to Crzylme
Now I have more problem's.

What is wrong with this here?

mob/verb
Drive_Check()
if(usr.drive < 11 && usr.drive > 0) // less then eleven, and greater then zero.
usr << "Yes, I have the Drive attack"
usr.verbs += (/mob/verb/special_attack)
else
usr << "Drive attack is offline."

mob
special_attack()
for(var/mob/M in get_step(usr,usr.dir))//This makes it so you have to be facing your opponent to attack
if(!M.client)//Checks to see if the opponent is a npc or player
if(M.mon)//Checks to see if the opponent is an enemy
if(!M.dead)//Checks to see if the enemy is dead or not
var/dmg = usr.str - M.def
usr<<"You did [dmg] damage to [M]."
M.Hp -= dmg
if(M.Hp <= 0)
drive += rand(0,1)
drive = 0
del(M)
return ..()
In response to Bamrulez
Don't put parenthesis around the path for usr.verbs.

special_attack() isn't defined as a verb.

drive var doesn't have a mob attached to it in special_attack()