mob
Click(mob/M)
set src in oview()
switch(alert(usr,"Challenge player?","Are you sure?","Yes","No"))
if("Yes")
src<<"<b>[src] has challenged you."
switch(alert(src,"Accept challenge?","ACCEPT CHALLENGE","Yes","No"))
if("Yes")
src.loc = src.oldlocation
usr.loc = usr.oldlocation
src.loc=locate(2,2,2)
usr.loc=locate(10,10,2)
view()<<"[src]'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] 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
M.health -= damage
damage = rand(0,3)
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)
src<<"You cannot fight in this area."
else if(attack==1)
basicattack()
var/attack = 0
//I should organize things in different panels later.
//HERE is the problem, I can't add this to the mob/Click part! I still honestly can't explain it :(
mob
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 //Later, I must switch this to M.move = M.maxmove
usr.move = 0
else if(usr.turn==0)
usr<<"It is not your turn."
var/turn
ID:165558
Dec 3 2006, 1:15 pm
|
|
I'm having some problems with certain things. For example, I make a click mob thing so you can challenge that player, but then, once they accept, you are teleported to the fighting location. I honestly can't explain it, you can't switch turns with another verb on... I REALLY can't explain it. I know what the problem is, but i can't explain it. Ill just show the code.
|
In response to GhostAnime
|
|
That's all very confusing >.>
|
In response to Speedro
|
|
Which parts specially is confusing? I can try to help you out.
- GhostAnime |
In response to GhostAnime
|
|
Well, to begin, I still 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?
|
In response to Speedro
|
|
By the way, this is one of my bigger problems in coding.
|
In response to Speedro
|
|
Please do not double post, you can edit your previous post if no one replied.
Now, what you are asking is different from the first thing I showed/explained. You can have a special verb path set up which the person receives, such as
battle/verb/Current/End_Turn()
usr.move=0 As said beforein my other post, you need a variable to keep track of who is fighting who, preferably using a global list or something similar. - GhostAnime |
In response to GhostAnime
|
|
I'm getting alot of.. Well, a few problems with what you just showed me. I changed it to as close to what you said as i could understand. I still get two error messages that shouldn't be there:
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 |
In response to Speedro
|
|
...Hello?
|
2)
Use [src.name] instead of [src], so it'll force set the name to be proper (I _THINK_). Anyways, it shouldn't be [src.name] has challenged you; it should be [usr.name].. afterall, why would you challenge yourself (also safety check that the usr != src). Also, close your HTML tags, add </b>.
3) src.loc = src.oldlocation
src.loc=locate(2,2,2)
Why are you transporting src & usr to their oldloc and than to a diff. loc right away? If you meant to make the src/usr.loc defined in oldloc, switch the two around: src.oldlocation=src.loc
4) else if(src.move>1)
src.move-=1
..()
src<<"You have [src.move] moves left."
else if(src.move==0)
I saw what you're trying to get at but what if the person had move == 1? Change else if(src.move>1) to >=1
Also, for safety check purposes, use min()/max() when subtracting and change else if(src.move==0) to <=0... you never know.
5) deathcheck()
if(src.health<0)
view()<<"[src] has died"
src.loc = locate(oldlocation)
usr.loc = locate(oldlocation)
a) if(src.health<0): What if the person health was EXACTLY 0? Change it to <=0 :[
b) src.loc = locate(oldlocation): You don't really need to use locate() if oldloc is a turf, though you really don't need to change this.
c) usr.loc = locate(oldlocation): Why the hell do you want the same exact thing here? And since this is a mob/proc, using usr. here is a VERY bad idea as you don't know who usr actually is.
6) var
oldlocation
For safety purposes (and to avoid some nasty runtime errors), define oldloc: oldloc=locate(2,32,2) or so
7) M.health -= damage
damage = rand(0,3)
I am pretty sure you want to REVERSE those two lines... aferall, why you want to take out HP from a damage value that was used before the new one was set. In fact, I recommend you scraping out the mob/var/damage and use damage as a local variable as a safety measure.
8) if(attack==0)
src<<"You cannot fight in this area."
else if(attack==1)
basicattack()
a) If you are using if() to check ONLY if it's ==1 or ==0 (or something similar, just two variables), read about boolean and it's safety/shortcuts first!!!
b) Why do you want to call a procedure? Just typ out the whole thing under the verb, because right now it'll give you a runtime error from the proc as you did not define the mob you're attacking.
9) mob
proc //Basic attack, basic magic and basic ranged.
basicattack(mob/M in view(1))
As stated before, proc is NOT a verb, meaning it won't look for a mob like that.
10) In mob/verb; src and usr are THE SAME THING.. You have to have some sort if variable keeping track of who each one is fighting.
* There may be a lot more stuff missing but this is what I could find with the lack of sleep I had.
- GhostAnime