I want to make it so you can steal the mirror shield off a fancy darknut with the hookshot which in turn breaks the shield but only if you hit it from the from the front.
Stealing the mirror shield?
Is there an issue you are running into? I could script this. It doesn't seem too complicated, but I know your talents. I imagine you could aswell.
Well, you're going to need to know two things:
1.) Which bit of the enemy flags refers to the Shielded (Front) flag, so that you can set the bit to 0 when the logic of the snatch succeeds.
I can't help with this, all I know is it's one of the enemy flags. I guess you might be able to find this info on Shardstorm.
2.) EXACTLY when the hookshot collides with the target, so that you can compare the LWeapon direction and ensure it is the opposite of the Darknut's (IE the enemy is facing the weapon directly).
I don't have an exact answer from this, but I have a few suggestions. First, you could define a 1-pixel border around the Darknut where you test the direction of the hookshot weapon; on a correct direction you switch the shielded enemy flag off, thereby snatching the shield away (you could also draw a tile to show the shield shattering).
Second, you could use my method of converting direction indices to a rotational modular equivalency, letting you more easily check which direction is the reverse:
[spoiler]
//======SpinDir8======
//Method for converting clockwise rotation to the 8 directional constants
int SpinDir8(int dir) {
//Take the modulo 8 to hopefully prevent invalid inputs.
dir = (dir+8)%8;
if(dir==0)
return DIR_UP;
else if(dir==1)
return DIR_RIGHTUP;
else if(dir==2)
return DIR_RIGHT;
else if(dir==3)
return DIR_RIGHTDOWN;
else if(dir==4)
return DIR_DOWN;
else if(dir==5)
return DIR_LEFTDOWN;
else if(dir==6)
return DIR_LEFT;
else if(dir==7)
return DIR_LEFTUP;
return -1;
}//Method for converting the 8 directional constants to clockwise rotation
int ToSpinDir8(int dir) {
//Take the modulo 8 to hopefully prevent invalid inputs.
dir = (dir+8)%8;
if(dir==DIR_UP)
return 0;
else if(dir==DIR_RIGHTUP)
return 1;
else if(dir==DIR_RIGHT)
return 2;
else if(dir==DIR_RIGHTDOWN)
return 3;
else if(dir==DIR_DOWN)
return 4;
else if(dir==DIR_LEFTDOWN)
return 5;
else if(dir==DIR_LEFT)
return 6;
else if(dir==DIR_LEFTUP)
return 7;
return -1;
}
[/spoiler]
To see if the darknut is facing the right way relative to the hookshot, you would want to store the hookshot's direction in a variable (by looking for the LWeapon type LW_HOOKSHOT [might be a different constant, don't know off the spot]), the darknut's direction in a separate variable (by checking each enemy on screen, comparing enemy # to confirm it is a darknut, and then recording its direction) and then comparing the two
if(darknut->dir == SpinDir8(ToSpinDir8(hook->Dir) + 4){
//Do the shield snatchy
}I know this isn't everything you need to do what you want, but it should help you come up with some ideas. Then your scripting talent can fill in the rest.
My main problem is that the hookshot should break the shield and I want the same collision as normal for darknuts. (stun them from sides and behind) but no shield stealing.
Chances are I'm going to have to script the normal hookshot block-stun behavior
Tamamo wrote:My main problem is that the hookshot should break the shield and I want the same collision as normal for darknuts. (stun them from sides and behind) but no shield stealing.
Chances are I'm going to have to script the normal hookshot block-stun behavior
Well yeah, you would script the shield stealing and the shield breaking. Just detect that the hookshot was blocked by the Darknut's shield. I believe the hookshot would show WDS_BOUNCE when it hits.
Oh yeah, I forgot that deadstate effected hookshots too and not just boomerangs.
Thanks SUCCESSOR. I'll give it a spin.