Value regenerating over time...

How to do?

Yeah, guess I'm flooding the board with my questions. Sorry about that.

This time I'd like to know if there's a way to let an attribute value increase over time.
I have a Mana value, which drops every time the player casts a spell. Now I want this value to regenerate over time, the speed depending on the character, like when it's a warrior then regenerate slowly, and if it's a mage, regenerate fast.
I want this to be done without having to sleep or food/potions or whatever, I want the value to regenerate to its maximum value (we're speaking about the attribute called Magic in Coldstone).

Does anyone know how to do this? I couldn't figure out.

Look for "timer dev tools" by Straytoaster on the Coldstone Addons page. I'd have to study it some to know how to hook it all up (which I haven't yet done) but I know that what you want to do is certainly possible.

Incidentally, several plugins for PoG do exactly that with magic points and health.

Please! Don't apologize for several posts. We need posts to stay alive. Bring on the posts. More posts, please. 🙂

Yes, Stray's timer is very good and it works. You'll be able to do this quite well. As for the posts, don't apologize; you're trying and asking good questions.

I looked at the Timer Dev Tools, but judging from the readme, it's for plugin development for PoG only.

Here's a quote:
"It will currently work in all locations in PoG/Trinity. If you'd like to add the timer to a new location for your plugin. First add the location to the Plugin data(mod).txt file in the source folder. Save to the Plugin Folder in PoG. Then in Coldstone from the Project Menu choose Game Plugin> Load Plugin Data... choose the Plugin data(mod).txt in the Plugin Folder. Last add the timer via the Project Menu choose Game Plugin>Plugin load calls and add the <addtimer> event to each new location."

If anything, I'd need an add-on or something for Coldstone, so I can include it in my games. This tool is, sadly, useless to me.

This post has been edited by Arion : 16 April 2006 - 06:00 AM

Okay. Here we go:

1. Make a graphic. White (#FFFFFF), about 30 pixels by 30 pixels.

2. Create a folder titled "timer" and place the timer folder in your game's pictures folder. Place the white graphic in the timer folder.

3. Begin a new animation. Call it "timer". Add the timer graphic. Duplicate it 5 times. Mark the first and loop the last. Standard animation. No collision sphere. Don't move the placement of the white graphic. You're not done with this, but let's let it go for now.

4. Make globals: sec; minute; you can continue with hours, days, months, etc. but that's not what you're doing right now. So let's just stay with gb_sec and gb_minute.

5. Now make a series of events:

5a. "manawarrior"
conditional (match all): if Magic = or > than 50
if Magic < 100
if true, add 1 Magic
if false, do nothing.

5b. "manamage"
conditional (match all): if Magic = or > than 30
if Magic < 100
if true, add 1 Magic
if false, do nothing.

5c. "manajobs"
conditional: if job = warrior
if true, call event manawarrior
if false, do nothing

conditional: if job = mage
if true, call event manamage
if false, do nothing

5d. "minute"
change global: set gb_sec to 0
change global : add 1 to gb_minute

5e. "second"
conditional: if gb_minute = 60
if true, set gb_minute to 0
if false, do nothing
change global: add 1 to gb_second
conditional (match all): if gb_minute = 43
if gb_sec = 5
if true, call event "manajobs"
if false, do nothing

(You can make this happen more times than once an hour. Just add as many conditionals as you want but change the gb_minute.)

6. Back to the timer animation: In any spot, add an event: "second.cet"

7. Place the timer animation in ALL of your maps. I put it in the location window under initializing event. I used stamp control with the timer at 1,1.

Hope this helps and that I didn't forget anything.

Couldn't you just make a spell which regenerates 1 magic point per round for a few minutes, and when the duration ends it's cast again? If that works, it would be much easier than a timer...

You would normally have a global for the maximum Mana the player can have at various levels of the game. Instead of using a numerical figure in the conditional as Debra has (Magic < 100), you can write the conditional to compare to the global.

If Mana < &&gbMaxMana, add 1 to Mana.

The problem with using a spell, as Ledorax suggests, is that you want this to happen with no maintainance required from the player. The timer added to each map does this very nicely and it's "out of sight, out of mind."

The regeneration can also be tied to the wearing of specific armor or equiping a special weapon.

If player wears Arion's Crown, call event etc.

I have same the timer doing all sorts of things: needing to eat and sleep periodically, the Player being able to know how long he's been playing the game, jobs failing because the Player took too long, to the game automatically determining whether or not the Player is following the dark or the light. It's a nice thing to have no matter what because it opens up possibilities.

The animation is supposed to take about a second to loop. You can time that temporarily by placing a sound in the animation. If it's going too fast, duplicate the white graphic or slow down the animation. If it's going too slow, take out a white graphic. Once determined, take out the sound.

Yep, I had forgotten that magic points can have a maximum depending on level. There's always more than one way to do things.

Thanks guys, I'll give it a try.

That's one thing they should add if they ever update Coldstone. They told me they're working on it, but there's no timetable.

They should add a timer? Why? It's a very simple series of events, and events are under the responsibility of the game developer.

Isn't it obvious? The method you described isn't exactly obvious, using an invisible animation and stuff. If it was, I wouldn't have asked the question. It would be way easier if there was, for instance, an option for the attributes where you could say "Refill" and a field where you enter, dunno, X points per second. It took me a while to fully understand the "simple series of events" you described, and managed to use it for different things.

But a lot easier than learning a programing language to build a game from scratch (or sniff?) 😄

The more you work with Coldstone, the easier it will be for you to see these kinds of event arrays. I believe you're beginning, and that's why you're asking these questions. Quite appropriate and healthy I think. Keep on truckin'!

Well, I already had an array of events that caused the mana to increase, but I thrashed it cuz I didn't know what to use as trigger for the events. Well, you told me, the animation thingy works. Now I altered the events a bit, the mana doesn't increase faster or slower, but depending on the char it refills more than one point each round. Works, too.

That problem is solved, but I'm sure I'll encounter another one, you'll notice when that happens. 😉