Jump to content

Photo

ghost.zh


  • Please log in to reply
645 replies to this topic

#31 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 28 April 2011 - 03:20 PM

All right, new version's up. I ended up changing a bit more than I expected, but nothing that should require huge changes. A lot of little stuff, mostly.
  • All ffc->Misc[] data has been moved to npc->Misc[]. Any scripts accessing these directly or using GotHit() will have to be updated.
  • npc->Misc[GHI_BASE_CSET] is no longer needed; npc->CSet is used instead.
  • Added SetCSet() and RevertCSet().
  • GhostInitWait2() has changed; the argument specifying which enemy to use is no longer needed. Instead, it finds the first one that's not already in use by another script. The old version of the function is deprecated, and the obsolete argument is ignored.
  • Added flags to make enemies ignore solid combos, water, and pits.
  • npc->TileWidth and npc->TileHeight are now set by the Init functions and Transform(), so shadows should be drawn in the right place in beta 18 and up.
  • Added DrawSpawnAnimation(), which lets you show the enemy spawning graphic that gets cut off by the Init functions.
  • If GH_BLANK_TILE is set and the enemy used has a frame rate of 0 (or 256, since ZC changes 0 to 256), the enemy's tile will be set to a clear one automatically. This way, you can give the enemy a visible tile so it shows up in the enemy panel in ZQuest's large mode.
  • Added an internal EWeapon flag that marks the weapon as having been spawned by ghost.zh. This allows other scripts to use all but one element of eweapon->Misc[] without causing confusion.
  • Reworked SpawnNPC() to increase the minimum distance from Link.
  • ghost_zh_readme.txt has been renamed ghost.txt to match other header files' documentation.


#32 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 30 April 2011 - 02:07 PM

Sorry, quick update. I screwed up the arguments to SetCSet() and RevertCSet(). They worked, but they were inconsistent with other functions, and I'm trying to avoid that. Anyway, it's fixed now.

#33 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 30 April 2011 - 07:53 PM

So Saffith, I'm still a bit confused as to what exactly ghost.zh is. Is it just a bunch of shortcuts made in ZScript to make it easier to make custom enemies and bosses? Is it a bunch of completely new script commands? What exactly IS a ghosted enemy anyways? If a quest uses ghost.zh, will someone playing it also need ghost.zh?

#34 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 30 April 2011 - 08:48 PM

QUOTE(Pokemonmaster64 @ Apr 30 2011, 08:53 PM) View Post
So Saffith, I'm still a bit confused as to what exactly ghost.zh is. Is it just a bunch of shortcuts made in ZScript to make it easier to make custom enemies and bosses? Is it a bunch of completely new script commands? What exactly IS a ghosted enemy anyways?

A ghosted enemy script is a way of creating scripted enemies. ZC doesn't have enemy scripting, per se, but it can be faked by combining an FFC and an enemy. The FFC runs the script and, in most cases, is what you actually see on the screen. The enemy provides collision detection, HP, and weapon defenses. ghost.zh is a collection of functions that make it easier to write such scripts and make the resulting enemies fit in with regular ones.

QUOTE
If a quest uses ghost.zh, will someone playing it also need ghost.zh?

No. You only need it to compile the scripts.

#35 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 01 May 2011 - 12:12 PM

Four out of five posts on one page, yay. icon_razz.gif But I need some input.

One change I'm considering for the next version is reworking the position handling. The idea is that the enemy's position would be handled by global variables: ghostX, ghostY, ghostZ, ghostJump, ghostVx, ghostVy, ghostAx, and ghostAy. There'd be a new Waitframe function, simply called GhostWaitframe. The reasoning behind this is that the scripted enemy is conceptually a single entity, so dividing its properties between two different pointers is unintuitive and sometimes problematic. This way, all the movement data are handled the same way, and the drawbacks of the current methods vanish. It's also somewhat easier for me to avoid bugs, since there's only one way to interpret the numbers. I'm considering some other similar changes, too. Moving other data to global variables would eliminate the need to pass this and ghost into a lot of functions. Some things wouldn't need functions at all; you could just set ghostCSet instead of using SetCSet and RevertCSet, set ghostData instead of going through Set4WayCombo... I'm not certain how far I should go with that, though.

