Jump to content

Photo

Enemy Weapons


  • Please log in to reply
5 replies to this topic

#1 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 31 May 2016 - 01:20 PM

Could "Misc Attr. 12" in the enemy editor be made to work so that you input the weapons/misc sprite number, and that sprite will be used instead of the default sprite for that specific enemy's weapon?


Edited by Cukeman, 31 May 2016 - 01:21 PM.


#2 Saffith

Saffith

    IPv7 user

  • Members

Posted 31 May 2016 - 01:47 PM

Not perfectly. There's no foolproof way to tell which enemy fired a given weapon. If there are some restrictions - for instance, if no other enemy with the same type of weapon will ever appear on the same screen - it shouldn't be hard. Otherwise, it'll take some work and probably be a bit glitchy.

#3 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 31 May 2016 - 01:59 PM

I see. I don't know if there's a way to create and assign new weapons or not, since there's no "custom" or "other" options in the enemy weapon dropdown menu.



#4 idontknow8

idontknow8

    Senior

  • Members

Posted 31 May 2016 - 02:18 PM

This script called "Snowflake" is a FFC simply place one FFC with this script on the screen who's enemy's you want to replace the sprite with a different tile.

 

D0 is the weapon to replace (see the other topic I made about E & L Weapon values)

D1 is the replacement sprite (in this example a snowflake but it could be anything)

D2 is the speed

D3 & D4 change its trajectory so that it could actually travel in like a sine wave

 

It takes some experimenting and it's not perfect but it works.  I'm using this script in my quest to give Gibdos a "bone" type weapon that it throws at Link.  (The weapon is set to fireball but then I have this script with D0 being the fireball weapon, D1 being the sprite of the bone.  The only downside is you can't replace a weapon for some enemies while keeping the same weapon for others on the same screen but it works.

const int EW_MISC_REPLACED = 0; //Don't change unless another script is using eweapon->Misc

const int EW_SNOWFLAKE = 31; // ID of the snowflake weapon - should be unique
const int EW_MISC_SINE = 0;  // EWeapon->Misc[] slot to store sine info
const int EW_MISC_X = 1;
const int EW_MISC_Y = 2;
const int EW_MISC_STEP = 3;
//D0: EWeapon ID to replace
//D1: Snowflake sprite
//D2: Step speed
//D3: How quickly to move back and forth (sine degrees per frame)
//D4: How far to move out from trajectory
ffc script snowflake
{
void run(int srcID, int sprite, int step, int rate, int magnitude)
{
  while(true)
  {
   for(int i = 1; i <= Screen->NumEWeapons(); i++)
   {
    eweapon e = Screen->LoadEWeapon(i);
    if(e->ID == srcID)
    {
     eweapon flake = CreateEWeaponAt(EW_SNOWFLAKE, e->X, e->Y);
     flake->UseSprite(sprite);
     flake->Dir = e->Dir;
     flake->Angular = e->Angular;
     flake->Angle = e->Angle;
     flake->Damage = e->Damage;
     flake->Step = 0;
     //EW_MISC_X and EW_MISC_Y need to be set to weapon's position on creation.
     flake->Misc[EW_MISC_X] = flake->X;
     flake->Misc[EW_MISC_Y] = flake->Y;
     flake->Misc[EW_MISC_STEP] = step;
    
     e->DeadState = WDS_DEAD;
    }
    else if(e->ID == EW_SNOWFLAKE)
    {
     int labelx[] = "X";
     int labely[] = "Y";
    // debug(i*2, labelx, e->X);
    // debug(i*2 + 1, labely, e->Y);
    
     e->Misc[EW_MISC_SINE] = e->Misc[EW_MISC_SINE] + rate % 360;
     float offset = magnitude * Sin(e->Misc[EW_MISC_SINE]);
     e->Misc[EW_MISC_X] += (e->Misc[EW_MISC_STEP]/100)*RadianCos(e->Angle);
     e->Misc[EW_MISC_Y] += (e->Misc[EW_MISC_STEP]/100)*RadianSin(e->Angle);
     e->X = e->Misc[EW_MISC_X] + offset*RadianCos(e->Angle+1.5708);
     e->Y = e->Misc[EW_MISC_Y] + offset*RadianSin(e->Angle+1.5708);
    
     if(Screen->isSolid(CenterX(e), CenterY(e)))
     {
      e->DeadState = WDS_DEAD;
     }
    }
   }
  
   Waitframe();
  }
}
}



#5 Matthew Bluefox

Matthew Bluefox

    Meow

  • Members
  • Real Name:Matt
  • Location:Winterthur, Switzerland

Posted 31 May 2016 - 02:32 PM

I wonder what number has to be entered in the mirror shield stats to reflect ALL enemy weapon projectiles including arrows.



#6 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 31 May 2016 - 03:49 PM

I wonder what number has to be entered in the mirror shield stats to reflect ALL enemy weapon projectiles including arrows.

 

http://www.shardstor...ributes#Shields




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users