ID:151638
 
Now I've been thinking about adding in a trait or perk system, which is for those who didn't know.

After certain requirements or after a number of levelups, you would gain something special.

Eagle Eye
You gain a 10% boost to your accuracy.


I was thinking how would someone set that up or just some thoughts on if that system would be any good.
Here's something generic I wrote up a while ago for temporary buffs:

mob
var/strength = 0
var/list/buffs

verb/test()
for(var/v = 0, v < 3, v++)
var/buff/B = new()
B.duration = 100
B.apply(src)
sleep(10)
var/savefile/F = new("test.save")
F << src
world << F.ExportText()


buff
parent_type = /obj
var/tmp/duration = 0
var/tmp/fadetime = 0
var/mob/target
proc
apply(var/mob/M)
target = M
if(!M.buffs)
M.buffs = list(src)
else
M.buffs += src
spawn() start()
start()
fadetime = world.time + duration
spawn(duration) end()
end()
target.buffs -= src
if(target.buffs.len == 0)
target.buffs = null //null out the list when it's empty
del(src)

Write(var/savefile/F)
..()
var/timeleft = fadetime - world.time
F["timeleft"] << timeleft

Read(var/savefile/F)
..()
var/timeleft
F["timeleft"] >> timeleft
fadetime = world.time + timeleft
spawn(timeleft) end()


strength
var/potency = 10
start()
..()
target.strength += potency
end()
target.strength -= potency
..()


Obviously it would work just as well for permanent bonuses.
In response to Garthor
I guess that would be one way of doing it, but I was thinking more along the ways of also adding skills and such.
In response to Lundex
Nothing in what I wrote prevents you from using it to add skills.
In response to Garthor
Yeah, I see that only one question why use objs?
In response to Lundex
For the potential to easily display them in some manner, rather than being entirely hidden.
In response to Garthor
I remember this from forever ago (thanks again, Garthor), but yes, Lundex, this system is so easy to expand on -- from what I've done with it, it makes displaying them simple, you could put alpha over it when it is going to fade, you can do overtimes.. and you can link it to a skill system easily.