Jump to content

Photo

Lweapons.zh- (Because Why Not?)

library

  • Please log in to reply
22 replies to this topic

#1 ywkls

ywkls

    Warrior

  • Members
  • Gender:Unspecified

Posted 11 July 2016 - 01:51 PM

Yes... I know that Alucard648 just released his stdWeapons.zh. And yes, I do know that others have released and done things related to lweapons in the past. However, up until now; I've been unable to understand any of these.

 

So, I went to the files in ghost.zh that deal with eweapon handling and reverse engineered a lot of the stuff in there to work with lweapons. Then I kind of went crazy.

 

This is a completely untested set of scripts, many of which may not work as intended. The only advantage over stdWeapons.zh? This uses the global script, rather than ffcs.

 

Most of the functions within are designed to deliberately mimic the functions from ghost.zh, so that people who can already use that can start playing around with these at once.

 

Here's what is supported and tested so far.

 

Normal lweapons.

Sine wave movement.

Projectile homes in on enemies.

 

This is the stuff that's untested as of yet, but should work.

 

Large lweapons.

Thrown projectiles.

LWeapons that fall from the sky.

LWeapons that move in a circle around Link.

LWeapons with a limited lifespan.

LWeapon death effects.

 

The rest probably needs some work.

 

LWeapons that act like hookshots.

LWeapons that pick up items.

LWeapons that pierce enemies.

LWeapons that stun enemies.

LWeapons that are reflected by magic mirrors.

 

Any thoughts on this, bugs or possible suggestions for improvement would be appreciated.

 

Last, but not least... the script file.

 

LWeapons.zh (zip file)

 

I expect there to be numerous bugs.


Edited by ywkls, 03 July 2017 - 09:19 PM.


#2 ywkls

ywkls

    Warrior

  • Members
  • Gender:Unspecified

Posted 16 July 2016 - 03:35 PM

An update on this, to let people know what's been done and what I'm putting off for the moment.
 
Tested
 
Thrown projectiles.
LWeapons that fall from the sky.
LWeapons that move in a circle around Link.
LWeapons with a limited lifespan.
LWeapon death effects.

LWeapons with flags that simulate multiple levels of an item.

LWeapons that ignore gravity.

 

Untested, but should work

 

Big lweapons.

Lweapons that drain MP regularly until you're out, then die.

Lweapons that make a sound at a regular interval while active.

Other lweapon flags.

 

I still haven't tackled boomerangs, hookshots or melee weapons because they scare me.


Edited by ywkls, 03 July 2017 - 09:20 PM.


#3 ZoriaRPG

ZoriaRPG

    The Timelord

  • ZC Developers
  • Gender:Unspecified
  • Location:Prydon Academy

Posted 18 July 2016 - 06:08 AM

Feel free to steal the item grab functions for lweapons from RPG.zh for this. Those are extensively tested.

You should reduce your lw states into binary flags, if you have not yet done that.

Edited by ZoriaRPG, 18 July 2016 - 06:09 AM.

  • ywkls likes this

#4 ywkls

ywkls

    Warrior

  • Members
  • Gender:Unspecified

Posted 16 August 2016 - 08:57 AM

I've done some more work and testing on this since I last updated the library.

 

Here's what's been tested to work so far (since my previous update).

 

Done

 

Lweapons that pierce enemies.

Lweapons that stun enemies.

