Alright; I got a few hours tonight, so I cranked this out for you!
I ended up simplifying it considerably by using the "Reflected Magic" trigger flag, which should be easy enough to avoid having real reflected magic on applicable screens. Anyway this script ended up being very simple, here it is:
import "std.zh"
const int TILE_EMPTY = 19;
item script MakeSplash{
void run(int sprite, int duration, int distance, int sound){
Game->PlaySound(sound);
int xOffset = 0; int yOffset = 0;
if(Link->Dir==DIR_UP) yOffset -= distance;
if(Link->Dir==DIR_DOWN) yOffset += distance;
if(Link->Dir==DIR_LEFT) xOffset -= distance;
if(Link->Dir==DIR_RIGHT) xOffset += distance;
lweapon splash = CreateLWeaponAt(
LW_REFMAGIC, Link->X + xOffset, Link->Y +2 + yOffset
);
splash->OriginalTile=TILE_EMPTY; splash->Tile=TILE_EMPTY;
splash->NumFrames=0;
splash->DeadState = duration;
Link->Action=LA_ATTACKING;
lweapon splashSprite = CreateLWeaponAt(
LW_SPARKLE, Link->X + xOffset, Link->Y +2 + yOffset
);
splashSprite->UseSprite(sprite);
WaitNoAction();
}
}
Item Set-up: (my numbers are from a starting point using the default tileset, and I changed Sprite: Ice Magic to use tile 27444, 2 frames, 6 speed; Change those as appropriate for your Tileset. Also change the value of "TILE_EMPTY" to a blank tile) Give the item a no-built-in-fuction class, like "Custom Itemclass 01". Attach the "MakeSplash" script to the Action slot in the script tab and fill out D0, D1, D2, and D3 as, respectively, sprite # to use, how long the triggering dummy weapon lasts (in earlier versions, this variable had more function, now it only has meaning if a combo cycles into a triggerable fire combo), how far in front of the player the splash apears (0 would be right on top), and the sound effect to play when used. In my test file, I used 83, 12, 12, and 55 and it worked fine.
Combo Set-up: It doesn't matter what "type" it is, I used "Damage (1 heart)" when testing. The important thing is to set the inherent flag to "77 (Magic Trigger (Reflected)" and then (making sure you are on the right layer, I know putting flags on the wrong layer is a common mistake I make) using the set combo flag tool, set all these combos with "94 Trigger -> Self Only"
Personally, I found setting the fire combos on layer 1 and leaving the reflected-magic secret tile blank worked well, but you can use it any way you'd like.
Also, it'd be wise to change your "secret activated" sound in Screen Data (I used 4) and maybe "hit all triggers -> perm secret".
If you have any more questions, let me know!
Additional: I decided to add an alternate version that makes you have to refill the bucket. It has a filled bucket that splashes water and an empty version that can be filled at water. The filled bucket is mostly the same as above, but Make sure the water bucket is a higher level in the same class as the empty bucket, and that you have "keep lower level items" enabled on the pickup tab as well as "remove item when used" on the action tab of the filled bucket.
You can make one filling of the bucket last several uses if you make duplicates of the filled bucket item and give each a higher level.
Make a new Empty Bucket item that is the same class but a lower level and give it the "FillBucket" action script.
In the script below, D0 = the sound effect to play, and Ds 1 through 7 are items added when used when standing on or facing water or shallow water.
item script FillBucket{
void run(int sound, int item1, int item2, int item3, int item4, int item5, int item6, int item7){
int testX = Link->X+8;
int testY = Link->Y+12;
testX = Clamp(testX,0,255);
testY = Clamp(testY,0,175);
int comboStandingAt = ComboAt(testX,testY);
if(Link->Dir==DIR_UP) testY -= 16;
if(Link->Dir==DIR_DOWN) testY += 16;
if(Link->Dir==DIR_LEFT) testX -= 16;
if(Link->Dir==DIR_RIGHT) testX += 16;
testX = Clamp(testX,0,255);
testY = Clamp(testY,0,175);
int comboLookingAt = ComboAt(testX,testY);
comboStandingAt = Screen-> ComboT[comboStandingAt];
comboLookingAt = Screen-> ComboT[comboLookingAt];
if(
comboStandingAt==CT_SHALLOWWATER || comboStandingAt==CT_WATER || comboStandingAt==CT_SWIMWARP || comboStandingAt==CT_SWIMWARPB || comboStandingAt==CT_SWIMWARPC || comboStandingAt==CT_SWIMWARPD || comboStandingAt==CT_DIVEWARP || comboStandingAt==CT_DIVEWARPB || comboStandingAt==CT_DIVEWARPC || comboStandingAt==CT_DIVEWARPD
||
comboLookingAt==CT_SHALLOWWATER || comboLookingAt==CT_WATER || comboLookingAt==CT_SWIMWARP || comboLookingAt==CT_SWIMWARPB || comboLookingAt==CT_SWIMWARPC || comboLookingAt==CT_SWIMWARPD || comboLookingAt==CT_DIVEWARP || comboLookingAt==CT_DIVEWARPB || comboLookingAt==CT_DIVEWARPC || comboLookingAt==CT_DIVEWARPD
){
Game->PlaySound(sound);
if(item1>0) Link->Item[item1]=true;
if(item2>0) Link->Item[item2]=true;
if(item3>0) Link->Item[item3]=true;
if(item4>0) Link->Item[item4]=true;
if(item5>0) Link->Item[item5]=true;
if(item6>0) Link->Item[item6]=true;
if(item7>0) Link->Item[item7]=true;
}
Link->Action=LA_ATTACKING;
WaitNoAction();
}
}
Let me know if this is what you're after and if you have any questions! Do note that this will now activate any "magic (reflected) flags. Rather than fixing this with more scripting, I think the easiest way to handle that would be to either simply disable use of filled bucket items in dmaps that need to use reflected magic flags (which smart players might notice), or just make sure that any reflected magic targets would be out of reach of using the bucket; which can be done on even targets you can walk up to by clever use of step->next family of combos types.
Edited by eNJuR, 11 July 2022 - 10:28 PM.