(Hopefully this belongs under the Scripting Discussion forum. ) So, I've ran into a little issue here with the mentioned scripts, and I think the problem lies in the GB Shield one. Why so? Because, if I don't have any shields equipped, the script draws Link's sprites for grabbing, pulling and holding just fine as seen in the following shot:
The GB Shield script works like this: Having any custom one equipped, it will draw Link holding the according shield, and holding the assigned button will draw Link holding the shield. The thing is, it's interfering with the Power Bracelet. Having any shield equipped, won't draw the grabbing/pulling/holding sprites when using the Power Bracelet. The actions are done with no problem, the problem lies in not having the corresponding sprites as seen here:
It's as if any lift able combos are hovering above Link. His sprites won't change from Link holding the Shield...
The question is, why is this script interfering and how does this mess up with the LTM? From what I remember, LTM change to the values written in the item's GFX. So, I suppose that having the shield equipped will have the GFX change to Link holding a shield (in this case, 520 tiles) . And I also thought, that the value of the Power Bracelet's LTM would be summed to the value of Link holding a shield so that the Grabbing/Pulling/Holding tiles would be drawn (520 tiles + 140 tiles of the start of the actions mentioned, yes, I have my sprites set up according to the math).
BUT WHY U NOT DO THAT!? In any case, i would deeply appreciate anybody lending me a hand with this. The code from both scripts are pasted below:
// GB Power Bracelet // By: Zepinho //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< const int CF_PICK = 98; // Combo Flag (SCRIPT1 by default), for bracelet pickups. const int SCRIPT_POWERBRACELET = 1; // set this to the ffc script slot assigned to PowerBracelet script when compiling const int LTM_CATCHING = 145; // LTM for Link catching a block with the Power Bracelet const int LTM_PULLING = 146; // LTM for Link pulling a block with the Power Bracelet const int LTM_HOLDING = 147; // LTM for Link holding a block with the Power Bracelet const int BLOCK_VH=4; //thrown block/bush horizontal initial velocity const int BLOCK_VV=0; //thrown block/bush vertical initial velocity const int BLOCK_DMG=8; //damage dealt to enemies by thrown block/bush const int LW_BLOCK = 31; //id of a lweapon to be used as thrown block const float BLOCK_FALL = 0.5; //gravity acceleration for block in sideview screens const int PB_PULL_TIME=15; // num of frames to wait for pickup with PB const int PB_UNDERCOMBO=-1; // combo to set after picking up a block; set a negative value to have a shift of the original combo const int SFX_PICKUP_BLOCK = 69; // sfx played when link picks up the block const int SFX_THROW_BLOCK = 70; // sfx played when the block is thrown const int SFX_CRASH_BLOCK = 71; // sfx of a block crashing //const int INV_COMBO_ID = 25; // id af an invisible combo (Used by Pegasus Boots) const int INV_TILE_ID = 65515; // id af an invisible tile const int CRASH_SPR = 88; // sprite for a block crashing at ground const int BUSH_SPR = 91; // sprite for a bush crashing at ground const int LAYER_OVER = 3; // an overhead layer //const int NPC_ITEMSET = 196; // id of a dummy enemy with type different from "none" (Used by Pegasus Boots) //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // GB Shields (With Strafing) // By: Elmensajero (Modified by Demonlink) //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< //Change these values to match your item setup const int GBS_SMALL=93; const int GBS_MAGIC=8; const int GBS_MIRROR=37; const int GBS_CUSTOM=127; const int GBS_FAKESMALL=157; const int GBS_FAKEMAGIC=158; const int GBS_FAKEMIRROR=159; const int GBS_FAKECUSTOM=126; const int SFX_GBSHIELD=76; //Gameboy shield: To use, set up four custom items that look like shields. Assign them levels 1-4 // as appropriate and make them equipment items. Make any of them consumable by enemies if you // want. You can also give them an LTM that makes it look like Link is carrying a shield beside // him. Next go to the real shields and change each of them to level 5 (and keep their equipment // item status enabled). Set up the LTM's for them (if they are not done already) to look like // Link is holding the shield out in front of him. Give players the fake shields during the game, // not the real ones. Remove the small shield from the initial data, and if you want Link to start // with one of the shields, just give him the fake version in the initial data as well. If you want // strafing to work correctly, you have to enable Z3 diagonal movement (in Graphics->Sprites->Link). // Make sure that the above global variables are correct (if you don't want a sound when Link uses // the shield, leave it as 0), and then attach this script to global slot 2. //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // GB Power Bracelet // Variables //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< bool throw_disabled; int holding_block; bool holding_bush; int link_catching; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // GB Shields // Variables //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< bool inputex1=false; bool shieldon=false; int lastdir; int gbsound; global script Slot_2 { void run() { StartGhostZH(); holding_block = 0; //<- Power Bracelet Stuff while(true) { PowerBracelet(); //<- Power Bracelet Stuff GBShield(); //<- GBShield Stuff Waitdraw(); GBShieldDraw(); //<- GBShield Stuff Waitframe(); } } } global script Slot_3{ void run(){ Link->Item[LTM_CATCHING] = false; Link->Item[LTM_HOLDING] = false; Link->Item[LTM_PULLING] = false; holding_block = 0; holding_bush = false; link_catching = 0; } } //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // GB Power Bracelet // Function Stuff //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // global function to add to the global script void PowerBracelet(){ if(Link->Item[LTM_HOLDING]){ if(CountFFCsRunning(SCRIPT_POWERBRACELET)==0 && holding_block>0){ holding_block = 0; Link->Item[LTM_HOLDING] = false; Link->Item[LTM_CATCHING] = false; Link->Item[LTM_PULLING] = false; } } } // Item script item script PowerBracelet{ void run(){ // if(holding_block==0 && holding_item==0 && holding_bomb==0){ if(holding_block==0){ // use this line if not using GB_Shop and GB_Bombs if(!link_catching && isSolid(TouchedX(),TouchedY())){ link_catching=1; int args[] = {0,0,0,0,0,0,0,0}; int id = RunFFCScript(SCRIPT_POWERBRACELET, args); } } } } // FFC script (automatically called by the item script - you don't have to place any ffc on the screen for this) ffc script UsePowerBracelet{ void run(int input){ this->Data = INV_COMBO_ID; this->X = -16; this->Y = -16; int counter = 0; while(Link->InputA || Link->InputB){ // set link catching the wall / block / bush if(!Link->Item[LTM_CATCHING]) Link->Item[LTM_CATCHING] = true; // to fix a bug... if(!isSolid(TouchedX(),TouchedY())) break; // if pressing opposite direction, set link pulling if(OppositeDir()){ if(!Link->Item[LTM_PULLING]) Link->Item[LTM_PULLING] = true; counter ++; } else{ if(Link->Item[LTM_PULLING]) Link->Item[LTM_PULLING] = false; counter = 0; } // if pulling a block or bush for 15 frames or more, pick it up if(counter>PB_PULL_TIME){ int loc=TouchedComboLoc(); if((Screen->ComboF[loc]==CF_PICK || Screen->ComboI[loc]==CF_PICK) && !ComboT(loc,CT_SCRIPT1)){ //Line to prevent interference from Freeform Shutters script. link_catching = 0; int combo = Screen->ComboD[loc]; int cset = Screen->ComboC[loc]; if(isBush(Screen->ComboT[loc])) holding_bush = true; else holding_bush = false; if(PB_UNDERCOMBO<0) Screen->ComboD[loc] += (-PB_UNDERCOMBO); else Screen->ComboD[loc] = PB_UNDERCOMBO; ItemSetAt(IS_DEFAULT,loc); Game->PlaySound(SFX_PICKUP_BLOCK); throw_disabled = true; // mid-air block for(int i=0;i<16;i++){ int blockX = (Link->X+ComboX(loc))/2; int blockY = Link->Y-7; Screen->FastCombo(LAYER_OVER, blockX, blockY, combo, cset, 128 ); WaitNoAction(); } // set link holding holding_block = 1; if(!Link->Item[LTM_HOLDING]) Link->Item[LTM_HOLDING] = true; while(throw_disabled || (!Link->InputA && !Link->InputB)){ if(!Link->InputA && !Link->InputB) throw_disabled = false; Screen->FastCombo(LAYER_OVER, Link->X, Link->Y - 14, combo, cset, 128 ); if(Link->Invisible || (Link->Action != LA_NONE && Link->Action != LA_WALKING)) break; // break if falling in pit or water! Waitframe(); } if(Link->Invisible || (Link->Action != LA_NONE && Link->Action != LA_WALKING)) break; // break if falling in pit or water! counter = 0; holding_block = 0; if(Link->Item[LTM_CATCHING]) Link->Item[LTM_CATCHING] = false; if(Link->Item[LTM_PULLING]) Link->Item[LTM_PULLING] = false; if(Link->Item[LTM_HOLDING]) Link->Item[LTM_HOLDING] = false; // throw block lweapon w = CreateLWeaponAt(LW_SCRIPT1,Link->X,Link->Y); w->Damage = BLOCK_DMG; w->OriginalTile = INV_TILE_ID; w->NumFrames = 1; w->Dir = Link->Dir; w->Step = Floor(BLOCK_VH*100); w->DrawYOffset = -14; w->HitXOffset = -4; w->HitYOffset = -4; w->HitWidth = 16 + 8; w->HitHeight = 16 + 8; w->HitZHeight = 16 + 8; Game->PlaySound(SFX_THROW_BLOCK); while(w->DrawYOffset<0 && !isSolid(w->X+8,w->Y+ 8) && !isOutOfScreen(w->X,w->Y,16,16)){ if(counter<4) Link->Action = LA_ATTACKING; w->DrawYOffset += Floor(counter*GRAVITY) - BLOCK_VV; Screen->FastCombo(LAYER_OVER, w->X, w->Y + w->DrawYOffset, combo, cset, 128 ); Waitframe(); counter ++; } if(holding_bush) Game->PlaySound(SFX_GRASSCUT); else Game->PlaySound(SFX_CRASH_BLOCK); if(w->isValid()){ w->DeadState = WDS_DEAD; if(holding_bush) CreateGraphicAt(BUSH_SPR,w->X,w->Y + w->DrawYOffset); else CreateGraphicAt(CRASH_SPR,w->X,w->Y + w->DrawYOffset); } break; } } NoMoveAction(); Waitframe(); } link_catching = 0; holding_block = 0; counter = 0; if(Link->Item[LTM_CATCHING]) Link->Item[LTM_CATCHING] = false; if(Link->Item[LTM_PULLING]) Link->Item[LTM_PULLING] = false; if(Link->Item[LTM_HOLDING]) Link->Item[LTM_HOLDING] = false; this->Data = 0; Quit(); } } // utility functions bool isBush(int ct){ if(ct==CT_BUSH) return true; if(ct==CT_BUSHC) return true; if(ct==CT_BUSHNEXT) return true; if(ct==CT_BUSHNEXTC) return true; if(ct==CT_FLOWERS) return true; if(ct==CT_FLOWERSC) return true; return false; } // x touched by Link (Function already in Pegasus Boots Scripts) //int TouchedX(){ //int x; //if(Link->Dir == DIR_UP) x = Link->X+8; //else if(Link->Dir == DIR_DOWN) x = Link->X+8; //else if(Link->Dir == DIR_LEFT) x = Link->X-2; //else if(Link->Dir == DIR_RIGHT) x = Link->X+18; //return x; //} // y touched by Link (Function already in Pegasus Boots Scripts) //int TouchedY(){ //int y; //if(Link->Dir == DIR_UP) y = Link->Y+6; //else if(Link->Dir == DIR_DOWN) y = Link->Y+18; //else if(Link->Dir == DIR_LEFT) y = Link->Y+8; //else if(Link->Dir == DIR_RIGHT) y = Link->Y+8; //return y; //} // location of the touched combo (Function already in Pegasus Boots Scripts) //int TouchedComboLoc(){ //int loc; //loc = ComboAt( TouchedX(), TouchedY() ); //return loc; //} // create a dummy npc and kill it, giving an item (Used by Pegasus Boots) //void ItemSetAt(int itemset,int loc){ //npc e = Screen->CreateNPC(NPC_ITEMSET); //e->ItemSet = itemset; //if(e->isValid()){ //e->X = loc%16*16; //e->Y = loc-loc%16; //} //e->HP = HP_SILENT; //} // function to test if (x,y) is out of the screen bool isOutOfScreen(int x, int y, int dx, int dy){ if((x+dx) > 16*16) return true; else if(x < 0) return true; else if((y+dy) > 16*11) return true; else if(y < 0) return true; else return false; } // create a sprite (Used by Pegasus Boots) //int CreateGraphicAt(int sprite, int x, int y){ //eweapon e = Screen->CreateEWeapon(EW_SCRIPT1); //e->HitXOffset = 500; //e->UseSprite(sprite); //e->DeadState = e->NumFrames*e->ASpeed; //e->X = x; //e->Y = y; //return e->DeadState; //} // inhibit all the movement actions void NoMoveAction(){ Link->InputUp = false; Link->InputDown = false; Link->InputLeft = false; Link->InputRight = false; } // this utility routine by Saffith checks for walkability of combos (Function already in Pegasus Boots Scripts). //bool isSolid(int x, int y){ //if(x<0 || x>255 || y<0 || y>175) return false; //int mask=1111b; //if(x%16< 8) mask&=0011b; //else mask&=1100b; //if(y%16< 8) mask&=0101b; //else mask&=1010b; //return (!(Screen->ComboS[ComboAt(x, y)]&mask)==0); //} // gives true if Link pushes the opposite direction of his facing direction bool OppositeDir(){ if(Link->InputDown && Link->Dir==DIR_UP) return true; if(Link->InputUp && Link->Dir==DIR_DOWN) return true; if(Link->InputRight && Link->Dir==DIR_LEFT) return true; if(Link->InputLeft && Link->Dir==DIR_RIGHT) return true; else return false; } //>>>>>>>>>>>>>>>>>>>>>>>>>>>>> // GB Shields // Function Stuff //>>>>>>>>>>>>>>>>>>>>>>>>>>>>> void GBShield(){ //Turn off input "Ex1" inputex1=Link->InputEx1; Link->InputEx1=false; //Code for gameboy shield lastdir=Link->Dir; //used for strafing if(inputex1 && !shieldon) //Enable shield when Ex1 is pressed { shieldon=true; gbsound=SFX_GBSHIELD; if(Link->Item[GBS_FAKECUSTOM]) Link->Item[GBS_CUSTOM]=true; else if(Link->Item[GBS_FAKEMIRROR]) Link->Item[GBS_MIRROR]=true; else if(Link->Item[GBS_FAKEMAGIC]) Link->Item[GBS_MAGIC]=true; else if(Link->Item[GBS_FAKESMALL]) Link->Item[GBS_SMALL]=true; else { gbsound=0; shieldon=false; } if(gbsound>0) Game->PlaySound(SFX_GBSHIELD); } else if(!inputex1 && shieldon) //Remove shield when Ex1 is released { Link->Item[GBS_CUSTOM]=false; Link->Item[GBS_MIRROR]=false; Link->Item[GBS_MAGIC]=false; Link->Item[GBS_SMALL]=false; shieldon=false; } } void GBShieldDraw(){ if(inputex1 && shieldon && Link->Action!=LA_SWIMMING && Link->Action!=LA_DROWNING && Link->Action!=LA_ATTACKING && Link->Action!=LA_CHARGING && Link->Action!=LA_SPINNING) //Strafe while Ex1 is held down { Link->Dir=lastdir; } }
If anybody requires the quest file for more details, let me know and I'll shoot you a PM with it.