At first I wondered "Why cancel knockback if you can pass through them?" (since you can turn off hitboxes), but then I realized that this is a way to hit enemies that act as if they have no hitbox, correct? That sounds useful for the enemy I'm currently working on.
That script is up next on my to do list. Plus I've been debating whether 0 damage enemies should make a rebound/bounce sound or no sound at all. I've also been debating whether 0HP enemies should knock Link back or not.
That was sort of the point of the header. I wanted to stop enemies that have 0-damage from causing Link to be knocked back, or make sounds.
As for the out of magic SFX, let's see if I understand this:
int cost = 1
int sound = 80
LensNoMagic( );
//Call in the main while loop of the global active script.
void LensNoMagic(int cost, int sound){
bool used; cost = cost / Game->Generic[GEN_MAGICDRAINRATE];
if ( GetEquipmentA() == I_LENS && (Link->PressA || Link->InputA ) ) used = true;
if ( !used ) { if ( GetEquipmentB() == I_LENS && (Link->PressB || Link->InputB ) ) used = true; }
if ( used && Link->MP < cost ) Game->PlaySound(sound);
}
And for a second item (not sure about this)
int DFcost = 31
int sound = 80
DinsFireNoMagic( );
//Call in the main while loop of the global active script.
void DinsFireNoMagic(int DFcost, int sound){
bool used; DFcost = DFcost / Game->Generic[GEN_MAGICDRAINRATE];
if ( GetEquipmentA() == I_DINSFIRE && (Link->PressA || Link->InputA ) ) used = true;
if ( !used ) { if ( GetEquipmentB() == I_DINSFIRE && (Link->PressB || Link->InputB ) ) used = true; }
if ( used && Link->MP < DFcost ) Game->PlaySound(sound);
}
I know you posted this:
but I don't understand how to set up additional items and costs
No, you don't declare vars like that. You pass the values that you want into the functions when you call them:
LensNoMagic(2, 16);
//Plays sound 16 if Link doesn't have 2MP when he uses the lens.
DinsFireNoMagic(64, 9);
//Plays sound 9 if Link doesn't have 64 MP when he uses Din's Fire
NotEnoughError(I_ARROW, 1, CR_ARROWS, 15);
//Plays sound 15 if Link trues to shoot an arrow and has none.
Set the 'cost' param to equal whatever the cost of using the item is, in the item editor.
'NotEnoughError' is generic, and you can call it many times, for different items:
const int SFX_ERROR_ITEM = 15;
global script foo{
void run() {
while(true){
Waitdraw();
NotEnoughError(I_ARROW, 1, CR_ARROWS, SFX_ERROR_ITEM);
NotEnoughError(I_LENS, 1, CR_MAGIC, SFX_ERROR_ITEM);
NotEnoughError(I_DINSFIRE, 64, CR_MAGIC, SFX_ERROR_ITEM);
NotEnoughError(I_WAND, 2, CR_MAGIC, SFX_ERROR_ITEM);
NotEnoughError(I_CUSTOM, 10, CR_SCRIPT2, 67); //Plays a different sound.
Waitframe();
}
}
}
Edited by ZoriaRPG, 04 August 2016 - 01:08 AM.