ID:146011
 
Code:
    proc
Deathcheck()
if(src.hp<=0)
view()<<"[src] dies!"
src.deaths += 1
src.Move (locate(1,1,1))

and
mob
verb
Attack(mob/M)
set src in oview(1)
statpanel("Skills")
var/damage = usr.str - (M.defense / 1.5)
if(damage<=0)
usr<<"[M] dodges the attack!"
else
M.hp -= damage
if(M.hp<=0)
usr.kills += 1
view()<<"[usr] attacks [M] for [damage] HP!"
M:Deathcheck()


turf
var/race
grass
icon = 'icons.dmi'
icon_state = "grass"
race = "Temp"
race = "Fin"
race = "Krasj"
race = "Mor"
water
icon = 'icons.dmi'
icon_state = "water"
race = "Fin"
race = "Mor"

mob/characters/Temprion
str=15
hp = 50
maxhp = 50
defense = 3
gold = 0
exp = 0
maxexp = 40
level = 1
mana = 2
maxmana = 2
energy = 100
race = "Temp"

mob/characters/Morkron
str=4
hp = 40
maxhp = 40
defense = 7
gold = 0
exp = 0
maxexp = 40
level = 1
mana = 30
maxmana = 30
energy = 100
race = "Mor"

mob/characters/Finity
str=7
hp = 45
maxhp = 45
defense = 5
gold = 50
exp = 0
maxexp = 40
level = 1
mana = 15
maxmana = 15
energy = 100
race = "Fin"

mob/characters/Krasj
hp = 5
maxhp = 5
str=12
defense = 12
gold = 0
exp = 0
maxexp = 40
level = 1
mana = 1
maxmana = 1
energy = 100
race = "Krasj"

mob
var/race



Problem description:1. How do I make it, in the Deathcheck, when the src==M it respawns location it spawned at in the beginning of the game?

2.Also, how do I make attack a vebr you constantly have, but make it only useable when facing a mob? (Removing the oview(1) just lets the user attack any mob from anywhere

3. Plain doesnt work, everyone can walk on everything...


PS: Sorry for the so many question, I'm getting into byond coding :| (finally -.-)

A - No put usr in proc (The view() procedure defaults to usr).

B - The section that goes:

turf
race="blah"
race="blahblah"
race="42"
race="Garthor"


just doesn't make any sense.
In response to Jp
Jp wrote:
> turf
> race="blah"
> race="blahblah"
> race="42"
> race="Garthor"
>


Well, I used The Riddler's video tutorial, and he did it under the icon_state. And it worked on his vid, but not for me... :|

Anyone else?
In response to Mysame
He gave a lot of icon_states for one object? That won't work, what is this video?
In response to CaptFalcon33035
ByondDensity at http://www.riddlersoft.com/ByondPage.htm

Even more problems discovered!

runtime error: Undefined operation
proc name: Stat (/mob/Stat)
usr: Mysame (/mob/create_character)
src: Mysame (/mob/create_character)
call stack:
Mysame (/mob/create_character): Stat()

-------------------------------------------

You can't see the players icon!

mob
icon = 'icons.dmi'
create_character
var/mob/character
Login()
var/charactername = input("Welcome! What is your name?","Character Creation")
switch(input("Choose your Alignment.","Character Creation","Neutral") in list("Heavenly","Neutral","Chaotic"))
if("Heavenly")
usr.alignment = "Heavenly"
if("Neutral")
usr.alignment = "Neutral"
if("Chaotic")
usr.alignment = "Chaotic"
switch(input("What race do you want to be?","Character Creation") in list("Temprion","Morkron","Finity","Krasj"))
if ("Temprion")
character = new /mob/characters/Temprion()
switch(input("What gender?","Character Creation") in list("Male","Female"))
if("Male")
usr.icon_state="TempMale"
else
usr.icon_state="TempFemale"
if ("Morkron")
character = new /mob/characters/Morkron()
switch(input("What gender?","Character Creation") in list("Male","Female"))
if("Male")
usr.icon_state="MorMale"
else
usr.icon_state="MorFemale"
if ("Finity")
character = new /mob/characters/Finity()
switch(input("What gender?","Character Creation") in list("Male","Female"))
if("Male")
usr.icon_state="FinMale"
else
usr.icon_state="FinFemale"
if ("Krasj")
character = new /mob/characters/Krasj()
usr.icon_state="Krasj"
character.name = charactername
src.client.mob = character
del(src)
..()


I'm sick of this! Really!
In response to Mysame
I see nothing in there that shows
atom
icon_state="345"
icon_state="567"
icon_state="1gfd5"

You can't do anything like that because it won't work.
In response to CaptFalcon33035
*sigh*

Aint there a possibility to send someone here the whole code so he/she can figure it out? These 254 lines are taking all of my time o.o...
In response to Mysame
You can send it to me, I'll do it, but you have to be careful about who you trust. My AIM is SuperLlamaLicker, my MSN is [email protected].
Seeing as nobody has actually answered your questions, I guess I'll have to. =) Be warned, though; I generally don't hand people code. I prefer to tell you what needs to be done and how to do it, and let you figure out the rest on your own. Do ask for more help if you get stuck, but the more you can work out yourself the more you will learn, and the less you will have to ask next time!

Mysame wrote:
Problem description:1. How do I make it, in the Deathcheck, when the src==M it respawns location it spawned at in the beginning of the game?

These words, I do not think they mean what you think they mean. ;-) "src" and "M" are just variables, and "M" doesn't exist in the Deathcheck proc, so "src==M" won't even compile. =)

