ID:1603930
 
(See the best response by FKI.)

mob
Ork1
icon = 'Ork1.dmi'
density = 1
verb
Attack()
set src in oview(1)
if(usr.enemyhp <= 100)
world << "\red You have attacked the Ork!"
usr.def -= usr.enemystr
else
usr.enemyhp = 75
usr.enemystr = 25
usr.def -= usr.enemystr
sleep(10)
usr.hp -= usr.enemystr
world << "\red The Ork attacked you for [usr.enemystr] damage!"
usr.DeathCheck()
sleep(10)
usr.enemyhp -= usr.str
world << "\red You attacked the Ork for [usr.str] damage!"
if(usr.enemyhp <= 0)
world << "\red You have defeated the Ork!"
usr.Gold += 25
usr.Exp += 25
usr.enemyhp = 100
new/obj/Ork_Blood (usr)
usr.LevelCheck()
del src
else
world << "\red The Ork has [usr.enemyhp] health!"


My Ork does 0 damage nomatter what I put my variables at. Could you gusy fix this code up for me?

Is the player supposed to be the Ork? Or is the Ork supposed to be an enemy?
the ork is the enemy.
This code is inoperable at best. I don't think you've got the basic understanding on how to use DM, or even the basics of game design. Fixing it for you will just encourage you to keep coming here to get others to fix it. If someone explains whats wrong, it'll take longer than necessary. I suggest you use byond resources for reference and read the dm docs.

http://www.byond.com/developer/Deadron/CombatSystem
That'll help you with a basic combat system.

http://www.byond.com/developer/Forum_account/EnemyAI
This shows you how to use AI in your game. Probably a little advanced since it doesn't really comment on everything.

http://www.byond.com/docs/guide/
I reaaaally suggest you read (or reread) this. It helps you understand the DM language better. I know it'll take a few hours to read but if you don't a lot of your code will end up broken and you'll have to come to this forum (just like me, ha) to get someone to fix up every piece of your code.
Best response
Everyone starts somewhere. Here is a quick example that should you help you, Flying1Ace. Really understand the structure and idea behind the programming (compare my example to what you wrote and analyze the differences).

//combat.dm
mob
var/strength = 10
var/current_health = 1000
var/maximum_health = 1000

verb/attack()
var/mob/hit = null

for(var/mob/m in get_step(usr, usr.dir))
hit = m
break

if(hit)
hit.take_damage(usr.strength, usr)

proc/take_damage(damage, mob/attacker)
//handle damaging here.

src.current_health = max(0, src.current_health - damage)
if(!src.current_health)
src.die(attacker)

proc/die(mob/killer)
//killer has killed me! handle it here.


Notice how things are to themselves (isolated) in the code. This helps give the code a consistency that makes it easy to traverse through it later. Also, you want to use better names for your variables (imagine coming back to the code you posted in three months).
This is not how enemy AI works, at all.. :/

I suggest you listen to Gluscap, but just to point out some stuffs:

1) You do realize that all you're doing is giving the Ork a attack verb, right? You, at no given point in time, actually tell it to do something with said verb.

2) You should probably turn that attack verb into a proc, and you shouldn't be defining a attack verb per mob, that's just silly, wasteful and completely unnecessary. You should be doing something along the lines of this instead:
mob/AI
// AI , define specific mobs beneath, etc etc

This way you can just put new NPC's under mob/AI and they'll automatically inherit the Ai

You apparently have ZERO interest in actually learning the DM language. You just want to be spoonfed pieces of code that you'll copy and paste directly into your game and then proceed to cry in forums about how it doesn't work the way you expect, despise not heeding the clear warnings that everybody gives out to you that code posted here is -not- meant to be copy pasted.

This is all quite evident in all your previous post and this one as well, and I quote:
Could you gusy fix this code up for me?

Hm, how about no.

You continue to ignore everybody's replies. In literally every single one of your posts at least one person redirects you to the guide. A suggestion which you obviously have still rejected on trying out till this day.

Have you caught on yet? you need to read the guide and stop wasting our time

When you have read the guide and I mean actually read the guide and try out things on your own, then we'll be more then glad to actually assist you.

Honestly every single post I see made from you just makes me upset. I don't understand how everybody else puts up with your nonsense
I learn by having my mistakes shown to me and then being shown how to fix them. Notice how each post is about a different subject? I am eager to learn and play with byond, but I don't know how to learn to code, so I ask the people who do. And don't say go read the DM guide cause I have read that over and over without finding anything that could help me with my problems. Instead of making yourself look like an idiot could you please explain what an AI is? And what else I can do with it? Thank you. Thanks FKI and Gluscap for your actually helpful replies. I'll look into those pages shortly.
I can't tell if you are trolling.
I learn by having my mistakes shown to me and then being shown how to fix them. Notice how each post is about a different subject?


False

Relating to zombies, which btw, also have the same problem you are experiencing now, they do no damage. I'm just pissed off that you say you keep saying you fixed them at the end of the post but then create a new one talking about the same issue you claim had been resolved on the previous topic.

http://www.byond.com/members/ Flying1ace?command=view_post&post=1598227&first_unread=1

http://www.byond.com/members/ Flying1ace?command=view_post&post=1539706&first_unread=1

Note on the link directly above me you were still having issues with the Health/Thirst , the same issues you were having before:

More topics relating to these exact same health issues..

http://www.byond.com/members/ Flying1ace?command=view_post&post=1539171&first_unread=1

http://www.byond.com/members/ Flying1ace?command=view_post&post=1600730&first_unread=1

And no. I am not going to explain what AI is, because somebody has already provided you with links that will do exactly that (refer to Gluscap).

Knowing you you'll just come back saying you didn't understand anything in the links given and will be asking for actual code. You need to look up AI in the Developer's resources, there's quite the bunch of libraries that will undoubtedly help you out, if you actually try to understand and play around with them of course.

I'm out of here
And good riddance.
Glad to know trying to help you out makes you consider me as an troublesome/unwanted person.

I bet you're still waiting for someone to spoon-feed you some actual code.
Actually I have decided to forget you and figure it out myself.
Post the code here when you're done ;)
suuuuuuure.....
In response to FishMan123
FishMan123 wrote:
Post the code here when you're done ;)

It's secret code if it works.