Jump to content

Photo

[2.55] LaserEX


  • Please log in to reply
5 replies to this topic

#1 P-Tux7

P-Tux7

    💛

  • Members

Posted 13 October 2019 - 11:04 PM

Basically a version of laser.zh that has a boolean of being stopped by solid combos or not. I'd like to try to practice scripting by making an EWeapon script spawn lasers (i.e. laser octorok/wizzobe/gleeok/gohma)but the current laser.zh not having any solidity checks makes it not really all that versatile. Not as important, but a feature where the laser-spawner can move and the laser moves along with it would also be cool. This would also be a cool improvement to Newbie Boss.



#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 23 October 2019 - 11:24 AM

I don't know about a header, but I cobbled this together. It may be worth testing.
 
 
#include "std.zh"

    eweapon script laz
    {
    	void run(int speed, int colour, int layer, int fizzlesfx, int fizzlesprite, int shotsfx)
    	{
    		int startX = this->X;
    		int startY = this->Y;
    		this->Angular = true;
    		Audio->PlaySound(shotsfx); //because enemy editor shot sound isn't variable yet
    		this->Angle = ArcTan(Link->X-this->X, Link->Y-this->Y);
    		this->Step = speed;
    		//this->Damage = Game->LoadNPCData(this->Parent)->WeaponDamage; //should get bthis from the enemy editor
    		this->DrawYOffset = -32768; //make wpn sprite invisible
    		while(1)
    		{
    			if (Screen->isSolid(CenterX(this), CenterY(this)))
    			{
    				this->DeadState = WDS_DEAD;
    				Audio->PlaySound(fizzlesfx);
    				if(fizzlesprite)
    				{
    					
    					lweapon fiz = Screen->CreateLWeapon(LW_SPARKLE);
    					fiz->UseSprite(fizzlesprite);
    					fiz->CollDetection = false;
    					fiz->X = this->X;
    					fiz->Y = this->Y;
    				}
    			}
    			else
    			{
    				Screen->Line(layer, startX, startY, CenterX(this), CenterY(this), colour, 1, 0, 0, 0, 128);
    			}
    			Waitframe();
    		}
    	}
    }


#3 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 23 October 2019 - 05:08 PM

-snip-

I'd personally not make a separate weapon for the fizzle animation, I'd make the weapon become the fizzle (setting CollDetection=false, or hitoffset = 9999, etc). Why create an extra weapon for a death effect when you don't need to?



#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 24 October 2019 - 03:43 AM

I'd personally not make a separate weapon for the fizzle animation, I'd make the weapon become the fizzle (setting CollDetection=false, or hitoffset = 9999, etc). Why create an extra weapon for a death effect when you don't need to?


It resets/ensures that the anim frame is set to 0, for wSparkle. I also fixed the compilation (missing RPAREN).

I see that weapon scripts need ParentUID, to return the current npc screen index is controlling them, so that the weapon script can get current frame data on its parent npc sprite.

#5 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 24 October 2019 - 03:45 AM

It resets/ensures that the anim frame is set to 0, for wSparkle.

'lw->Frame = 0;'?



#6 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 27 October 2019 - 06:26 AM

I added ParentUID, so, once I test it and know it works, I'll post an update.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users