By "src==M", I'm assuming you mean "if src is not a player".

To respawn monsters at their original locations when they die, you need to do two things:

1. Check to see whether the dying mob is a monster.
2. If it is, move it to its original location. To do this, you have to know what its original location was.

#1 can be achieved using an if() statement and the istype() proc (look it up in the DM reference - press F1 in Dream Maker).

#2 is really two things in disguise; firstly, you need to have the monster remember its original location. (Do this by giving mobs a new variable, and setting that variable to src.loc in the monster's New() proc.) Secondly, you need to move it there when it dies. (Do this by setting src.loc to the variable you created.)

2.Also, how do I make attack a vebr you constantly have, but make it only useable when facing a mob? (Removing the oview(1) just lets the user attack any mob from anywhere

Remove the "set src" line and the "M" argument. Then, as the first line in the verb, create a var called "M" and set it to a mob in front of you.
var/mob/M = locate(/mob) in get_step(src, src.dir)


3. Plain doesnt work, everyone can walk on everything...

Of course they can, because you didn't tell the game that they couldn't. You just created a couple of vars called "race" and gave them values. The computer doesn't know what you wanted those vars to do; it can't read your mind. There's a quote from somwhere: "Computers always do what you tell them to do, but almost never what you actually wanted them to do." This is especially true of programming.

What you need to do is find a way of telling mobs whether or not they can enter the turf. There's a built-in proc that's exactly for this purpose, called Enter(). Look it up in the DM reference for an example.
In response to CaptFalcon33035
But how will he learn that way? Geez, newbies have it so easy these days. ;-)
In response to Crispy
Lol, I'll comment everything then. I already have it, and everything's fixed, but as soon as he handed it to me, he left.

But that's true. When I first started, there was no one around to help me out. Of coarse there were people, but I didn't know about the forums.

I still think of myself as a newbie though. Anyone care to cod anything for me?
In response to Crispy
Or instead of setting a variable to an old location, you can respop. <_<
In response to CaptFalcon33035
*pets Capt*

Look on the brighter side... people suffered more than you from newbs -_-'' Speaking from experience...

You know they did not read developers FAQ if they don't know what "Inconsistant indention" means -_-'''
In response to GhostAnime
Lol, I don't "suffer" from newbs. It's my choice to help them. I enjoy it, and if I see something I don't feel like doing, I just don't reply.
Mysame wrote:
1. How do I make it, in the Deathcheck, when the src==M it respawns location it spawned at in the beginning of the game?

Well first of all, there is no M in Deathcheck(). But if there is, M should never match src unless a player accidentally killed themselves. Deathcheck() should be called with an argument that tells it who the killer is.

You're also calling your Deathcheck() proc wrong.
// wrong
M:Deathcheck()

// right
M.Deathcheck(usr)


Note the two differences. First, you should not be using the : operator under any circumstances because you don't know how to use it properly (which is seldom if at all). Second, I added usr as an argument to Deathcheck() so the proc can be told who the killer is. Currently your code doesn't need that, but if in the future you want to keep track of that information, better to add it now.

2.Also, how do I make attack a vebr you constantly have, but make it only useable when facing a mob? (Removing the oview(1) just lets the user attack any mob from anywhere

Add this line at the beginning of your Attack() verb:
if(!M || !(M in get_step(usr,usr.dir))) return


The if(!M) check is important and should have already been there; otherwise someone using a macro to attack more quickly will generate "cannot read null.defense" errors if a monster is slain.

Normally you'd also want to check oview() again, because commands can get stacked up at the client end and then run all at once at the server end, by which time M may have moved to a whole new location. In this case, though, the get_step() check makes that unnecessary.

As a matter of fact, you might do very well to take the M argument out of Attack() entirely, and instead loop through all mobs in get_step(usr,usr.dir), like so:
verb/Attack()
for(var/mob/M in get_step(usr, usr.dir))
...


3. Plain doesnt work, everyone can walk on everything...

I don't see anything about a plain there.

Lummox JR
In response to Lummox JR
Yeah well, I had a var for that Var/Race , forgot to copy/paste..

And I learned everything from movies/tuts I saw on byond sites and remember what they do.. Now I seem it just doesnt work out :)

As soon as I'll get home I'll get back on AIM, thanks for everything guys!