Jump to content

Photo

stdWeapons.zh

library beta

  • Please log in to reply
96 replies to this topic

#46 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 19 February 2016 - 11:17 AM

I'll need to see how you set them up. I'm curious if it's similar to my method, or if you used a NPC Misc->[index] to accomplish it. If you want to see any of my models:

RGP_NPCDs.zlib
RPG_NPCDs_Table.zlib
RPG_NPCs.zlib

./RPG_NPCDs_v2.1/ ( I believe these are older than the above files. )

Also of note, is that if all goes well, I'll be adding Script 1-10 defs settings into ZC, so some of these workarounds won't be mandatory to do such a basic thing.



#47 Alucard648

Alucard648

    Wizard

  • Members
  • Location:castle Dracula

Posted 19 February 2016 - 03:18 PM

I'll need to see how you set them up. I'm curious if it's similar to my method, or if you used a NPC Misc->[index] to accomplish it. If you want to see any of my models:

RGP_NPCDs.zlib
RPG_NPCDs_Table.zlib
RPG_NPCs.zlib

./RPG_NPCDs_v2.1/ ( I believe these are older than the above files. )

Also of note, is that if all goes well, I'll be adding Script 1-10 defs settings into ZC, so some of these workarounds won't be mandatory to do such a basic thing.

I used global array, 10240 ints long, 20 entries for each of 512 enemies. 


  • Deedee likes this

#48 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 20 February 2016 - 03:40 AM

I used global array, 10240 ints long, 20 entries for each of 512 enemies. 

 

So, pretty similar, except that I have no idea what the extra 10 defs are intended to do. My array is a size of 5120, as I recall.


Edited by ZoriaRPG, 20 February 2016 - 03:42 AM.

  • Alucard648 likes this

#49 Alucard648

Alucard648

    Wizard

  • Members
  • Location:castle Dracula

Posted 28 February 2016 - 02:31 PM

Golden Cane of Byrna!

Lv14tg7.png

- Multiple lweapons in one script.

- Fine-rotating lweapon sprites.

Coming soon... or not...

Up next:

Spoiler


  • Deedee likes this

#50 Alucard648

Alucard648

    Wizard

  • Members
  • Location:castle Dracula

Posted 05 June 2016 - 03:47 PM

After long hiatus, first RC of the library is ready for testing:

http://www.mediafire.../stdWeapons.zip

 

Experimental Arsenal has grown an extra floor:

http://www.mediafire...WeaponsDemo.qst



#51 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 06 June 2016 - 07:59 AM

Ah-ha! Brilliant!

I'll look it over later this week. I'll be building this, ghost, Tango, and some other components into the core scripts set for 2.50.2-Studio, which is the basis for my planned template quests.

#52 Alucard648

Alucard648

    Wizard

  • Members
  • Location:castle Dracula

Posted 11 June 2016 - 02:01 AM

Ah-ha! Brilliant!

I'll look it over later this week. I'll be building this, ghost, Tango, and some other components into the core scripts set for 2.50.2-Studio, which is the basis for my planned template quests.

As for now, the library is still beta. If no bug reports will be reported within 2 weeks since latest beta update, the header will go into script database.



#53 ywkls

ywkls

    Master

  • Members

Posted 26 June 2016 - 04:35 PM

Hey, I'd like make a request. I've already asked ZoriaRPG about this and he has yet to get back to me on it.

 

Basically, i'd really like to learn how to use this. The test quest is excellent for showing off what the scripts can do and all; but what it lacks is instructions on how to set up your own scripts.

 

Lejes' superb ghost.zh tutorial is something I still look to whenever I have trouble with something related to that; so if you could create a similar guide for this; I would appreciate it.

 