The question, then, is what do I do about the three existing methods? Supporting all four methods would be pretty difficult, but not out of the question.

I could simply remove the existing functions and change whatever I see fit. That would, of course, require all existing scripts be rewritten, but it might be worth it. I don't expect they'd need huge changes, honestly.

I could deprecate the old ones, but I'd either have to limit the changes I make or have a ton of redundant code. I could, however, separate that into another file, maybe ghost_legacy.zh. I don't know if I can guarantee perfect compatibility, but that still might be the best option.

Or should I not bother with this at all? The current system's a bit awkward at times, but it's not all that bad. Should I just leave things the way they are?


Edit: Went with the split file option. Generally going well so far. Looks like it'll be 18 global variables, not counting the two needed for clocks to work. That sound okay?

#36 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 03 August 2011 - 01:29 PM

All right, big update. Complete overhaul, in fact. Here are the biggest changes this version:

Most enemy properties are now handled by global variables. There are only two standard Waitframe functions, Ghost_Waitframe and Ghost_Waitframe2. There's also a Ghost_WaitframeLight, but that'll generally be used only when the enemy is inactive. A lot of things that used to require a function can now be done just be setting one of the global variables. You can, for instance, set Ghost_HP to set the enemy's HP, set Ghost_CSet to change its CSet, or set Ghost_Data to change its combo, even if GHF_4WAY is set.

There are two major new eweapon death options. First, you can create a dummy eweapon with whatever properties you like, including its own scripted movement, and have an eweapon spawn copies of it on death. Second, you can set up an FFC to run a script where the eweapon died, so you can do whatever you like there.

Finally, the biggest new addition, AutoGhost. With appropriately written enemy scripts, the global script can set up FFCs automatically when enemies appear. That means scripted enemies can be used as easily as built-in ones, with no manual FFC setup at all. This requires at least RC2.

This version is not backward compatible with existing scripts. However, there is a separate file, ghost_legacy.zh, included for this purpose.

Also, thanks to SpacemanDan for putting up with me through this. I know I can get a bit impatient at times. icon_razz.gif

ghost.zh
Demo quest and sample scripts
AutoGhost enemies
AutoGhost setup demo video

#37 Christian

Christian

    Summoner

  • Members
  • Real Name:Chris
  • Location:New Jersey

Posted 03 August 2011 - 11:16 PM

QUOTE(Saffith @ Aug 3 2011, 02:29 PM) View Post

All right, big update. Complete overhaul, in fact. Here are the biggest changes this version:

Most enemy properties are now handled by global variables. There are only two standard Waitframe functions, Ghost_Waitframe and Ghost_Waitframe2. There's also a Ghost_WaitframeLight, but that'll generally be used only when the enemy is inactive. A lot of things that used to require a function can now be done just be setting one of the global variables. You can, for instance, set Ghost_HP to set the enemy's HP, set Ghost_CSet to change its CSet, or set Ghost_Data to change its combo, even if GHF_4WAY is set.

There are two major new eweapon death options. First, you can create a dummy eweapon with whatever properties you like, including its own scripted movement, and have an eweapon spawn copies of it on death. Second, you can set up an FFC to run a script where the eweapon died, so you can do whatever you like there.

Finally, the biggest new addition, AutoGhost. With appropriately written enemy scripts, the global script can set up FFCs automatically when enemies appear. That means scripted enemies can be used as easily as built-in ones, with no manual FFC setup at all. This requires at least RC2.

This version is not backward compatible with existing scripts. However, there is a separate file, ghost_legacy.zh, included for this purpose.

Also, thanks to SpacemanDan for putting up with me through this. I know I can get a bit impatient at times. icon_razz.gif

ghost.zh
Demo quest and sample scripts
AutoGhost enemies
AutoGhost setup demo video


Did i just see Z3 enemies perfectly executed through scripting in Zelda Classic?!?!?!?!

#38 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 04 August 2011 - 05:13 AM

QUOTE(Christian @ Aug 3 2011, 10:16 PM) View Post

