- 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.
ghost.zh
#31
Posted 28 April 2011 - 03:20 PM
#32
Posted 30 April 2011 - 02:07 PM
#33
Posted 30 April 2011 - 07:53 PM
#34
Posted 30 April 2011 - 08:48 PM
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.
No. You only need it to compile the scripts.
#35
Posted 01 May 2011 - 12:12 PM
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
Posted 03 August 2011 - 01:29 PM
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.
ghost.zh
Demo quest and sample scripts
AutoGhost enemies
AutoGhost setup demo video
#37
Posted 03 August 2011 - 11:16 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.
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?!?!?!?!
#39
Posted 06 August 2011 - 01:22 PM
Edited by blackbishop89, 06 August 2011 - 01:22 PM.
#40
Posted 08 August 2011 - 06:57 PM
#41
Posted 08 August 2011 - 07:09 PM
I'll see what I can do.
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.
Should be fine. They're not mine, they're part of the tileset: http://www.purezc.co...=tilesets&id=64
#42
Posted 08 August 2011 - 07:23 PM
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
Posted 09 August 2011 - 10:06 AM
#44
Posted 09 August 2011 - 11:21 AM
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.
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
Posted 09 August 2011 - 11:23 AM
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.
4 user(s) are reading this topic
0 members, 4 guests, 0 anonymous users