ID:144436
 
Code:
mob
Click(mob/M)
set src in oview()
switch(alert(usr,"Challenge player?","Are you sure?","Yes","No"))
if("Yes")
src<<"<b>[usr.name] has challenged you."
switch(alert(src,"Accept challenge?","ACCEPT CHALLENGE","Yes","No"))
if("Yes")
src.oldlocation = src.loc
usr.oldlocation=usr.loc
src.loc=locate(2,2,2)
usr.loc=locate(10,10,2)
src = battleone
usr=battletwo
view()<<"[src.name]'s turn first."
usr.move=0
src.move=5
src.turn=1
//This is temprary, in real player different levels will mean more movement. (ex. src.move=src.maxmove)
//attacks take up moves too. I musn't forget to add a panel displaying attacks you have unlocked and how many moves they take up.
//also, adding what the attacks effect is could be nice


if("No")
usr<<"[src.name] has declined your challenge"

if("No")
..()
//Move cancelation system
mob
Move()
if(src.move=="nolimit")
..()
else if(src.move>1)
src.move-=1
..()
src<<"You have [src.move] moves left."
else if(src.move<=0)
src<<"You can't move. It is currently your opponents turn."

var/move = "nolimit"
//Basic death check, health, and attack. Later on, ill make it more complex. Including kills and deaths count
mob
proc
deathcheck()
if(src.health<=0)
view()<<"[src] has died"
src.loc = locate(oldlocation)
usr.loc = locate(oldlocation)
var
oldlocation
health = 10 //This.. Could be increased.
mob
proc //Basic attack, basic magic and basic ranged.
basicattack(mob/M in view(1))
if(src.move<1)
src<<"You don't have the stamina to attack"
else
damage = rand(0,3)
M.health -= damage
M<<"[src] has punched you for [damage] damage!"
deathcheck()
var/damage
//basic attack (first unlocked attack.) must add a couple more for variety.
mob
verb
punch()
if(attack==0)
usr<<"You cannot fight in this area."
else if(attack==1)
basicattack()
var/attack = 0

//I should organize things in different panels later.
//Ok... None of this is working
battle
verb
End_Turn()
set src in view()
if(usr.turn==1)
switch(alert(usr,"End turn?","End turn","Yes","No"))
if("Yes")
src<<"It is now your turn."
src.move = 5 //Umm YES move IS a defined var!
usr.move = 0
usr.move=0
usr.verbs-=typesof(/battle/verb/Current)
else if(usr.turn==0)
usr<<"It is not your turn."
mob
var
turn
battleone
battletwo


Problem description:

Well, to begin, I don't know why I can't control the mobs from another verb. That's what I really can't explain. Say for example, I make a verb that only appears for another player once it's their turn. Say the verb is a "end turn" verb. Sure, then i make that player's walking go down to zero, but then, what about the player whose turn is next? How do I give them the verb to end turn, and give them walking capability?

The two problems are:

137:error:/battle/verb/Current:undefined type path (I don't know where the "Current" comes in...
134:error:src.move:undefined var (Actually, it IS a defined variable.)


mob/battle
verb
End_Turn()
set src in view()
if(usr.turn==1)
switch(alert(usr,"End turn?","End turn","Yes","No"))
if("Yes")
src<<"It is now your turn."
src.move = 5 //Umm YES move IS a defined var!
usr.move = 0
usr.move=0
usr.verbs-=typesof(/mob/battle/verb/Current)
else if(usr.turn==0)
usr<<"It is not your turn."


Try that out for size :P.
In response to A.T.H.K
That fixes that, but still, when I switch turns, the other player doesn't get his move back.
In response to Speedro
Because, as I mentioned back in [link], usr and src in mob/verb are the same... READ THE WHOLE POST AS I STILL SEE PROBLEMS THAT I OUTLINED!!!

*cough* and the reason why the defined doesn't work is bcause the verb is battle/verb, NOT mob/verb in which where the variable is defined under.

Examples, such as the one I posted and you basically copy/pasted, are meant for you to study and understand, not to plug in.

- GhostAnime
No put usr in proc. Ungh.

Lummox JR