Jump to content

Photo

A New Enemy Projectile Attack


  • Please log in to reply
37 replies to this topic

#16 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 03 May 2015 - 07:28 PM

You could copy and paste the routine used by weapons tagged with EWM_SINE_WAVE from ghost.zh. It's in eweaponMovement.zh.



#17 TK8305

TK8305

    I <3 Miyu

  • Members
  • Real Name:John
  • Location:South Carolina

Posted 03 May 2015 - 07:47 PM

Lejes, if you could do this new projectile weapon thingy too that would be epic!  I couldn't say what properties to give the snowflake attack.  I'd let you have freedom with how it moves & such.  x.x



#18 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 03 May 2015 - 08:34 PM

EDIT: DOESN'T WORK. TRYING TO FIX.

 

This should do the trick. It's un-tested.

 

Simply replaces all EW's of a certain ID with snowflakes that move in a sinewave pattern.

Code

 

Note that the snowflakes will always be 4-directional. If you want angular ones, I'll just have to copy the Ghost.zh method like Lejes suggested.


Edited by MoscowModder, 03 May 2015 - 10:11 PM.

  • Binx likes this

#19 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 03 May 2015 - 08:47 PM

Just wondering, before I try to make it myself, would it be possible to do something like what I suggested, where you could just arbitrarily switch out eweapons with scripted versions? Maybe with like, a really long if statement that would say like:

 if d1 == EW_Whatever 
{
//create that eweapon and do  stuff
} 
else if d1 == EW_YaddaYadda...
{
//etc.etc
}

Would that be a possibility? Because that would be freaking awesome.



#20 TK8305

TK8305

    I <3 Miyu

  • Members
  • Real Name:John
  • Location:South Carolina

Posted 03 May 2015 - 08:51 PM

This should do the trick. It's un-tested.

 

Simply replaces all EW's of a certain ID with snowflakes that move in a sinewave pattern.

Code

 

Note that the snowflakes will always be 4-directional. If you want angular ones, I'll just have to copy the Ghost.zh method like Lejes suggested.

 

This should do the trick. It's un-tested.

 

Simply replaces all EW's of a certain ID with snowflakes that move in a sinewave pattern.

Code

 

Note that the snowflakes will always be 4-directional. If you want angular ones, I'll just have to copy the Ghost.zh method like Lejes suggested.

 

Cools!  When I finish my tweaks of ToT is it ok if I send it to you to install that script?  



#21 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 03 May 2015 - 09:02 PM

Just wondering, before I try to make it myself, would it be possible to do something like what I suggested, where you could just arbitrarily switch out eweapons with scripted versions? Maybe with like, a really long if statement that would say like:

 if d1 == EW_Whatever 
{
//create that eweapon and do  stuff
} 
else if d1 == EW_YaddaYadda...
{
//etc.etc
}

Would that be a possibility? Because that would be freaking awesome.

 

That's actually what MoscowModder's script already does. Rather than use a long chain of if statements, though, he only has to use one due to iterating through every weapon present with a for loop.



#22 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 03 May 2015 - 09:06 PM

That's actually what MoscowModder's script already does. Rather than use a long chain of if statements, though, he only has to use one due to iterating through every weapon present with a for loop.

No, I don't mean the weapon to be replaced, I mean the scripted eweapon you're adding in instead. I mean, if I wanna remove all magics and replace them with ice balls, but then on the next page, I want to replace them with lightning blasts, could it be done with one FFC script, rather than making a separate script for each eweapon you're going to create.



#23 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 03 May 2015 - 09:21 PM

Yeah, sure. If you want each replacement to be a wholly different thing with its own properties, then you'll probably have to go with a bunch of if statements like you outlined before. But if each one only has slightly different properties, like weapon ID or sprite, then that could be accomplished with a D# argument.


  • Binx likes this

#24 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 03 May 2015 - 09:25 PM

awesome. That just made making my quest a ton easier.



#25 TK8305

TK8305

    I <3 Miyu

  • Members
  • Real Name:John
  • Location:South Carolina

Posted 03 May 2015 - 09:27 PM

God I really wish I understood what all of you are talking about!  xD

 

Modder, I'll be sending you ToT to install that script so I can switch the Manhandla's projectile.  It won't effect the other monsters in the game though right?  o_O;



#26 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 03 May 2015 - 09:30 PM

Yeah, sure.

 

This script will affect all EWeapons of a type set in the FFC's parameters on any screen you place the FFC on. So... no. It won't affect anything else.

 

EDIT: The script doesn't work for some reason. I am working on it, but haven't figured it out yet.


Edited by MoscowModder, 03 May 2015 - 10:06 PM.


#27 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 04 May 2015 - 08:24 AM

I think one problem is that you should replace a different weapon other than fireballs, since they are always targeted at link, so the manhandla wouldn't shoot them in the right direction. But I'm not 100% sure on this.



#28 TK8305

TK8305

    I <3 Miyu

  • Members
  • Real Name:John
  • Location:South Carolina

Posted 06 May 2015 - 07:53 PM

Any progress made on that script yet Modder?  o_O;



#29 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 06 May 2015 - 11:31 PM

No, sorry. I haven't really been working on it.

 

If anyone else wants to take a stab at fixing it (or re-creating it from scratch), the issue is that the weapons vanish after a single frame. I use stdExtra's debug() function to trace the weapons position to the screen, and the numbers appear only for a single frame.

Broken script


#30 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 07 May 2015 - 01:56 AM

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();
  }
}
}

Ghost.zh does a lot with eweapon Misc values, and just looking at the function for sinusoidal movement missed the initialization step it does with them. The script works fine now. The weapon ID of Manhandla's fireballs is 129, for anyone who wants to use this.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users