Jump to content

Photo

Metroid-Style Ammo, Refill Station


  • Please log in to reply
7 replies to this topic

#1 ywkls

ywkls

    Master

  • Members

Posted 20 February 2015 - 06:05 PM

I'm working in the latest version of Zelda Classic 2.5 with the Metroid Prime tileset by toaofgamecube. I've got a partial code that does seem to work to accomplish most of what I'm trying to do but one section of it refuses to bend to my will. I've attempt to search out other code that does what I want to no avail, so I'm going to post what I've got; then explain what I'm trying to do.

 

Spoiler

 

In case it isn't obvious, I'm trying to make code that creates easily customizable ammo upgrades for a Metroid-style quest (although they could probably be adapted to other quests fairly easily).

So far, the item script works exactly as desired as does some of the global script. (For some reason, my current amount of arrows is not being reset, but the rupees are.)

 

The respawner is an expanded and modified version of the script I posted to the database designed to keep spawning enemies if any of your current amounts of items is less than its maximum (or endlessly) and it seems to work as designed. However, the refill station doesn't.

 

I've seen some code which scans every combo for a flag and then refills the ammo of your choice to a certain amount when you encounter the combo in question. However, what I'd like is to have it where all you have to do is touch the FFC and it will automatically refill you. The variable refilltype would determine what items are then filled.

 

Any help at finishing this up would be appreciated.


Edited by ywkls, 20 February 2015 - 06:16 PM.


#2 justin

justin

    Adept

  • Members

Posted 20 February 2015 - 06:13 PM

You can use Game->MCounter to set the max of any counter, so those max variables are redundant, and the stuff in your global loop would be redundant in that case because you can let the engine handle it.

More later...

#3 ywkls

ywkls

    Master

  • Members

Posted 20 February 2015 - 06:20 PM

Ah, so that's what Game->MCounter does... good to know. (I really don't like having to look up these commands on the wiki every time I want that information). That would definitely simplify matters. However, wouldn't I still need some variable to change the max of the counter easily? Or could I have it like this...

 

Spoiler

 

Anyways, thanks for that information.


Edited by ywkls, 20 February 2015 - 06:21 PM.


#4 justin

justin

    Adept

  • Members

Posted 20 February 2015 - 08:26 PM

In your refill station code, instead of checking link x/y against this x/y you can simplify with using LinkCollision(this); which will return true if Link is colliding with the ffc. Besides, I think your current check is your problem, because link can't fit inside the ffc like you seem to be checking. You want to check that the bottom of link is greater than the top of the ffc, and the top of link is less than the bottom of the ffc, and s similar check for the horizontal - which is what LinkCollision checks, so just use that...

#5 ywkls

ywkls

    Master

  • Members

Posted 20 February 2015 - 09:00 PM

That works perfectly... now I can spruce it up with some sounds; perhaps some visual effects or a message and I'll consider it done. In the meantime, I've decided to create for my own benefit an easy to access document that explains what each command and function in Zscript means. I'll be using the ZCWiki as my source for a lot of this. I'm mostly doing it because I find the explanations there to be a bit obscure and I'm tired of scouring each script file for explanations of what something is (whether it be a bool, float, int, function, ffc script, global script, item script or whatever).

 

If I knew all these things, I wouldn't have to make requests like this one anymore. (This is probably the most easily fixed problem I've seen.) I'd rather not create threads that I could solve myself if I just knew the language better. (I'd rather reserve that for truly mind-boggling problems, like enemy scripts. Shudder...) Once I get my reference guide done, I may post it if anyone is interested. Thanks for your help, justin! The tips you've given have considerably lightened my load.

 

Her'e's the current version of this script. Once I add effects, I'll post a final version.

 

Spoiler

 

I think that using this interferes with the normal quiver, wallet and bomb bag items. (In my quest, i have them automatically equipped and set to whatever the maximum you can get in the game is.) However, adjusting the size of the variables that determine how much each counter's max is increased is fairly easy, as is expanding it to include more ammo and counter types. (At least, it is for me now. A few months ago is a different story...)

 

I also set it up so that you don't have to display a message when you collect an item and you can make it where a spawn point either creates one enemy as long as you don't have the max for one of these counters or just keeps creating foes endlessly. Again, I may add some more features later. For now, it does what I created this thread to accomplish and that's what's important.



#6 justin

justin

    Adept

  • Members

Posted 20 February 2015 - 09:26 PM

Have you seen this?
http://www.purezc.net/zsdocs/

#7 ywkls

ywkls

    Master

  • Members

Posted 21 February 2015 - 01:24 AM

Have you seen this?
http://www.purezc.net/zsdocs/

 

Nope, but it is very useful for my purposes. I'm just putting down everything in one file for my own use and explaining it in terms I find easy to understand and organizing it by what type of command it is. That link there needs to be on the main page of the PureZC website, since it is a lot easier to navigate than the wiki for the purposes of finding stuff about Zscript. Thanks for the tip!



#8 ywkls

ywkls

    Master

  • Members

Posted 21 February 2015 - 11:12 PM

Alright, I think I've taken this code idea as far as I can on my own. Anybody who wants to add any more to it for their own use should feel free to do so. A few notes on setting this up. The items you get that increase your total should not have anything in their increase max amount box. While that is another way to do virtually the same thing as this, by coding it you make it where the code controls the amount of increase rather than the item. (That way it can be adjusted depending on your preference. Besides which, I've had trouble getting the increase amount settings on items to work properly.)

 

If you use the global script part, it supersedes anything you set in Init data. I don't really know which method would be best. I'm just using this one. The respawner ffc script won't spawn more than one of the same type of enemy if you have two on the screen. So don't do that.  And the refill station now has a sound it plays for a certain amount of time when you refill. I thought about the message part for a while, but if it plays first it kind of disrupts how everything works and I've had some trouble getting it to play after. (Zscript may be something I'm improving at, but it can still baffle me by having things not work that seem like they should.)

 

Here's my code for the items that automatically increase the max, global script to set those maxes to zero the first time it loads; respawn enemies either endlessly or when you don't have the max of a certain counter and refill your health in various ways.

 

Spoiler

 

Thanks to justin for his tips on this and to others who've written scripts. I've adapted a lot of different methods to suit my purposes and I've gotten most of them to work. Sometimes I still can't get things to my goal on my own, which is why I created this thread and will probably make other similar ones in the future. 




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users