Jump to content

Photo

Ice Rod

ice wand rod magic staff freeze lava water

  • Please log in to reply
11 replies to this topic

#1 Shosci

Shosci

    Gaming Topics and Live Streams

  • Members
  • Real Name:Eshaan

Posted 09 September 2014 - 07:56 AM

I'm sure that there's a script for this already, but I never seem to find it. Of course, I suck at scripting, which is why I am hoping someone can make this.

 

What do I want from this:

  • Ice Rod uses Custom Class 03 or the Wand (no Magic Book)
  • Ice Rod can stun enemies
  • Ice Rod freezes water tiles and lava tiles*
  • Ice Rod consumes magic
  • Ice Rod doesn't really trigger secrets, if the ice blast shoots across the water or lava, it should continue until it hits another solid combo or the edge of the screen.

*Lava tiles in my quest are solid combos and nothing else. If there is way that the Ice Rod can freeze a certain combo# like where my lava combo is, that would be great.



#2 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 15 September 2014 - 09:13 AM

This isn't the initial request for this sort of item... There are ice rod item scripts on the forums, but freezing water, and freezing enemies are global components that are usually game-specific. I don't recall any ice magic global functions/libraries that have been released for general use.

I know that Moosh has a brilliant global function for making ice combos, and one for melting ice into water, but I don't know if those are available for anyone to use.

Stunning/freezing enemies isn't really enough of an explanation for a request of this sort, as people can interpret this rather differently: Would you want the effect to be temporary (like stunning with a boomerang), and if so, what enemies would be immune?

