The Dink Network

Switching between main characters

February 19th 2009, 03:15 AM
maiden.gif
nawal
Peasant She/Her Egypt
 
Hey guys does anyone know how i can alternate between 2 main characters during gameplay? For instance, like in cycles of evil, i wanna have dink and goblin so for some quests i'd be playing with dink and for some others i'd be using the goblin. how do i 'save' or store'character stats, spells, items...etc for dink for instance and then load the goblin so that when i reload dink i would retrieve his weapons, spells and stats? and can that be done in the first place using the DinkC? Thanks
February 19th 2009, 08:17 AM
slimeg.gif
metatarasal
Bard He/Him Netherlands
I object 
Yeah, it can be done using DinkC. You'll just need to store all that information in global variables (or use editor_seq / editor_frame).

You can make a set of new global variables:

&diflfmax
&difdef
&difpower
&difmagic
&difgold
&difexp

(I did not store the &life value because I think it's in general a good idea to let the player start out with full health again)

So you can change the variables for your character like this:

int &tempvar;
&tempvar = &lifemax;
&lifemax = &diflfmax;
&diflfmax = &tempvar;
&tempvar = &defense;
&defense = &difdef;
&difdef = &tempvar;
&tempvar = &strength;
&strength = &difpower;
&difpower = &tempvar;
&tempvar = &magic;
&magic = &difmagic;
&difmagic = &tempvar;
&tempvar = &gold;
&gold = &difgold;
&difgold = &tempvar;
&tempvar = &exp;
&exp = &difexp;
&diflfmax = &difexp;

Spells and items are a little more tricky. What's best depends a bit on how many items/spells are available. If there are only a few you might store it something like this:

&amsword1 (amount of weak swords player has)
&amsword2 (amount of medium swords player has)
&amsword3 (amount of strong swords player has)
&ambomb (amount of bombs player has)
&ambow (amount of bows player has)
&otion (amount of potions player has)
&amfball (amount of fireballs player has)
&amhellf (amount of hellfires player has)

You can determine the value of each of these variables using the count_item() command. Then you can set them the same way I showed using general player stat's.

Unfortunately this method costs a lot of global variables. Especially when you have a lot of possible weapons / magics. In that case I would suggest looking at supervars to store item related information.
February 19th 2009, 08:58 AM
dinkdead.gif
I am doing this in my DDC D-Mod (if I ever finish it ) and had the idea of using Dink's Trunk to store all of one character's items while playing as the other one. It would need modifying slightly to do it in the background but shouldn't be too hard, I haven't started on this yet though so can't give much help!

To store the stats then use globals or supervars like metatarasal mentioned I suppose.
February 19th 2009, 11:10 AM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
It would be possible to store all this info to the editor seq and frame of sprites if there was some intermission screen inbetween switching chars. It would be more work to script, but it wouldn't use any variables at all. Probably wouldn't be worth the effort unless you're running out of variables though.
February 19th 2009, 06:11 PM
wizardb.gif
Strokend
Peasant He/Him United States
I've seen four lurkers on at the same time! 
"I am doing this in my DDC D-Mod..."
Heh, I'm planning on doing that for the prequel of my DDC DMOD, for swapping between Franklin and Jynx.