I just started trying to make a game on BYOND by learning the basics. But I cant even get my character to appear! He's on the map, because if I press the directions around n hit attack, it says "you hit monster for 7 damage!" Why can't I see my character? Do I have to add the character onto the map? I made an icon for my char, a blue stick figure. someone plz help me!
Here's all my mob code:
mob
person
icon = 'person.dmi' //all mobs will be person.dmi
var
HP = 30 //new var HP is 30
Login() //mob procs must be capitalized!
icon_state = gender //when a player logs in, make their icon's state
..() //the gender of their key
bug //new prototype
icon = 'bug.dmi'
proc
DeathCheck() //checks if the attack was deadly
if (HP <= 0) //if the defender's HP is low enough...
world << "[src] dies!" //show death msg
What am I doing wrong?
ID:262616
Sep 24 2005, 8:09 pm
|
|
Sep 24 2005, 8:17 pm
|
|
1> Make sure to put your code in the
|
In response to Soccerguy13
|
|
Soccerguy13 wrote:
You are not even setting the sources gender variable. That would be because player mobs already have a gender equal to that of their client's key's gender. Make sure that to set gender to an applicable icon_state. It is trying to show an icon state that probably does not exist. This is a valid point. You should have icon states for each of the following:
As for something from the original post, Login() //mob procs must be capitalized! The part where it says "//the gender of their key" doesn't correctly describe what the ..() procedure is doing. Login() is a built-in proc and, as probably at least 98% of all built-in procs do, it has coding that would normally need to be run built in with it. Using the ..() procedure allows you to carry out all of the built-in commands of mob/Login(). The part where it says "mob procs must be capitalized!" only applies to built-in procs. Procs that you define yourself for mobs can be capitalized in whatever manner suits you. On another note, in relation to the first post, be sure you are setting world/mob to /mob/person , so that the world knows that by default, your mob should be of the person type. world Now you specifically mentioned that the error occurs after you attack. I think it would be appropriate then to post your attack procedure so that we could examine it and root out all possibly deadly flaws for you. Hiead |
Cyvyr-X wrote:
I just started trying to make a game on BYOND by learning the basics. But I cant even get my character to appear! He's on the map, because if I press the directions around n hit attack, it says "you hit monster for 7 damage!" Why can't I see my character? Do I have to add the character onto the map? I made an icon for my char, a blue stick figure. someone plz help me! ---------------------------------------------------------- Well, you're on the right track but you specified it as "mob/Login()" wich will apply to all mobs, players and non. simply the icon state for the npc has been nulled because it has no icon state for neuter. Try this... mob |
In response to Hiead
|
|
Thanks for all the help!
As for the attack code, there is supposed to be a problem. the tutorial wants me to find and fix. Again, thank you very much for all of the help! |
In response to Cyvyr-X
|
|
mob That is all my code. A character is still not appearing. I have no idea knowing what's going wrong... This is the first attempt to even try to lean to code games on BYOND. Please help... |
In response to Cheetoz
|
|
Cheetoz wrote:
Well, you're on the right track but you specified it as "mob/Login()" wich will apply to all mobs, players and non. Actually, mob/Login() is only called when a client connects to a mob, or "logs in." New() is the proc that both player and non-player mobs call when they are created. Hiead |
In response to Cyvyr-X
|
|
Cyvyr-X wrote:
mob What's that? I think you're going for world Which would go down at the bottom with your world/turf setting. Hiead |
In response to Hiead
|
|
mob
person icon = 'person.dmi' //all mobs will be person.dmi var HP = 30 //new var HP is 30 Login() //all already input procs must be capitalized! ..() if(src.client) icon_state = "male" //changes from forum bug //new prototype icon = 'bug.dmi' proc DeathCheck() //checks if the attack was deadly if (HP <= 0) //if the defender's HP is low enough... world << "[src] dies!" //show death msg verb attack(mob/M as mob in oview(1)) //attack mob within 1 tile of you usr << "You attack [M]!" //sends message to usr oview() << "[usr] attacks [M]!" //tells everyone else you attacked [M] var/damage = rand(1,10) //assign a random # to a new var world << "[damage] damage!" //tells damage to the world M.HP -= damage M.DeathCheck() //uses the proc to chekc for death in the mob say(msg as text) world << "[usr]: [msg]" //usr's words in msg. usr name in usr turf grass icon = 'grass.dmi' //grass will hav the icon grass.dmi world turf = /turf/grass /mob/person |
In response to Cyvyr-X
|
|
Cyvyr-X wrote:
> world No, no, no, no, [etc.] world In addition, mob Change that to mob Hiead |
In response to Hiead
|
|
mob |
In response to Cyvyr-X
|
|
Cyvyr-X wrote:
mob I specifically recall changing that to: mob > world </dm> I sense an indentation error. Try pressing Ctrl + t in the .dm window, and it will show you where your tabs are. Remember, you shouldn't have any spaces in your indent. Hiead |