Lweapons with collision detection turned off. (Good for making things that don't hurt enemies.)

Lweapons that continuously make a sound after they're fired.

 

I'll probably next test lweapons with continuous MP drain, large lweapons and item pickup.

 

I've tried a little fiddling around with my own boomerang and hookshot code, without much success. I'll post the boomerang handling routines as a sampler so maybe somebody can point me in the right direction. (Some routines are borrowed from stdweapons.zh)

 

I've also got ideas for creating poisoning and freezing lweapons, but they're in the tentative stages right now.

 

I've added to my existing script library easy to make grenades and bomb arrows.

 

Anyways, here's the boomerang handling code with appropriate comments.

 

Boomerang Handling Code

 

At the moment, the boomerang is either leaving the screen entirely (in the case of a boomerang with infinite range) or hovering exactly as far from Link as it's range, without returning. The movement function is called as long as the return flag isn't set, at which point the return function is called.



#5 idontknow8

idontknow8

    Senior

  • Members

Posted 16 August 2016 - 10:35 AM

Interesting…  Where's the part of the boomerang code that tells it to return if it collides with an enemy, item (screen item or item dropped by killed enemy), a "block boomerang" or "block all" type combo type, or a "boomerang" combo flag?



#6 ywkls

ywkls

    Warrior

  • Members
  • Gender:Unspecified

Posted 16 August 2016 - 11:16 AM

Interesting…  Where's the part of the boomerang code that tells it to return if it collides with an enemy, item (screen item or item dropped by killed enemy), a "block boomerang" or "block all" type combo type, or a "boomerang" combo flag?

 
The enemy code wasn't posted, though it does exist. Here it is.
 

NPC Collision Code

 
That's for all my lweapons, not just this one. I didn't include any of the weapons types that are unable to be produced by script, naturally.
 
 
The item code hadn't been written yet, though I should have thought of it.

 

I've been having trouble with getting my lweapons to react correctly with combos that block them.

 

I'm working on incorporating my existing code for detecting contact with a triggering flags into the code for my lweapons.
 
This is very much a work in progress. I'm posting things that are either done and those I have a good concept for. The one's that I don't; I'm asking for assistance with.



#7 ywkls

ywkls

    Warrior

  • Members
  • Gender:Unspecified

Posted 18 August 2016 - 03:02 PM

Got slightly sidetracked fixing the boomerang code so it works properly. Now it does.

 

To a certain extent, I thought; "Why make it where other lweapons can move in the same pattern as a boomerang?" Then I remembered the theme of this topic. I'm not necessarily doing these things because they need to be done, but because I can do them.

 

So... theoretically, any lweapon that can be generated by a script can now move and act like a boomerang. This includes picking up items. (Which I was able to get to work, thanks to some scripts by ZoriaRPG.) Unfortunately, I'm not sure how to suppress bomb blasts. And combining piercing lweapons and boomerangs means that they'll never actually die.

 

Once I have a few of the minor kinks in the current scripts worked out (including reported script errors of an unknown nature and the refusal of the boomerangs to make sparkles), I'll add all of this code to the available download library. Now, I really must get to working with the other stuff I've created and not tested. (Like large lweapons, continuous MP drain and so forth.)

 

Given how trying to make my own hookshot went last time, I'm going to hold off on another attempt at one for now.


Edited by ywkls, 18 August 2016 - 03:03 PM.


#8 ywkls

ywkls

    Warrior

  • Members
  • Gender:Unspecified

Posted 04 December 2016 - 04:44 PM

It's been a few months since I updated this, mostly because I hadn't done any work on it. But I took some time to create a new demo quest, a documentation file and some new functions and zip everything for people to look over and mess around with.
 
Here's a list of everything that this now supports.
 
Done and Tested
 
Normal lweapons.
Sine wave movement.
Projectile homes in on enemies.
Large lweapons.
Thrown projectiles.
LWeapons that fall from the sky.
LWeapons that move in a circle around Link.
LWeapons with a limited lifespan.
LWeapon death effects.
LWeapons that pick up items.
LWeapons that pierce enemies.
LWeapons that stun enemies.
LWeapons with flags that simulate multiple levels of an item.
LWeapons that ignore gravity.
Lweapons that drain MP regularly until you're out, then die.
Lweapons that make a sound at a regular interval while active.
Lweapons with collision detection turned off. (Good for making things that don't hurt enemies.)
Lweapons that act like boomerangs (including sparkles).
Lweapons that make it where Link isn't harmed while they're in effect. (For simulating the cane of Byrna.)
Lweapons that freeze enemies by creating a block of ice at their location.
Lweapons that die when they reach the edge of the screen.
Lweapons that launch an associated ffc script.
 
Yet to Be Tested
 
Lweapons that poison enemies.
 
 
Work in Progress
 
Lweapons that are carried over Link's head. (Such as grenades.)
Lweapons that act like hookshots.
 
 
Any suggestions for additions or methods of improvement would be greatly appreciated,


Edited by ywkls, 03 July 2017 - 09:21 PM.

  • isilmo likes this

#9 isilmo

isilmo

    Recipient of Ways

  • Members
  • Gender:Unspecified

Posted 04 December 2016 - 07:06 PM

Is there a quest to show this off, it sounds great.



#10 ywkls

ywkls

    Warrior

  • Members
  • Gender:Unspecified

Posted 04 December 2016 - 08:05 PM

Is there a quest to show this off, it sounds great.

 

There's a demo quest included with the zip file, called lwzhtest.qst which demonstrates most of the items; though there aren't a lot of monsters to fight in it. (In fact, there's only two; an Aquamentus and a Goriya.)

 

It's more for trying out the various items and seeing how they behave.

 

Here's a list of items included with the test quest and what they do.

 

Boomerang- Nothing. It's just a boomerang made by a script. This is mostly due to the complexity of making the boomerang work properly,

Axe- a thrown projectile that explodes on impact. (Like a grenade.)

Fire Hook- creates a fire bar that circles Link.

Clock of Doom- creates 4 projectiles that circle Link. While active, you don't take damage and your MP is drained steadily.

Boulder- a large boulder that is thrown and splits into projectiles when it lands.

Bomb Arrows- arrows that explode on impact with an enemy. (Currently, these don't set off bomb flags.)

Meteor Staff- rains down bombs from the sky.

Fire Cane- acts like a fire rod. (Doesn't bounce off of Magic Mirrors correctly.)

Wave Sword- a sword that shoots a beam that travels in a wave.

Homing Arrows- arrows that home in on the enemy.

Ice Rod- shoots a projectile that freezes an enemy for a time.

 

Future plans include but aren't limited to:

 

Scripted hookshots.

Lweapons that bounce off of magic mirrors.

Lweapons that can trigger multiple flags. (Bomb arrows that set off bomb and arrow flags, for instance.)

Cane of Somaria.

Bracelet that lifts and throws objects.

Swords, wands and hammers.

Other lweapon stuff I haven't thought of yet.

 

I should note that while I believe that most of the stuff I want to do can be done, progress has been slow on most of it. I've made stabs at just about everything on that list, without success.

 

The zip also contains a file explaining how to use the scripts, though the setup is very similar to that of the ghost.zh eweapons.


Edited by ywkls, 04 December 2016 - 08:10 PM.

  • isilmo likes this

#11 ywkls

ywkls

    Warrior

  • Members
  • Gender:Unspecified

Posted 10 December 2016 - 02:50 PM

Just added to the script file (at the same link), new stuff!

 

This is mostly to demo lweapons that can hit multiple flags (such as bomb arrows and fire arrows) and a simple power bracelet that carries objects.

 

The power bracelet isn't finished at the moment. (It currently only supports lifting bushes and lets you use other items while it is in effect.)

 

There's also some rudimentary code in there for handling lweapons that bounce off of magic mirrors, but it doesn't work as intended.



#12 ywkls

ywkls

    Warrior

  • Members
  • Gender:Unspecified

Posted 13 January 2017 - 04:34 PM

By special request, the header now supports LWeapons that bounce upon impact.

 

The script file and readme have been updated to reflect this.

 

Credit goes to ShadowBlitz16 for this suggestion.



#13 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 24 January 2017 - 03:51 PM

@ywkls how do I set flags in LW_ZH?

 

I'm trying to set LWF_PIERCES_ENEMIES so I can make a sword



#14 ywkls

ywkls

    Warrior

  • Members
  • Gender:Unspecified

Posted 25 January 2017 - 10:09 AM

@ywkls how do I set flags in LW_ZH?

 

I'm trying to set LWF_PIERCES_ENEMIES so I can make a sword

To do that (for sword beams) you'd want code that looks something like this...

//Name of object.
//Type of lweapon.
//X and Y coordinates to launch at.
//Sprite to use.
//Speed of travel.
//Damage to do.
//Flags. There can be combined by stating flag|flag.
lweapon beam = FireScriptedLWeapon(LW_BEAM, Link->X+InFrontX(Link->Dir,2), Link->Y+InFrontY(Link->Dir,2), 
			   BEAM_SPRITE, BEAM_SPEED, Damage,LWF_PIERCES_ENEMIES);

Flags are the very last argument in this function.

There are other flags for things like the level of the sword beam, or whether it collides with enemies.

Here's a list of those flags.

//LWeapon Flags, use with LW_ZH_I_FLAGS_2

const int LWF_LEVEL_1          	   = 00000000001b;//Simulated level 1 of a particular weapon type.
const int LWF_LEVEL_2		   = 00000000011b;//Simulated level 2 of a particular weapon type..
const int LWF_LEVEL_3		   = 00000000111b;//Simulated level 3 of a particular weapon type.
const int LWF_LEVEL_4		   = 00000001111b;//Simulated level 4 of a particular weapon type.
const int LWF_NO_COLLISION         = 00001000000b;//This lweapon's collision is off.

To use them, make a statement such as this.

beam->Misc[LW_ZH_I_FLAGS_2]|=LWF_LEVEL_4;

It should be noted that only one flag needs to be set to mimic the behavior of a particular level of sword beam (or anything else). 

 

If, on the other hand; you meant an actual sword... I'm afraid that those aren't supported yet.



#15 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 26 January 2017 - 03:19 PM

thankyou


  • ywkls likes this



Also tagged with one or more of these keywords: library

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users