So, yeah I know making multiple characters in a quest can be done fairly simply by simply using a combination of items and Link tile modifiers, the problem that I'm running into in the new project I'm starting (a fairly simple comedy based quest about me, my best friend and our band) is that one of the characters is left-handed and the other is right-handed. I figure it wouldn't be too terribly difficult to write a script to make Link right-handed, but I'm not sure if it's even possible to make that into something that can be toggled on and off via item, mainly because I know what a gigantic pain in the ass it would be to do on the more complicated 3D Zelda engines (as in nearly impossible, and certainly not worth the cost in labor to make it work). I'm hoping that because the engine used here is much more simplistic, the issues with hit detection wouldn't be so major and it would simply be a matter of flipping animations around. Can anyone confirm if this is possible, or not?
Multiple characters with different dominant hands
#1
Posted 12 December 2014 - 08:01 PM
#2
Posted 12 December 2014 - 08:23 PM
I wrote this script for Carnage in Space to make dual swords. You could probably attach it to a non-sword item (or modify the script for a sword item) to make just a right-handed sword.
- Binx likes this
#3
Posted 12 December 2014 - 08:38 PM
Oh... that's... A hell of a lot simpler than I thought this was going to be. Thanks
#4
Posted 03 January 2015 - 03:50 PM
So, I finally got around to looking at the script, exactly how would I modify it to work on a sword item and still only have one sword? I thought it was impossible to write to the sword LWeapon.
#5
Posted 03 January 2015 - 04:41 PM
Go to the part of the FFC script that checks if(!simul) and deletes the sword. Just remove the if(){} statement around it so that the statements inside always run:
Link->Action = LA_NONE; //Cancel default sword sword = LoadLWeaponOf(LW_SWORD); //Find default sword Remove(sword); //Remove it
This will make any sword that uses this script always use the overridden right-handed sword.
#6
Posted 03 January 2015 - 04:51 PM
ok,so this is the FFC script, right?
I don't see any statement in there that says "if(!simul)" to remove.
#7
Posted 03 January 2015 - 04:53 PM
Oh, I forgot that I altered the script between CiS and the database. See how that script works for you as it is now. I think it should just make a right-handed sword...
#8
Posted 03 January 2015 - 05:03 PM
when I tried to compile, I got this
#9
Posted 03 January 2015 - 05:31 PM
Sounds like you're importing ffcscript.zh twice.
#10
Posted 03 January 2015 - 05:39 PM
sounds like that to me, too, but it's only there once, and the dual sword script is the only new one I added, and it didn't have any imports. But it compiles fine if I remove the sword script, so I think it has to be in there but here's what I've got
bool RULE_FLIPRIGHTSLASH = false; //Set to true if you use "Flip right-facing slash" and false if you don't. const int FLIP_NO = 0; //No flip const int FLIP_H = 1; //Horizontal flip const int FLIP_V = 2; //Vertical flip const int FLIP_B = 3; //Both (180 degree rotation) //D0: Damage of the second sword (0 = stun) //D1: Sprite of the second sword //D2: SFX of main sword //D3: SFX of second sword bool swordState; //State of the dual swords: true = second sword item script dualSwords{ void run( int damage, int sprite, int sfx1, int sfx2 ){ swordState = !swordState; //Switch between swords if ( swordState ){ int args[2] = { damage, sprite }; Game->PlaySound(sfx2); RunFFCScript(swordSwitchFFC, args); } else Game->PlaySound(sfx1); } } const int swordSwitchFFC = 30; //Set to the slot of the swordSwitch FFC ffc script swordSwitch{ void run( int damage, int sprite ){ //Position/sprite arrays set for facing up int Xpos[3] = {-13, -13, 0}; int Ypos[3] = {0, -13, -13}; int Sprites[3] = {5, 0, 4}; //0-3: Slash UDLR; 4-5: Stab UR int flips[3] = {1, 0, 0}; //Only stabs need flipping Link->Action = LA_NONE; //Cancel default sword lweapon sword = LoadLWeaponOf(LW_SWORD); //Find default sword Remove(sword); //Remove it sword = Screen->CreateLWeapon(LW_SCRIPT1); //Make a new sword sword->UseSprite(sprite); int baseTile = sword->Tile; //Save the base tile sword->Damage = damage; //Prepare Link's sprite for horizontal flip (DISABLED UNTIL LINK->TILE IS USABLE) //if ( Link->Dir == DIR_LEFT ) Link->Dir = DIR_RIGHT; //else if ( Link->Dir == DIR_RIGHT ) Link->Dir = DIR_LEFT; //Link->Invisible = true; //Set positions and sprites for each direction //Up is set by default Sprites[1] = Link->Dir; //Middle sprite always equals Link's direction if ( Link->Dir == DIR_DOWN || Link->Dir == DIR_LEFTDOWN || Link->Dir == DIR_RIGHTDOWN ){ Xpos[0] = 13; Xpos[1] = 13; //X position 2 is correct //Y position 0 is correct Ypos[1] = 13; Ypos[2] = 13; Sprites[0] = 5; //Right, no flip Sprites[2] = 4; //Down = up + both flip flips[0] = FLIP_NO; flips[2] = FLIP_B; } else if ( Link->Dir == DIR_LEFT ){ Xpos[0] = 0; //Xpos[1] = -16; //Already correct Xpos[2] = -13; Ypos[0] = 13; Ypos[1] = 13; Ypos[2] = 0; Sprites[0] = 4; //Down = up + both flip Sprites[2] = 5; //Left = right + horizontal flip flips[0] = FLIP_B; flips[2] = FLIP_B; } else if ( Link->Dir == DIR_RIGHT ){ //NOTE: These expect "flip right-facing sword" to be enabled. If you don't use it, change the Y values below: Xpos[0] = 0; Xpos[1] = 13; Xpos[2] = 13; if ( RULE_FLIPRIGHTSLASH ){ //If "flip right-facing slash" is enabled Ypos[0] = -13; Ypos[1] = -13; } else{ Ypos[0] = 13; Ypos[1] = 13; } Ypos[2] = 0; Sprites[0] = 4; //Up, no flip Sprites[2] = 5; //Right, no flip flips[0] = FLIP_NO; } Link->Action = LA_ATTACKING; for ( int i = 0; i < 3; i++ ){ //For each of 3 frames if ( !sword->isValid() ) return; //Quit if sword vanishes //Screen->DrawTile(2, Link->X, Link->Y, Link->Tile, -1, -1, 6, -1, -1, 0, 0, 0, FLIP_H, true, 128); //Draw Link's flipped tile sword->X = Link->X + Xpos[i]; //Set position sword->Y = Link->Y + Ypos[i]; sword->Tile = baseTile + Sprites[i]; //And sprite sword->Flip = flips[i]; sword->DeadState = WDS_ALIVE; for ( int f = 0; f < 3; f++ ){ //Wait 3 frames per position, preventing movement and preserving sword sword->DeadState = WDS_ALIVE; NoMovement(); Waitframe(); } } sword->DeadState = WDS_DEAD; //Remove it afterwards //Link->Invisible = false; //Restore Link's sprite } } void NoMovement(){ //Prevents moving in any direction Link->InputUp = false; Link->PressUp = false; Link->InputDown = false; Link->PressDown = false; Link->InputLeft = false; Link->PressLeft = false; Link->InputRight = false; Link->PressRight = false; }
and my main script file (with all my imports)
import "std.zh" import "ffcscript.zh" import "ghost.zh" import "ghost_legacy.zh" import "string.zh" import "SFRITGlobalSlot2.z" import "SFRITConstants.z" import "SFRITFFC.z" import "beer.z" import "Dual swords script.z"
again, it works fine if I take out 'import "Dual swords script.z"' but if I import "Dual swords script.z" with the rest, it won't compile and gives me the error above
#11
Posted 03 January 2015 - 06:01 PM
I'm so confused. All I can say is do a search in all of your scripts. Notepad++ lets you search an entire folder at once.
First search for "FFCS_MAX_FFC" and make sure it only appears in ffcscript.zh. Then search for "ffcscript.zh" and make sure it only appears in your main file. Or.... it could be imported in your script buffer?
#12
Posted 03 January 2015 - 06:26 PM
Hmmm... weird, it appears that the name of the file was the problem. I took out the spaces, renamed it, and it compiled, now to test it. I have to create normal weapon sprites, yes? Or do I use the tile number as the D1 argument?
#13
Posted 03 January 2015 - 06:39 PM
You create a normal weapon sprite, except with right-handed swords.
The sprite is the first of 6 tiles, in this order: 0-3: Slash UDLR; 4-5: Stab UR
#14
Posted 03 January 2015 - 06:53 PM
It seems to work, except when slashing down, the horizontal sprite isn't flipped, so the sword swings hilt-first, then flips around to normal. all the other directions work perfectly.
EDIT: the horizontal sprite is flipped properly, but it's displaying the unflipped horizontal sprite instead of the down slash. I'm not sure why, though, I have the tiles set up the way you said and the way it's pictured in the screenshot in the database.
Edited by Lineas, 03 January 2015 - 07:23 PM.
#15
Posted 03 January 2015 - 10:35 PM
Can you show me a screenshot of the problematic sprite? I think I can add a couple lines to fix it.
Also, I should change all the dumb if() statements into a fake 2D array.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users