(Any LWeapon with a 'Power' of '0' will stun enemies, and the ability of an enemy to block it is based on its 'Level'. Enemies with the flag 'Damaged by )0-Power weapons treat such weapons as if their 'Level' is their 'Power'.)

Else, is the stun duration permanent (as in Z3), or somewhere between these two?

Do you want the stunned enemy to appear frozen with visual effects?

Do you want frozen enemies to be destroyed by a hammer (e.g. shattered)?

Does fire return them to normal, or destroy them? Are fire enemies weak, or immune to ice?

Is hot terrain going to affect the frozen enemy effect?

---

I know that I'm considering all of that for my custom ice magic in LoE., but that's not complete, or in any way ready for release.

With regard to your question, you can use the combo ID in a for loop, to check for collision, unless I've gone totally mental. That's less efficient than using flags, but for a limited number of combos, you can use global functions to convert them without script flags.

Alternatively, you can set up any combo with both a frozen state, and melted state (e.g. water/ice, magma/rock) so that each combo has its frozen state one combo space after its melted state; then use one flag for combos that the player can freeze. That would simplify the global function to something like this:
 
//Presuming use of stdCombos.zh)

void ComboChange(int Cflag, int Ltype){
	for ( int i = 0; i < 176; i++ ){
		if ( Screen->ComboF[i] == Cflag ) {
			if ( ComboCollision(i, Ltype) ) { 
                                Screen->ComboD[i]++;
                        }
		}
	}
}

//Then, call in your main active loop, before Waitdraw():
ComboChange(CF_MELT,LW_ICE);

//The following function should work with any combo flag, or combo type, and LW type. 

void ComboChange(int comboTF, int Ltype, bool flagCheck){
	for ( int i = 0; i < 176; i++ ){
		if ( flag == true && Screen->ComboF[i] == comboTF ) {
			if ( ComboCollision(i, Ltype) ) { 
                                Screen->ComboD[i]++;
                        }
		}
                if ( flag == false && Screen->ComboT[i] == comboTF ) {
			if ( ComboCollision(i, Ltype) ) { 
                                Screen->ComboD[i]++;
                        }
		}
	}
}

//Usage:
// For combo flags:
ComboChange(CF_MELT,LW_ICE,true);
//For combo types
ComboChange(CT_WATER,LW_ICE,false);

The following function would accept a specific number of tiles as an argument, and thus, youbcould set up combo pages with solid states, followed by melted states, at specific intervals.

 
void ComboChange(int Cflag, int Ltype, int numTiles){
	for ( int i = 0; i < 176; i++ ){
		if ( Screen->ComboF[i] == Cflag ) {
			if ( ComboCollision(i, Ltype) ) { 
                                Screen->ComboD[i] += numTiles;
                        }
		}
	}
}

You could also do this with tile pages, and use drawtile commands to establish something similar to LTMs for this kind of thing; so you might imagine that an assortment of library functions could be required to make this suitable, and indeed practical, for anyone to use it.

P.S. Untested, and not guaranteed. I would personally add some fancy effects, with FFCs called in the function, and a timer, to freeze ice, or magma, but the above should work on its own. It's what you'd want for combo changing, and you'd also need to add constants for CT_MELT, and LW_ICE.

I'll re-examine how I handled specific combo numbers in the past, when I'm not so terribly busy, and in so much pain. IIRC, Alucard was adding code for that to stdCombos.zh, so I'll need to read his latest version.

The basic method would be something like this:
const int CB_MAGMA_M = 1000; //Assign to values of magma combos.
const int CB_MAGMA_L = 1001;
const int CB_MAGMA_R = 1002;
const int CB_MAGMA_U = 1003;
const int CB_MAGMA_D = 1004;
const int CB_MAGMA_UR = 1005:
const int CB_MAGMA_UL = 1006;
const int CB_MAGMA_LR = 1007;
const int CB_MAGMA_LL = 1008;
//Solid rock combos should immediately follow these combos, in an identical order. 
//Thus, the solid crock 'middle combo', if the magma middle combo is ID 1000, should be 1009.

void MagmaChange(int Ltype){
	for ( int i = 0; i < 176; i++ ){
		if ( Screen->ComboD[i] == CB_MAGMA_M ||      
                     Screen->ComboD[i] == CB_MAGMA_L ||
                     Screen->ComboD[i] == CB_MAGMA_R ||
                     Screen->ComboD[i] == CB_MAGMA_U ||
                     Screen->ComboD[i] == CB_MAGMA_D ||
                     Screen->ComboD[i] == CB_MAGMA_UR ||
                     Screen->ComboD[i] == CB_MAGMA_UL ||
                     Screen->ComboD[i] == CB_MAGMA_LR ||
                     Screen->ComboD[i] == CB_MAGMA_LL ) {
			if ( ComboCollision(i, Ltype) ) { 
                                Screen->ComboD[i] += 9;
                        }
		}
	}
}

//Calling this in your main active loop, before Waitdraw():
MagmaChange(LW_ICE);
You can set up constants for the post-freeze combos, and convert the single inclusive or list,into single if/else if statements for each pair. Doing this avoids using CTs, and flags, but requires more set-up; plus, the need to keep combo numbers within numeric range of max int.


Note also that none of these would be permanent, or persistent changes. For that, you'd need to store the locations of changed combos in an array, or in Screen->D, and you'd either need functions t convert frozen combos by reading Screen->D, or array indices before Waitdraw(), or FFCs that work in a similar manner. Global functions that run before Waitdraw() are, naturally a prettier solution.

Screen->Secrets just isn't properly viable for this sort of thing, and making arrays for each screen of this sort is painful.

---

This could also be used for switches/gates, and other puzzles that may only need a single flag. If you only want to freeze water, you can substitute CFlag, with CType (CT_WATER), or something similar. (Custom CTs would be especially useful here.)

P.P.S. You have five script flags, and five script CTs. If you use them wisely, that gives you 25 basic combinations, that you can expand to 125 using dual-flags, and even further using layers. The problem here, becomes micro-management, which in turn, makes this sort of thing less user-friendly.

For a simple (application-specific) solution, you could use CT_MAGMA with CT_WATER (a default), and then use CF_ACTIVE and CF_INACTIVE as self-defined script flags, to set two states for each, and re-use those flags for other CTs, so that you needn't waste script flags.

If I present an ice system for general use, and that's likely going to become part of RPG.zh, as that header is intended to handle elemental magic, then it will need to be something that doesn't easily conflict with other headers, and scripts; and thus doesn't rely overmuch on singular flags.

P.P.P.S. These functions are free for anyone to use, modify, and distribute, per GPL2.

Edited by ZoriaRPG, 15 September 2014 - 11:04 AM.


#3 Shosci

Shosci

    Gaming Topics and Live Streams

  • Members
  • Real Name:Eshaan

Posted 15 September 2014 - 08:11 PM

I didn't try out the script yet, but I will answer some of your questions. Hot terrain won't affect the Ice Rod. Freezing the enemies won't really matter because I want to keep it slightly simple. Instead, it would stun just as long as a Boomerang would, so extra sprites aren't necessary. 

 

Also, I thought of an idea that might alter the script a bit. I could change my lava tiles to being "Ladder/Hookshot" combos since I am not using either of those items. Maybe the script can be changed to be simple because of that.



#4 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 16 September 2014 - 11:14 AM

Do you want it to affect enemies that a boomerang can't?

Do you have any other weapons in the game using any Script LW type?

You have two options for how to handle combos:
(1) Set up every water combo, so that its matching ice combo is always the same number of places away; and do the same for magma/rock pairs, or;
(2) Use constants to establish the original->new combo datum. This won't require any flags by default, but it can be modified to require flags easily, for people that want very limited freezing areas, rather than realistic effects (i.e. freezing any water combo).

Option 2 is better if you don't want to remaster a tileset, but you'd need a constant (and subroutine) for each main water, and magma combo. (ZC tilesets often have many water combo sets.) I'd prefer option two, as it more easily allows other people to use the code, but it also makes the code much longer.

Do you want the freezing to affect only a single combo, or a row of combos? That dramatically affects how I'd need to go about creating the effect.

Edited by ZoriaRPG, 16 September 2014 - 11:17 AM.


#5 Shosci

Shosci

    Gaming Topics and Live Streams

  • Members
  • Real Name:Eshaan

Posted 16 September 2014 - 01:35 PM

- Yes, possibly stun every enemy including Darknuts and Wizzrobes to make it more useful. As well as one-shoting Keese and Gel like the Boomerang.

- Not sure what you mean by Script LW

 

Option 2 sounds simpler just because I would assume the script would identify what combo type it would freeze

 

- I want the ice to freeze a row of combos. Like shooting the ice blast so it would freeze a line of lava sprites while passing it.



#6 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 17 September 2014 - 05:17 AM

That makes it simple. If you can wait a few days, I'll make this for you. It's mostly a matter of patching together stuff I've already made.

By Script LW, I mean weapons/items that produce a Script type weapon, as recognised by the enemy editor. If you don't have anything else on a script type, then I can make very simple item script, using LW_SCRIPT1, and you can define the effect for script weapons in the enemy editor for each enemy. (If you already had something using an LW_SCRIPT type, this wouldn't work.)

