ID:150005
 
Well, I am trying to add spell affects to Trinity, currently I have used a proc, but the proc is cancelled if the player logs offline, which means they keep the spell indefinitely. I was wondering if there is an easier way to do this sort of thing?

Another problem, I want to make it so you can use a battle verb, then it disallows you to use any other verbs for such and such an amount of time (if you've played a text mud, you might know of such skills, like kick or circle), any idea how I might do this a SIMPLE way? (I don't want to delete all the verbs from the char then add them back, or anything weird like that). Currently I have a special variable thing that works good, but it rather confusing to newbies.
You could create a var called inbattle (which could be used for a few things!) and add the following snippet to all of your verbs: if(inbattle) return

That would not make them dissappear, but it would make them unisable if you are in a battle (assuming inbattle is set to 1 when you enter battle)

-me
An easy way to make spell affects disappear after a certain amount of time is to use my personal lord and savior, the associative list.

It works like this.

mob
var
list/effects = list()

mob/proc/poison_me(duration as num)
src.effects["poison"] = duration

I assume you have a proc that's called every so often for healing/hunger/whatever... put something like this in that code:

for (var/e in src.effects)
src.effects[e] -= 1
if (src.effects[e]) src.effects.Remove(e)
In response to Lesbian Assassin
Lesbian Assassin wrote:
An easy way to make spell affects disappear after a certain amount of time is to use my personal lord and savior, the associative list.

It works like this.

mob
var
list/effects = list()

mob/proc/poison_me(duration as num)
src.effects["poison"] = duration

Definitely useful if your effects are very simple...I tend to use an object for the effects and store that. The object is called each tick to do anything it might want and tracks its duration.

This puts the functionality into the spell object instead of a central spell-handling proc, which is probably the biggest benefit from it.
In response to Deadron
I do the same thing. I've come to use objects rather obsessively since coming to BYOND.

-AbyssDragon
In response to Deadron
I am planning on effect objects to store temporary information on possibly multiple variable modifiers that can be saved. However, I am planning on updating the effects when what they are affecting is being updated. The effect could handle the update, but the update would be triggered by the affected.

For one thing, I might not have to update each effect object every tick. For another, I might not have to make every effect time based. I can update certain effects whenever the affected is updated, moved, bumped or whatever I choose.

Of course, I'm probably still trying to upgrade ROM code in my head. Plus, it's currently vaporware. *shrug*
In response to ACWraith
Take a look at my Effects demo, its one option although it has room for improvement. It basically uses an Effect datum for each spell effect(Which may have multiple effects, confusing!), using associative lists.

I should probably update it to allow for special things to happen, like client.eye being twirled around to simulate a "dizziness" effect(If, for example you were using it for a drunk effect of sorts) through a Special() proc in each effect or something of the sort.


Alathon
In response to ACWraith
Take a look at my Effects demo, its one option although it has room for improvement. It basically uses an Effect datum for each spell effect(Which may have multiple effects, confusing!), using associative lists.

I should probably update it to allow for special things to happen, like client.eye being twirled around to simulate a "dizziness" effect(If, for example you were using it for a drunk effect of sorts) through a Special() proc in each effect or something of the sort.


Alathon