Equipping magic during a cutscene
I know how to automatically equip a weapon/item, but is there any way to do that for magic? Instead of &cur_weapon (forgive me if I'm incorrect, it's late at night and I'm not concentrating very well) is there something like &cur_magic?
I don't know but i've found in WInDInkEdit Help about this script:
"# Categories: Inventory; Weapon; Undocumented
# Prototype:
# void arm_magic( void );
[Magic-item counterpart of arm_weapon(), below. Arms the magic in the magic-inventory slot (1-8) specified in &cur_magic, or disarms magic if &cur_magic is 0. This command does not update the status area: you will usually want to draw_status() after using this command. Example:
// disarm Dink's magic:
&cur_magic = 0;
arm_magic();
draw_status();
There is no direct way to know whether a given slot is empty or what is in it -- command compare_magic() is non-functional.]
See also: arm_weapon(), draw_status(); variable &cur_magic"
Maybe this script will help.
"# Categories: Inventory; Weapon; Undocumented
# Prototype:
# void arm_magic( void );
[Magic-item counterpart of arm_weapon(), below. Arms the magic in the magic-inventory slot (1-8) specified in &cur_magic, or disarms magic if &cur_magic is 0. This command does not update the status area: you will usually want to draw_status() after using this command. Example:
// disarm Dink's magic:
&cur_magic = 0;
arm_magic();
draw_status();
There is no direct way to know whether a given slot is empty or what is in it -- command compare_magic() is non-functional.]
See also: arm_weapon(), draw_status(); variable &cur_magic"
Maybe this script will help.
And there is such a thing as &cur_magic. See DinkC Ref. v4.0 under "required global variables" (Gokussj6's quote is from v3.2).
add_magic adds it to the inventory but doesn't arm it.
add_magic adds it to the inventory but doesn't arm it.
Equipping magic is much more difficult then it looks. The problem is that for arm_magic(); you need to specify &cur_magic. The problem is that you don't know which value of &cur_magic belongs to the magic you're trying to equip, and there's no direct method to find out as far as I know... Compare_magic(); does work, but it gives only the amount of magic of the same type. (So if you have 2 fireballs it will return 2, without specifying in which slots they're in)
I can think of one solution which isn't exactly ideal. For that make sure that you give the player magic in the beginning of the game. This way slot 1 is always full. Then replace this magic with the magic you want to arm, and then arm it. Now you know for sure that the magic you want to arm is in the first slot.
I did something like that for the final battle in the Scourger I replaced the fist with a sword for the final battle, making sure that was always armed for that fight.
I can think of one solution which isn't exactly ideal. For that make sure that you give the player magic in the beginning of the game. This way slot 1 is always full. Then replace this magic with the magic you want to arm, and then arm it. Now you know for sure that the magic you want to arm is in the first slot.
I did something like that for the final battle in the Scourger I replaced the fist with a sword for the final battle, making sure that was always armed for that fight.
How about:
int &temp = get_magic("item-fb");
if (&temp > 0)
{ &cur_magic = &temp; arm_magic();
}
Which is the DinkC.chm example at the page about get_magic():
get_magic
Category: Inventory, Script
Version: 1.08+
Prototype: int get_magic(string script[9]);
get_magic returns the first slot of the given script in the player's magic inventory. Returns 0 if not found. This is useful if you want to arm the fireball, but you don't know what inventory slot it is in.
EDIT: get_item(); works in the same way.
int &temp = get_magic("item-fb");
if (&temp > 0)
{ &cur_magic = &temp; arm_magic();
}
Which is the DinkC.chm example at the page about get_magic():
get_magic
Category: Inventory, Script
Version: 1.08+
Prototype: int get_magic(string script[9]);
get_magic returns the first slot of the given script in the player's magic inventory. Returns 0 if not found. This is useful if you want to arm the fireball, but you don't know what inventory slot it is in.
EDIT: get_item(); works in the same way.
Cool, I'm starting to like v1.08 more and more... Would have saved me a cumbersome workaround in the Scourger... *sigh*
Huh... didn't they fix compare_magic() when they upgraded 1.07 to 1.08? That would've been a good idea.
Okay, look. The spell (fireball) is in slot 1. You wanna know how I know this? Because it's the only magic spell you get in the entire game. So tell me the simplest way to arm the magic spell in slot one.
Huh... didn't they fix compare_magic() when they upgraded 1.07 to 1.08? That would've been a good idea.
It was fixed as far as I know.
It was fixed as far as I know.
"&cur_magic = 1;
arm_magic();"
Thank you scratcher. You're so very kind.
arm_magic();"
Thank you scratcher. You're so very kind.