I'd prefer to know how many water combos in your game you have, that you want the player to be able to freeze, and how many magma combos you have that you want the player to be able to solidify to stone. The basic setup would be 18 source, and 18 destination combos. Adding more later, is easy though, and I'll comment that for you.

Keep in mind that you'll need to make paths with some solid 'stepping stone' spaces, such as on screen edges, as the change will every when the player leaves the screen with this basic model. (e.g. You want small areas, not multi-screen magma lakes without normal, walkable combos on the screen edges. You'll also need to test for potential sequence-breaking, etc..)

#7 Shosci

Shosci

    Gaming Topics and Live Streams

  • Members
  • Real Name:Eshaan

Posted 17 September 2014 - 11:30 AM

As far as my current script file goes, I seem to have a Script LW already in use for my Magic Leaf script.



#8 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 18 September 2014 - 07:36 AM

That would make this problematic, so I may need to rethink the idea. P.M. that script to me, if you would, so that I can determine why it uses a LW_SCRIPT type.

As ZC doesn't have included NPCDs for each script type, I'd need to make some global code for custom NPCDs for you, if your leaf needs to be a script LW type. That's for enemy-editor interaction.

I'd use the hookshot, (because you aren't including one in the game) but that type of LW can't be created.

Update:

Ice Rod Script v6
Note: This is designed tot he needs of epad, and doesn't include Z3 style ice magic, such as turning enemies to blocks of ice.

This remains untested, and is a WIP: It may work as-is, but I can;t guarantee that.

At 741 lines, it's too long to post directly: The massive length is due to using global functions for individual combo pairs, rather than using flags.

This includes two methods: One requires stdCombos.zhm while the other requires Itemhandling.zh. (You can download both of these from my signature.)

Again, 'untested warnings' apply to this code. I'm readying to retire early this afternoon, so I won't be testing anything today.

@Others: Feel free to improve on this, if you wish.

Edited by ZoriaRPG, 18 September 2014 - 11:45 AM.


#9 Shosci

Shosci

    Gaming Topics and Live Streams

  • Members
  • Real Name:Eshaan

Posted 20 September 2014 - 08:51 AM

I seem to get an error on Line 864. There was a similar error on SFX_SOUND_DURATION_WATER, but I don't think that was an issue.

   if Screen->ComboD[i] == CMB_MAGMA_UL ) {
            if ( ComboCollision(i, LType) {
                playingMagmaFreezeSound = true;
                Screen->ComboD[i] = CMB_MAGMA_FROZEN_UL;

Also, considering that this is a Global, should I change activeExample to IWarnedYouMan (which I believe was my Global Active)?

Or do I combine all of the scripts in activeExample to IWarnedYouMan?



#10 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 20 September 2014 - 11:07 AM

You need to merge the global scripts, which probably means that I'll need to merge them for you; and I also have some improvements for this under way for this project.

#11 Shosci

Shosci

    Gaming Topics and Live Streams

  • Members
  • Real Name:Eshaan

Posted 20 September 2014 - 12:09 PM

Do you need me to send the code again or do you already have it?



#12 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 20 September 2014 - 05:13 PM

I have what you last sent to me, so unless you've changed it, I don't need it again.



Also tagged with one or more of these keywords: ice, wand, rod, magic, staff, freeze, lava, water

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users