Please check out newbie central to see whats happening then read this. I am now supplying my made from scratch battle system code. Here it is, please help somebody, I expect the problem lies where I asked it to check if the mob is a person (client) or npc. Yes I did comment it
area///Defines the given space as an area
Battle///Gives the area a name
Entered()///When the user enters the Battle Area
if (usr.Play == 1)///Check to see if the user's Play stat = 1
switch(input("Battle Options")in list("Battle","Cancel"))//If so display a box asking the user to chose either Battle or Cancel
if("Battle")///If the user selects Battle
for(var/mob/M in oview(4)///If another mob is 4 icons or less away from the user
if(M.client)///Check to see if the mob is a person
M.Health -= 10///If so, subtract the given amount of HP from the opponent mob
if("Cancel")///If the user selects Cancel
..()///Go on as it was before
else///Otherwise, if the user's stat does not = 1
usr << "It is your opponents turn first"///Alert the user that it is not his/her/it's turn
world << "It is your turn"///Alert the other user that it is his/her/it's turn
return///Go on as it was before
ID:261818
![]() Aug 10 2003, 4:00 am
|
|
![]() Aug 10 2003, 4:05 am
|
|
Well, for one you have usr in a proc. Very unsafe and could possibly be the cause of your error. For another input() by default has usr in it, and that will need to get changed, too.
|
Entered() usually has as argument passed to it. You'd normally have something like Entered(atom/A) (check the reference for more info). You would use what Entered() passes to you in place of usr. You'f have to make sure that it's a mob, and has a client attached to it first, before doing anything with it, in case you have a wandering NPC obj.
|
Well i'll try it, I got it to check if its a client before alerting the user of the Battle Options. Let me check out the reference and do a little studying. Thanks for your help, if I don'tget this working Ill show u wut uve got so far
|
I must stress again, as Jon88 mentioned, not to put usr in a proc--particularly in a movement proc like Entered().
That also means you have to ditch input() as your means of beginning a battle, or specifically direct it to the player. And in the process, you also need to check that the mob even has a client. Also, as Jotdaniel said, you need to put your code in DM tags. Finally, I'll add that a comment is two slashes, not three, and you should put some space before each one so they don't butt up against the code. The way you've got everything right now it's nigh unreadable. Lummox JR |
I keep hearing people say to use the dm tags for your code, but I never do because no one says what it actually does. What exactly does it do?
|
I keep hearing people say to use the dm tags for your code, but I never do because no one says what it actually does. What exactly does it do? It prevents wrapping, spaces the code properly, and takes everything inside literaly(ie: HTML tags and various macros won't have an effect). |
To expand on that: http://bwicki.byond.com/ByondBwicki.dmb?DmTags
|