The Dink Network

Reply to Re: Switching between main characters

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
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.