ID:160056
 
Hello,


I am working on a game I'm creating and it is going great. The problem is I'm new at codeing. But I'm getting through it alright. I'm haveing trouble with a battle system that you can train. I want it so that you can do Push ups and they raise strength and Sit ups raise Defense they will raise .05 skill. and that is how much you hit when you hit an enemy. but defense does the opposite. It will subtract how much HP gets taken away from you when you get hit. There will be no Levels in the game it will just go by that. and each Mob will have 50HP. Latter I want like Lifting weights and things like that but im not worried about it yet. Can anyone help me with this code? Or show me where I can find somthing to help me out? Iv been looking all over on the website but cant find anything. Help would be apretiated.

Thanks.
This is generally just a matter of using variables:

mob //give players these variables (or monsters!)
var
strength=5
defense=1
health=50


//All of the above variables are now assigned to all mob types, so you can reach them\
at will! For example:




obj
weight //make a new object called "weight"
var
pounds=5 //5 pounds
verb
lift()
set src in view(0) //Have to be under the user to use the weights!
usr<<"You lift [src]!" //Only use 'usr' in variables if\
the verb doesn't belong to the mob executing the command. 'src'\
in this case, is the weight!

usr.strength++ //Strength goes up, see? Easy as that!

//Here's how you can do pushups!
mob
verb
pushup()
src<<"You do a push up!"
defense+=0.5 //not exactly sure why pushups give defense, but what the hey,\
it's only an example!



//Then, incase you're wondering how to use these variables for combat, you could\
do something like this!:


mob
verb
punch(mob/m in get_step(src,dir)) //punch someone in front of you, you're no ninja yet!
view()<<"[src] punches [m]!"
var/damage=strength-m.defense //make a variable that takes your strength and minuses\
it from m's defense. You can use this however you want, maybe with your own formula...

view()<<"[m] takes [damage] damage from [src]'s punch!" //apply the variable here..
m.health-=damage //and apply the variable here!
//m.death_check(src) Just throwing it out there.
In response to Speedro
Thank you so much man, acully its the sit ups that give defense lol. Thanks though, I can fix that part but you dont know how happy this makes me.
In response to Speedro
Oh yeah one more question for you, How do I set how much strength you get from lifting the weight?
In response to Hillwood
Wait never mind I got it thanks.
Hillwood wrote:
Iv been looking all over on the website but cant find anything.

I find it astonishing that you found the Developer Forum, but not the DM guide which is actually just the link below it, but very useful if you are just starting on programming.

How did you search?

(Please don't get me wrong, this question is with the best intentions on improving BYOND)
In response to Schnitzelnagler
Well on the search bar on the upper right (mostly before the new one) I would type pretty much everything like 'Attack, Defense, No level system, ext. Also Iv been reading the DM guide and reference, but its a bit hard for me to understand, but I'm trying.
You add and subtract things accordingly. Also remember the DM guide is your friend, it will teach you all the basics (and even some of the not so basics). The only thing it can't teach you are interfaces and new procs and args for old procs.

mob/var
abs = 0 //defense
biceps = 0 //strength
HP = 50

mob/verb/Situp() //define a new verb
abs += 6 //add to their abs variable (defense)
mob/verb/Pushup() //same as above, but with the biceps var (strength)
biceps += 2

mob/verb/Punch(mob/M in oview(1))
var/damage = (biceps+rand(1,10))-M.abs /* this is a damage formula. It will add together the src's
biceps var (strength) and a random number between 1 to 10
and then subtract the person who's getting hit's abs var (defense)*/

if(damage <= 0) //if the damage is less than or equal to 0
view() << "[src] misses!"
return //end the current proc right here. Nothing
//else will be done in this
M.HP -= damage //subtract the damage from their health
view() << "[src] hits [M] for [damage] damage!"
I have checked if theres any sites but i have not found any. i have no idea how to make a game at all lol but i can d icons so if you need icon work i can help
In response to HaydenMichie
Cool man that would be great, I need alot of icons, Can you email me at [email protected] or add me on msn or somthin?