ID:174846
 
Ok first how would I make different monsters spawn at different times like i want newbie monsters to spawn faster than boss monsters! my code is :
/mob/monsters
var/tmp/TreasureHunt
var/tmp/GetItems
Dog
icon = 'dog.dmi'
Hp = 12
MaxHp = 12
Strength = 10
Skill = 8
Agility = 9
Knowledge = 7
Intelligence = 7
Wisdom = 4
Endurance = 9
AggressiveMode = 0
TotalExperience = 10
Delay = 1.4
Level = 1
Ranger
icon = 'Ranger.dmi'
Hp = 25
MaxHp = 25
Strength = 14
Skill = 12
Agility = 13
Knowledge = 14
Intelligence = 9
Wisdom = 5
Endurance = 15
AggressiveMode = 0
TotalExperience = 15
Delay = 1.6
Level = 2
GetItems=1
Bat
icon = 'bat.dmi'
Hp = 15
MaxHp = 15
Strength = 12
Skill = 10
Agility = 15
Knowledge = 5
Intelligence = 5
Wisdom = 4
Endurance = 10
AggressiveMode = 0
TotalExperience = 11
Delay = 1.2
Level = 1
Tiger
icon = 'tiger.dmi'
Hp = 45
MaxHp = 45
Strength = 32
Skill = 18
Agility = 25
Knowledge = 6
Intelligence = 12
Wisdom = 14
Endurance = 20
AggressiveMode = 1
Weapon = 5
MaxWeapon = 10
TotalExperience = 30
Delay = 1.6
Level = 6
Lizard_Man
icon = 'lizard_man.dmi'
Hp = 85
MaxHp = 85
Strength = 45
Skill = 35
Agility = 20
Knowledge = 18
Intelligence = 19
Wisdom = 15
AggressiveMode = 1
Weapon = 12
MaxWeapon = 15
ArmorClass = 35
TotalExperience = 45
Delay = 2
Level = 12
TreasureHunt = 1
GetItems = 1
New()
Random_Move()

proc/Random_Move()
if (!invisibility)
if (!Target)
var/mob/M
for (M in view())
if (M.client && !M.invisibility && !M.GMCheck())
Target = M
else
if (get_dist(src,Target) > 10 || src.z != Target.z)
Target = null
else
step_towards(src, Target)
if (!Target)
var/obj/O
var/Found_Obj = 0
if (TreasureHunt)
for (O in oview())
if (!Found_Obj)
var/Loc = src.loc
step_towards(src, O)
if (Loc != src.loc)
Found_Obj = 1
if (GetItems)
for (O in oview(0))
if (istype(O, /obj/Money/Gold) || istype(O, /obj/Money/Silver) || istype(O, /obj/Money/Copper))
O:Get()
else
O.Move(src)
if (!Found_Obj)
step_rand(src)
spawn(30) Random_Move()


Also, I would want to make monsters drop items and how would i do that? My code for combat is this :


/client/Center()
usr.Aggressive_Mode()
/mob/verb
Aggressive_Mode()
if (AggressiveMode)
AggressiveMode = 0
else
AggressiveMode = 1

/mob/Bump(mob/M)
if (Check_SafeZone(usr, M)) return

if (usr.Wait || !ismob(M) || !AggressiveMode || M.NPC || M == null)
return
if (!usr.client && !M.client)
return
usr.Wait = 1
if (M.CheckPowerSlash()) return
spawn (usr.Delay * 10) usr.Can_Attack()
var/Damage = rand(round(Strength / 15) + Weapon, round(Strength / 5) + MaxWeapon)
Damage -= round(M.ArmorClass / 5)
var/Check_Hit = (rand(Skill) + Skill / 2) - (rand(M.Agility) + M.Agility / 2)
if (Check_Hit)
if (Damage > 0)
view() << "[usr] struck [M] for [Damage] Hp!"
M.Hp -= Damage
else
view() << "[usr]'s attack doesn't even scratch [M]!"
else
view() << "[usr] swings at [M] but misses terribly!"

if (!M.client) M.Target = usr

M.Check_Death()

/mob/proc/Can_Attack()
usr.Wait = 0

/obj/Level_Up
icon = 'level up.dmi'