Did i just see Z3 enemies perfectly executed through scripting in Zelda Classic?!?!?!?!


Yes ... yes you did, would you like to join me in cries of joy. icon_razz.gif

#39 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 06 August 2011 - 01:22 PM

Would it be possible to make it so visible ffcs that are ghosted enemies become invisible when Link dies or the screen is scrolling like normal enemies. I know the latter is possible by keeping the quest rule ffcs visible while screen is scrolling off. But I would like to not have my users of my ghost enemy scripts not have to be forced to keeping that off. Also, is their a way to check if a ffc is visible ghosted enemy.

Edited by blackbishop89, 06 August 2011 - 01:22 PM.


#40 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 08 August 2011 - 06:57 PM

A little late, but could I steal the tiles for your Grell enemy? I'd love to shove it all up into my quest.


#41 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 08 August 2011 - 07:09 PM

QUOTE(blackbishop89 @ Aug 6 2011, 02:22 PM) View Post
Would it be possible to make it so visible ffcs that are ghosted enemies become invisible when Link dies or the screen is scrolling like normal enemies. I know the latter is possible by keeping the quest rule ffcs visible while screen is scrolling off. But I would like to not have my users of my ghost enemy scripts not have to be forced to keeping that off.

I'll see what I can do.

QUOTE
Also, is their a way to check if a ffc is visible ghosted enemy.

If you know it's an enemy, you can compare its combo to GH_INVISIBLE_COMBO. There's no general way to tell that an FFC is an enemy, though. You'd have to have some other bit of information to check.

QUOTE(Master Maniac @ Aug 8 2011, 07:57 PM) View Post
A little late, but could I steal the tiles for your Grell enemy? I'd love to shove it all up into my quest.

Should be fine. They're not mine, they're part of the tileset: http://www.purezc.co...=tilesets&id=64

#42 Master Maniac

Master Maniac

    Earth, Wind, Fire, and Water.

  • Members
  • Real Name:kris

Posted 08 August 2011 - 07:23 PM

Thanks. I'll make edits to it so they fit into DoR and then submit them to the DB

EDIT: Whoops. Didn't know the real name was Buzzblob. Anyway, from the looks of it, your grell script does the exact same function as a buzzblob, correct?

Edited by Master Maniac, 08 August 2011 - 08:28 PM.


#43 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 09 August 2011 - 10:06 AM

What about having GhostZH set a ffc misc register during initialization that identifies the ffc as being an enemy, assuming you've not used those for ghosted enemies yet.

#44 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 09 August 2011 - 11:21 AM

QUOTE(Master Maniac @ Aug 8 2011, 08:23 PM) View Post
EDIT: Whoops. Didn't know the real name was Buzzblob. Anyway, from the looks of it, your grell script does the exact same function as a buzzblob, correct?

No, the Grell script is just a minor enhancement to a walking enemy, and BuzzBlob is completely scripted. They move and attack differently.
In any case, you're welcome to use any of my scripts and tiles.

QUOTE(blackbishop89 @ Aug 9 2011, 11:06 AM) View Post

What about having GhostZH set a ffc misc register during initialization that identifies the ffc as being an enemy, assuming you've not used those for ghosted enemies yet.

I'd really prefer not to use more Misc elements than absolutely necessary, to minimize the possibility of interference with other scripts. What is it you need this for?

#45 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 09 August 2011 - 11:23 AM

QUOTE(Saffith @ Aug 9 2011, 10:21 AM) View Post

No, the Grell script is just a minor enhancement to a walking enemy, and BuzzBlob is completely scripted. They move and attack differently.
In any case, you're welcome to use any of my scripts and tiles.
I'd really prefer not to use more Misc elements than absolutely necessary, to minimize the possibility of interference with other scripts. What is it you need this for?


To make it so the ghost_data is set to 0 "vanishing" when link dies or the screen is scrolling. Only needed for ffcs where it's visible.

EDIT: Question Saffith, beside lowering ghost_HP is there another way to simulate an enemy being hit?

Edited by blackbishop89, 09 August 2011 - 03:54 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users