Jump to content

Photo

Reach weapon / Spear

Item Weapon

  • Please log in to reply
4 replies to this topic

#1 Lelouche Vi Britannia

Lelouche Vi Britannia

    Newbie

  • Members

Posted 14 July 2017 - 08:43 AM

Hey.

So I'm not even sure this is possible to script, but can a script be made for a melee weapon that reaches 2 tiles (about 32 pixels) long. No swing though, just a straight one direction stab. The weapon must be able to hit 2 enemies in a line if both are lined up. Thanks in advance if it can be done.

#2 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 14 July 2017 - 04:38 PM

Someone scripted this for me a while ago. It might have been Ryunaker?

 

I think I took out all the game-specific tweaks I made for Solaris. Let me know if it doesn't work or you can't figure it out.

 

This requires ffcscript.zh.

 

Script


#3 ywkls

ywkls

    Master

  • Members

Posted 14 July 2017 - 05:43 PM

That's certainly a very complex method of doing this.

 

I wrote a scripted LWeapon header which could also do something similar; though I've never tested this particular scenario since diagonal Lweapons that are 2 tiles big are a nightmare.

 

Using that method, I would have done something like this;

const int SPR_SPEAR_DN = 107;
const int SPR_SPEAR_LF = 106;
const int SPR_SPEAR_RT = 108;
const int SPR_SPEAR_UP = 105;

//D0- Blank so other scripts can use item
//D1- Damage done by item.
//D2- Sound made when using item

item script Spear{
	void run(int dummy, int Damage, int sfx){
		if(NumLWeaponsOf(LW_SCRIPT1)==0){
			lweapon spear;
			if(Link->Dir==DIR_UP)
				spear = FireBigLWeapon(LW_SCRIPT1, Link->X, Link->Y-32, 
							__DirtoRad(Link->Dir), 0, Damage, 
							SPR_SPEAR_UP, sfx, LWF_PIERCES_ENEMIES,1,2);
			else if(Link->Dir==DIR_DOWN)
				spear = FireBigLWeapon(LW_SCRIPT1, Link->X, Link->Y+16, 
							__DirtoRad(Link->Dir), 0, Damage, 
							SPR_SPEAR_DN, sfx, LWF_PIERCES_ENEMIES,1,2);
			else if(Link->Dir==DIR_LEFT)
				spear = FireBigLWeapon(LW_SCRIPT1, Link->X-32, Link->Y, 
							__DirtoRad(Link->Dir), 0, Damage, 
							SPR_SPEAR_LF, sfx, LWF_PIERCES_ENEMIES,2,1);
			else if(Link->Dir==DIR_RIGHT)
				spear = FireBigLWeapon(LW_SCRIPT1, Link->X+16, Link->Y, 
							__DirtoRad(Link->Dir), 0, Damage, 
							SPR_SPEAR_RT, sfx, LWF_PIERCES_ENEMIES,2,1);								
			SetLWeaponLifespan(spear,LWL_TIMER,10);
			SetLWeaponDeathEffect(spear,LWD_VANISH,0);
			Link->Action = LA_ATTACKING;
		}
	}
}

Please keep in mind that this won't work without the header in question.

 

This method is also untested, though I could probably whip up something that works fairly quickly.

 

The header in question can be found here.

 

You can use any method you like. (There's also Alucard648's stdWeapons.zh, which I don't understand.)

 

The only reason I'm suggesting mine is that it requires no ffc scripts to work. I'll be experimenting with it, just in case there are any unforeseen bugs.


Edited by ywkls, 14 July 2017 - 07:27 PM.


#4 Avaro

Avaro

    o_o

  • Members
  • Real Name:Robin
  • Location:Germany

Posted 14 July 2017 - 06:15 PM

Not sure if a big LWeapon can hit 2 enemies at once. I'd rather make it 2 seperate LWeapons.


Edited by Avataro, 14 July 2017 - 06:15 PM.


#5 ywkls

ywkls

    Master

  • Members

Posted 14 July 2017 - 07:36 PM

Not sure if a big LWeapon can hit 2 enemies at once. I'd rather make it 2 seperate LWeapons.

That's actually a fair point and one of the reasons I wanted to test the idea.

 

One thing I've already discovered is that my current code is not optimized for the correct handling of sprites for 1 x 2 (or 2 x 1) lweapons. So, I'll have to work on that if I want to support them. (Oddly shaped hitboxes are generally harder to do than square ones.)

 

Two separate lweapons would be ludicrously simple.

 

Two Lweapons for the price of one

 

Also, edited the first section of code to fix some errors.


Edited by ywkls, 14 July 2017 - 07:36 PM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users