Click()
usr << "You've gained a level!"
usr.Level++
var/Exper = round(100 * log(500, usr.Level))
usr.ExperienceNeeded = Exper * Exper
//usr.ExperienceNeeded = round(500 * 1.5 * usr.Level + Exp(1.55, usr.Level))
var/A
for (A = 0; A < 5; A++)
var/list/menu = new()
menu += "Strength"
menu += "Skill"
menu += "Agility"
menu += "Knowledge"
menu += "Wisdom"
menu += "Intelligence"
menu += "Endurance"
var/Result = input("Raise which attribute ([A+1] of 5)", "Level Up", null) in menu
switch (Result)
if ("Strength") usr.Strength ++
if ("Skill") usr.Skill ++
if ("Agility") usr.Agility ++
if ("Knowledge") usr.Knowledge ++
if ("Wisdom") usr.Wisdom ++
if ("Intelligence") usr.Intelligence ++
if ("Endurance") usr.Endurance ++
if (istype(usr, /mob/player/Warrior))
usr.MaxHp += 5
usr.Hp += 5
usr.Strength ++
usr.Endurance ++
else if (istype(usr, /mob/player/Knight))
usr.MaxHp += 3
usr.Hp += 3
usr.Strength ++
usr.Skill ++
else if (istype(usr, /mob/player/Paladin))
usr.MaxHp += 2
usr.Hp += 2
usr.MaxSp += 2
usr.Sp += 2
usr.Strength ++
usr.Knowledge ++
else if (istype(usr, /mob/player/Cleric))
usr.MaxSp += 4
usr.Sp += 4
usr.Knowledge ++
usr.Wisdom ++
else if (istype(usr, /mob/player/Sage))
usr.MaxSp += 3
usr.Sp += 3
usr.Knowledge ++
usr.Intelligence ++
else if (istype(usr, /mob/player/Wizard))
usr.MaxSp += 5
usr.Sp += 5
usr.Knowledge ++
usr.Intelligence ++
else if (istype(usr, /mob/player/Spellsword))
usr.MaxSp += 2
usr.Sp += 2
usr.Strength ++
usr.Intelligence ++
else if (istype(usr, /mob/player/Bard))
usr.MaxHp += 2
usr.Hp += 2
usr.MaxSp += 1
usr.Sp += 1
usr.Agility ++
usr.Knowledge ++
else if (istype(usr, /mob/player/Rogue))
usr.MaxHp += 3
usr.Hp += 3
usr.Skill ++
usr.Agility ++
else if (istype(usr, /mob/player/Assassin))
usr.MaxHp += 3
usr.Hp += 3
usr.Strength ++
usr.Agility ++
usr.MaxHp += round(usr.Endurance / 3)
usr.Hp += round(usr.Endurance / 3)
if (!istype(usr, /mob/player/Warrior) && !istype(usr, /mob/player/Knight) && !istype(usr, /mob/player/Rogue) && !istype(usr, /mob/player/Assassin))
usr.MaxSp += round(usr.Endurance / 3)
usr.Sp += round(usr.Endurance / 3)

And last but definitely not least could you help me with a problem ive been having because the monsters spawn one after another so eventually if noone kills the monsters it could fill up the whole screen. So how would I make it so the countdown for the next spawn doesnt happen until AFTER the monster dies!
-I would love it if you could help me! TY And sorry for the such long post!
Big usr problems here.

First and foremost: Do not put usr in Bump(); it's totally wrong there, and in any movement-related proc.

The second thing is similar: Your AI procs are all using things like view(), but since procs like view() default to using usr as a point of reference, you've got another usr-in-proc problem. That is, usr isn't safe in procs unless you've kept perfect track of where it came from. What you need to use is src, so that should be view(src), and so on.

Likewise usr is wrong in mob/proc/Can_Attack(). However it's okay in Click() and in client/Center() because those are technically verbs.

Lummox JR
In response to Lummox JR
Yah well thats all in good and im thankful that you helped me but you answered NONE of my questions :P!
In response to Dalze
He answered a question you would be asking later if you continued using usr in your procs.
In response to Garthor
Well, TY but still I know thats a problem because ive already fixed that in my game so all I need to know is about the questions i asked. But anyway Thank You all for your help1