The Dink Network

Running scripts and saving

June 19th 2010, 10:23 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
So I was checking out Rabid's poison script and I loved how he used a script attached to Dink, which I always thought was impossible. But just like the dozens of similar scripts I've written for status effects like stat boosts or reductions, poison, burn, ... they always get stuck on the principle that a player can't save while such scripts are running.

So I was wondering if there's a way to keep track of such data like how much stats diverge from the "real" stats in the case of temporary stat boosts, whether someone is poisoned, ... without using 30 global variables and then set these values back once a game is loaded. I think we could all benefit from a solution to this
June 19th 2010, 03:07 PM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Hmmm... Not sure if you need 30 globals for that. You can just use a single global to track which effects are active and you can deduce the original speed/attack/defense from that. Because you know what effect these poisons have you just need to store which poison is active, not what the poison is doing exactly.
June 19th 2010, 05:24 PM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
Unfortunately, that doesn't account for any potions you pick up that raise your stats permanently while under the buff effects, or through quest rewards or whatever. And I was thinking more in the direction of trying to keep as much of the effect intact after loading a game. So you couldn't just save near the end of a stat boost buff and load again to refresh its duration, or worse, the other way around with poison.
June 20th 2010, 12:41 AM
fairy.gif
Someone
Peasant He/Him Australia
 
Just save them in editor_seq/frame places in the save procedure and read them back up in the load procedure. If loading kills all scripts (I think it does?) then it would be a little more difficult, and may require one global variable like this:

In the save procedure:

//save whatever..
editor_seq(90,&ptime);
editor_seq(91,&strbuff);
//etc
&just_saved = &player_map;

In a script attached to all maps:

if (&just_saved == &player_map)
{
//player just loaded
&ptime = editor_seq(90,-1);
&strbuff = editor_seq(91,-1);
}

if (&just_saved != &player_map)
{
&just_saved = 0;
}

June 20th 2010, 07:14 AM
wizardb.gif
Kyle
Peasant He/Him Belgium
 
That's an interesting way to handle it indeed. I think I'll try that and see how manageable it is on a large scale. Thanks for the advice