ID:270269
 

How do i make an attack system were i can get lvls, make my skills go up when i get a lvl and make monster drop gold/ items(gold is good enought but if u know how to make them drop items to it would be good.) it will be nice if some tells me plz. ty
Euhm. Go out reading some tutorials.
In response to Mysame
i read tons of them and couldent find any.
In response to Stone_Cold_Oven
Couldn't find any? I find that hard to believe. Search for "attack system" or "battle system" and you should get some good libraries and demos...

In response to Bobthehobo
i got a attack system but icant make the monster attack me and i dont know how to make it drop gold this is what i got so far.


mob
var
hp = 100
maxhp = 100
maxexp = 100
level = 1
strength = 15
defense = 5



proc/death_check(mob/M as mob)//handles death
if(src.hp <= 0)
M <<"You killed [src]!"
if(src.client)
src <<"[M] killed you!"
src.loc = locate(1,1,1)
src.hp = src.maxhp
else
src <<"You have been killed by [M]!"
del(src)




proc/stat_up()
src.strength += rand(2,10)
src.defense += rand(3,10)
src.maxhp += rand(1,20)
src.hp = src.maxhp
src <<"\blue You begin to feel stronger as your stats increase!"



proc/level_up()
if(src.client)
if(src.exp >= src.maxexp)//if the players exp matches or is higher then the players maxexp
src.stat_up()
src.level += 1//adds a level
src <<"\red You gained a Level!"//informs player that they gained a level
src.maxexp *= 2//doubles the max exp by 2
src.exp = 0//exp back to zero
else
return..()


verb/Attack(mob/M in oview(1))
set category = "Battle"
var/damage = src.strength - M.defense
if(M.client)
M.hp -= damage
src <<"You attack [M] for [damage]!"
M <<"You are being attacked by [src]!"
src.level_up()
M.death_check(src)
else
M.hp -= damage
src <<"<font color = Green>You attack [M] for [damage]!"
M <<"<font color = Green>You are being attacked by [src]!"
var/random = rand(1,3)
if(random == 1)
src.exp += 4
if(random == 2)
src.exp += 3
if(random == 3)
src.exp ++
src.level_up()
M.death_check(src)

mob
villan
Monster
icon = 'monster.dmi'
name = "cat"
hp = 200
strength = 15
defense = 9
var/mob/character/player
New()
. = ..()
spawn(1)
move()
proc/move()
while(src)
var/player_found = 0
for(Player in oview(8,src))
step_towards(src,Player)
player_found = 1
break
if(player_found != 1)
step_rand(src)
sleep(10)
sleep(5)

Bump(mob/M)
if(istype(M,/mob/character))
attack(M)
proc/attack(mob/M)
var/damage = rand(1,strength)
M.hp -= damage
M <<"You are being attacked by [src]!"
src.exp += rand(5,10)
src.level_up()
M.death_check(src)




mob
character
icon = 'char.dmi'
hp = 100
maxhp = 100
exp = 0
maxexp = 100
level = 1
strength = 15
defense = 6

the monster is walking around and i can kill it but it wont att me and it wont drop gold.
In response to Stone_Cold_Oven
please when your writing code use the DM tags
In response to A.T.H.K
Stone cold, the main problem is that you're copy/pasting, thus not learning anything. You need to understand the code, and
then breed some logic inside your head on how to do stuff.
Normally, when someone asks a developer to do something, his head is mostly filled with 5 ideas on how to do in it less than a minute.
By copy/pasting, however, this will never happen, and you'll always be posting every tiny thing in this forum.