Examples of the global scripts (if any), the various functions and what they do (and which you're likely to use), the various flags that can be set, how to do melee versus projectile and basically anything that would make the process of using this easier would be the most useful to me.

 

Considering the fact that I'm currently having to write my own lweapon script because I don't understand this one, a clear tutorial would save me a lot of time.


  • isilmo likes this

#54 Alucard648

Alucard648

    Wizard

  • Members
  • Location:castle Dracula

Posted 27 June 2016 - 09:30 AM

Hey, I'd like make a request. I've already asked ZoriaRPG about this and he has yet to get back to me on it.

 

Basically, i'd really like to learn how to use this. The test quest is excellent for showing off what the scripts can do and all; but what it lacks is instructions on how to set up your own scripts.

 

Lejes' superb ghost.zh tutorial is something I still look to whenever I have trouble with something related to that; so if you could create a similar guide for this; I would appreciate it.

 

Examples of the global scripts (if any), the various functions and what they do (and which you're likely to use), the various flags that can be set, how to do melee versus projectile and basically anything that would make the process of using this easier would be the most useful to me.

 

Considering the fact that I'm currently having to write my own lweapon script because I don't understand this one, a clear tutorial would save me a lot of time.

The header, both structurally and how scripts work, is very similar to ghost.zh. Here is a simple script example:

const int CR_MAXPROJECTILES=10; //Counter ID used for maximum amount of lweapons launched at time.
const int SFX_ERROR=32; //Error SFX.
const int I_CHAOSRING=104; //Item that allows infinite rupees.

//A DAGGER that moves in straightforward way. Turns Gibdos into Stalfos II. Uses ARROW enemy defense.
//D0: Damage.
//D1: Launch sound.
//D2: Sprite used.
//D3: Unused.
//D4: Flight speed.
//D5: Cost (in rupees).
ffc script Knife{
	void run (int dam, int sound, int sprite, int altsprite, float speed, int cost){
		CheckMaxLweapons(this, (Game->Counter[CR_MAXPROJECTILES]));
		if (!AmmoManager(CR_RUPEES, cost, I_CHAOSRING)){
			Game->PlaySound(SFX_ERROR);
			Quit();
		}
		lweapon knife = LweaponInit(this, LW_GHOSTED, dam, sprite, sound);
		LweaponSetFlag(knife, LWF_AUTO_DIR_UPDATE);
		LweaponSetFlag(knife, LWF_AUTO_SPRITE_UPDATE);
		LweaponSetFlag(knife, LWF_NO_FALL);
		SetEnemyDefense(knife, NPCD_ARROW);
		SetStraightMotion4(this, speed);		
		while (true){
			TransformEnemyOnCollision (knife, NPC_GIBDO, NPC_STALFOS2, false, SFX_EDEAD);
			LweaponWaitframe (this, knife, true);
		}
	}
} 

This is a script for simple throwing weapon: silver knife from Castlevania. Here it`s how it works:

Line 10: Checks if there are already too many scripted lweapons and terminates if it`s true.

Lines 11-14: Checks, if it`s possible to pay it`s cost (Infinite counter items are also processed). Here, it reads counter (rupees counter this time) and if value is greater or equal cost passed as argument reduces counter by that amount. If the function detects infinite rupees bag in Link`s inventory, the entire cost check is bypassed entirely. Also if the weapon uses magic as fuel, 1/2 magic upgrade will be processed internally. If it`s unable to pay cost, the script plays error SFX and terminates.

Line 15: Here goes the lweapon initialization function. It creates lweapon, assigns common parameters, like damage, sprite etc.

Lines 16-18: Each Lweapon has a set of flags, just like enemies in ghost.zh. These commands set some of them to True. Here, the flags for automatic direction and sprite flipping updating are used as well as flag lweapon to be unaffected by gravity. All those flags are described in readme.

Line 19: Sets enemy defense for enemies to interact with this weapon.

Line 20: Defines FFC`s velocity depending on direction and speed set. If direction is not specific, it reads Link`s one.

The main loop:

Line 22: This is special ability for this lweapon. If this command runs every frame, the thrown knife will transform any enemy of specific ID ( blue Gibdo in example) into another enemy (Stalfos L2 in example).

Line 23: The main update routine. Similar to Ghost_Waitframe it handles routinous aspects of scripted lweapon processing and must be called instead of direct call of Waitframe. If pointer to lweapon becomes invalid, the function terminates script automatically.


  • ywkls likes this

#55 ywkls

ywkls

    Master

  • Members

Posted 27 June 2016 - 09:47 AM

Sounds pretty simple... though ghost.zh has proven to baffle me a time or three for no reason.

 

I haven't tried the latest version yet, but I have had some trouble compiling older versions. I know it needs stdCombo.zh and I have std.zh, stdExtra.zh, ffcscript.zh, ghost.zh and string.zh. Anything else that I need?



#56 Alucard648

Alucard648

    Wizard

  • Members
  • Location:castle Dracula

Posted 27 June 2016 - 10:01 AM

Sounds pretty simple... though ghost.zh has proven to baffle me a time or three for no reason.

 

I haven't tried the latest version yet, but I have had some trouble compiling older versions. I know it needs stdCombo.zh and I have std.zh, stdExtra.zh, ffcscript.zh, ghost.zh and string.zh. Anything else that I need?

As for 1.0, it needs std.zh, ffcscript.zh and stdCombos.zh.

 

 

**Setup**

*Main header setup*

1. Set aside 4x4 empty tiles space.
2. Set aside one combo and assign it`s tile to top left corner of tile space
from step 1. Note down ID of that combo.
3. Open stdWeapons.zh and assign constant named LW_FFC_DATA to Id of the combo
from step 2.
4. Check out other constants in stdWeapons.zh, like FFC and Lweapon Misc
array indexes to make sure there aren`t any conflicts with other scripts.
5. Global script combining: put UpdateLweaponZH() function inside the main loop of your Active
global script and InitLweaponZH() inside the Init global script.
6. Import and compile the library. It requires std.zh, ffcscript.zh and stdCombos.zh
7. Assign WeaponLauncher item script to an empty slot. 

 EDIT: forgot to mention that CV subweapons script requires stdExtra.zh and all it`s dependencies.


Edited by Alucard648, 28 June 2016 - 06:21 AM.


#57 ywkls

ywkls

    Master

  • Members

Posted 11 July 2016 - 02:13 AM

Don't know how useful this would be to your header, but due to the fact that I simply can't understand it; I reverse engineered a lot of stuff from ghost.zh's eweapon handling routines to use for lweapons.

 

Basically, it supports most of the same movement patterns and death effects that ghost.zh does, but for eweapons and also includes ways to control lweapon lifespan.

I haven't done an exhaustive amount of testing on this (seeing as it is less than a few days old) but I can see a lot of potential. 



#58 ywkls

ywkls

    Master

  • Members

Posted 20 August 2016 - 01:48 PM

I was wondering how you avoid slowdown whenever generating particles (like with a magic boomerang). Is it because they're all created via ffcs?

 

Right now, I've just gotten my automated boomerangs to work; but launching ffc's from a global script is dodgy at best and they're already using up all but 3 of the lweapon's Misc slots. (One of which can't be used easily, but I could conceivably find a way.)

 

I have a few more objectives to reach before releasing my next beta, but this one is probably the most troublesome at present.



#59 Alucard648

Alucard648

    Wizard

  • Members
  • Location:castle Dracula

Posted 25 August 2016 - 11:24 PM

I was wondering how you avoid slowdown whenever generating particles (like with a magic boomerang). Is it because they're all created via ffcs?

 

Right now, I've just gotten my automated boomerangs to work; but launching ffc's from a global script is dodgy at best and they're already using up all but 3 of the lweapon's Misc slots. (One of which can't be used easily, but I could conceivably find a way.)

 

I have a few more objectives to reach before releasing my next beta, but this one is probably the most troublesome at present.

All particles are handled by a single global script.


  • ywkls likes this

#60 Shadowblitz16

Shadowblitz16

    Illustrious

  • Members

Posted 01 November 2016 - 03:01 PM

@Alucard648

Can you explain the sound argument in the LweaponInit() function?

Is it the sound that plays when the item is picked up or the sound it plays when being used?

I was wondering this because because I am trying to make a Gameboy style sword and it used multiple random sounds when the sword was swung.

 

Edit: also what do I put for the sprite argument in LweaponInit() if I have multiple sprites?

 

I'm trying to make a gameboy sword

 

here is my script even though it is unfinished and I was in the process of renaming stuff

Spoiler

Edited by Shadowblitz16, 02 November 2016 - 03:40 PM.




Also tagged with one or more of these keywords: library, beta

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users