Jump to content

Photo

Creating custom swords and wands


  • Please log in to reply
56 replies to this topic

#46 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 07 August 2013 - 11:43 AM

Oi, did I miss something? Did you mean to place that in the attack ring thread?
 
Pickup Script: If you want to automatically give items when the player gets all three pieces, you can create a global command and assign them via that, along with the cutscene and anything else. You can place the command in your while(true) loop, and as soon as the player has a counter >= 3, the script will run from the command and give the items; or just hard-code the items into your global script to give when all three (and I assume you have only three) pieces are obtained, , and also running special commands to increase abilities, or give special powers, or even run your cutscene, like this,:
 

global script Triforce{
	void run(){
	InitializeGhostZHData();
	int fastWalkTimer;
        int lastScreen = Game->GetCurDMapScreen();
        int lastDMap = Game->GetCurDMap();
		
		
		while(true)
		{
			Game->Counter[CR_SCRIPT2] = Link->HP;
			Game->Counter[CR_SCRIPT3] = Link->MP;
			Game->Counter[CR_SCRIPT4] = Link->MaxHP;
			Game->Counter[CR_SCRIPT5] = Link->MaxMP;
			UpdateEWeapons();
			GiveBundle;
            CleanUpGhostFFCs(); // Only needed if __GH_USE_DRAWCOMBO is 0
            Waitdraw();
            AutoGhost();
            DrawGhostFFCs();
			
			if (Game->Counter[CR_SCRIPT1] >=3); //If Link has the three Triforce Pieces
			{
				Link->Item[000] = true; //Set item number manually.
				Link->Item[000] = true; //Set item number manually.
				Link->Item[000] = true; //Set item number manually.
				Link->Item[000] = true; //Set item number manually.
				fastWalk;
			}
			else{ 
				Link->Item[000] = false; //Set item number manually, prevebts glitch-owning of item.
				Link->Item[000] = false; //Set item number manually, prevebts glitch-owning of item.
				Link->Item[000] = false; //Set item number manually, prevebts glitch-owning of item.
				Link->Item[000] = false; //Set item number manually, prevebts glitch-owning of item.
				}
			
			Waitframe();
			
	}
}

//////////////////////
/// BEGIN COMMANDS ///
//////////////////////





//Makes Link walk faster in addition to normal walking speed
void fastWalk ( int speed ){
    //Up
    if( Link->InputUp
    && !Screen->isSolid(Link->X,Link->Y+6) //NW
    && !Screen->isSolid(Link->X+7,Link->Y+6) //N
    && !Screen->isSolid(Link->X+15,Link->Y+6) //NE
    )
        Link->Y -= speed;
    //Down
    else if( Link->InputDown
    && !Screen->isSolid(Link->X,Link->Y+17) //SW
    && !Screen->isSolid(Link->X+7,Link->Y+17) //S
    && !Screen->isSolid(Link->X+15,Link->Y+17) //SE
    )
        Link->Y += speed;
    //Left
    else if( Link->InputLeft
    && !Screen->isSolid(Link->X-2,Link->Y+8) //NW
    && !Screen->isSolid(Link->X-2,Link->Y+15) //SW
    )
        Link->X -= speed;
    //Right
    else if( Link->InputRight
    && !Screen->isSolid(Link->X+17,Link->Y+8) //NE
    && !Screen->isSolid(Link->X+17,Link->Y+15) //SE
    )
        Link->X += speed;
}


////////////////////
/// END COMMANDS ///
////////////////////


#47 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 07 August 2013 - 01:52 PM

Oi, did I miss something? Did you mean to place that in the attack ring thread?


Nope, if you go back and look at page 2, Orin XD gave me a script to emulate enemy defenses, so I could (hopefully) set up my elemental system. Since the script he gave me was ALREADY in this thread, it seemed a bit redundant to make a new thread. I'm alost done, too. Once I get the elements working properly(which might take a while, considering I have no clue how I'm going to go about it), all I have left to do is add ice combos, Ice magic (enemy) and a better Wind eweapon. One that works like the wind blade's LW_GUST. Then, put together Level 4, and I'll be ready to release another demo.

 

Pickup Script: If you want to automatically give items when the player gets all three pieces, you can create a global command and assign them via that, along with the cutscene and anything else. You can place the command in your while(true) loop, and as soon as the player has a counter >= 3, the script will run from the command and give the items; or just hard-code the items into your global script to give when all three (and I assume you have only three) pieces are obtained, , and also running special commands to increase abilities, or give special powers, or even run your cutscene, like this,:
 

global script Triforce{
	void run(){
	InitializeGhostZHData();
	int fastWalkTimer;
        int lastScreen = Game->GetCurDMapScreen();
        int lastDMap = Game->GetCurDMap();
		
		
		while(true)
		{
			Game->Counter[CR_SCRIPT2] = Link->HP;
			Game->Counter[CR_SCRIPT3] = Link->MP;
			Game->Counter[CR_SCRIPT4] = Link->MaxHP;
			Game->Counter[CR_SCRIPT5] = Link->MaxMP;
			UpdateEWeapons();
			GiveBundle;
            CleanUpGhostFFCs(); // Only needed if __GH_USE_DRAWCOMBO is 0
            Waitdraw();
            AutoGhost();
            DrawGhostFFCs();
			
			if (Game->Counter[CR_SCRIPT1] >=3); //If Link has the three Triforce Pieces
			{
				Link->Item[000] = true; //Set item number manually.
				Link->Item[000] = true; //Set item number manually.
				Link->Item[000] = true; //Set item number manually.
				Link->Item[000] = true; //Set item number manually.
				fastWalk;
			}
			else{ 
				Link->Item[000] = false; //Set item number manually, prevebts glitch-owning of item.
				Link->Item[000] = false; //Set item number manually, prevebts glitch-owning of item.
				Link->Item[000] = false; //Set item number manually, prevebts glitch-owning of item.
				Link->Item[000] = false; //Set item number manually, prevebts glitch-owning of item.
				}
			
			Waitframe();
			
	}
}

//////////////////////
/// BEGIN COMMANDS ///
//////////////////////





//Makes Link walk faster in addition to normal walking speed
void fastWalk ( int speed ){
    //Up
    if( Link->InputUp
    && !Screen->isSolid(Link->X,Link->Y+6) //NW
    && !Screen->isSolid(Link->X+7,Link->Y+6) //N
    && !Screen->isSolid(Link->X+15,Link->Y+6) //NE
    )
        Link->Y -= speed;
    //Down
    else if( Link->InputDown
    && !Screen->isSolid(Link->X,Link->Y+17) //SW
    && !Screen->isSolid(Link->X+7,Link->Y+17) //S
    && !Screen->isSolid(Link->X+15,Link->Y+17) //SE
    )
        Link->Y += speed;
    //Left
    else if( Link->InputLeft
    && !Screen->isSolid(Link->X-2,Link->Y+8) //NW
    && !Screen->isSolid(Link->X-2,Link->Y+15) //SW
    )
        Link->X -= speed;
    //Right
    else if( Link->InputRight
    && !Screen->isSolid(Link->X+17,Link->Y+8) //NE
    && !Screen->isSolid(Link->X+17,Link->Y+15) //SE
    )
        Link->X += speed;
}


////////////////////
/// END COMMANDS ///
////////////////////

Man, lol, they couldn't just make it easy, could they? I assume there's no way to just use the drop upgrade script and dummy items? For example, I place a "triforce piece" dummy item in all three rooms, then make 3 level items. The level 3 is the triforce item I already have, then 1 and 2 represent 1 and 2 pieces, then I just use this script, so that the drops are continuously upgraded (haven't tested it with drops, but in shops it doesn't replace the on-screen sprite, so even though I'd ACTUALLY be picking up the 2 or 3 piece triforce, it would only look like 1 piece.)

const int I_TF1 = 0; //set this to the item number for a single triforce piece
const int I_TF2 = 0; //set this to the item number for 2 triforce pieces
const int I_TF3 = 0; //set this to the item number for full triforce

//Place this inside your while(true) loop
 for ( int i = 1; i <= Screen->NumItems(); i++){
                item drop = Screen->LoadItem(i);
                if ( (drop->ID == I_TF1 && Link->Item[I_TF1]))
                drop->ID = I_TF2; //This checks if you have the 1 piece triforce, if you do, it changes the picked up item to the 2-piece triforce
                if ( (drop->ID == I_TF2 && Link->Item[I_TF2]))
                drop->ID = I_TF3; //This checks if you have the two-piece triforce, if so, it replaces the drop with the full triforce item
            }

now, I just place one triforce fragment in each room, and no matter which order I pick them up, it marks them on my subscreen as 1 piece, 2 pieces, and 3 pieces. The only major drawback is that with this method, I can't assign positions for wisdom, courage and power. That being said, if I wanted to get a fuckton more complicated, I could probably do it.


Edited by Lineas, 07 August 2013 - 01:54 PM.


#48 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 08 August 2013 - 03:53 AM

The previous script (GiveItemBundle) could be attached to any TF drop, with a dummy item for the TF piece, giving the real TF piuece plus the items specified as arguments. I was not (and stil lam not) sure how many actual TF drops you will have in your game, and what they will comprise. THe script in my last post would merely automate giving items when the player gains a certain number of pieces, and you could duplicate it with another if or else if when the player has six, or nine, etc.

 

You would have to set the TF piece to increase a script counter, and whenever the counter reaches a certain umber, the while(true) if statements make the items = true. This emulates increasing Link's power. You could also increase magic and HP at the same time, to have no HC or major item drops, making picking up the TF fragments slowly give Link more abilities, including global commands such as MM's FastWalk that I used as an example above.

 

It's merely a way of doing it that you can hard-code to activate whenever the player has the requisite number of TF pieces, or TF items, or even other items. For example, you could establish an if statement that when Link has three specific items, he gains the use of another item that acts like those three combined.

 

I did this for MC pieces, as halves, in TGC. It's not the only way to do it, just the one I know well-enough to suggest to you.

 

I think that I'm going to need to play your game to understand your TF set-up fully, as I don;t understand how many TF pieces there are in total, and how (and when) the player collects them.



#49 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 08 August 2013 - 04:25 AM

There are three. And they're all collected in the last level. 

 

EDIT: But be patient, I have just two more overworld DMaps to finish and one dungeon, then I'm releasing my next demo, even if I don't have the elemental abilities fully worked out (or at all).

 

EDITEDIT: Oh, yeah, my script also works, by the way, I tested it. Shoulda known it would, it's the same thing as the upgrade scripts I'm already using. Unfortunately, it won't work for things like magic container pieces, because I can't get the damned things to clear from my inventory after I get the 4th. But for things you want to collect and STAY collected, it works beautifully.

 

EDITEDITEDIT: As well it should, I mean it's basically a hard-coded script version of "Upgrade this item when collected twice", except I can extend the upgrade chain as far as I'm willing to script it out.


Edited by Lineas, 08 August 2013 - 04:38 AM.


#50 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 08 August 2013 - 09:00 AM

To remove already-collected magic container pieces, you need to have a set of if and else statements in your while(true) loop that will reset the counter to zero; essentially something along one of these lines:
 
if	  ( (Link->Item[MC_1] == true) &&
		(Link->Item[MC_2] == true) &&
		(Link->Item[MC_3] == true) &&
		(Link->Item[MC_4] == true) )

) //If Link has four Magic Containers
            {
                Link->Item[MC_1] = false; //Removes MPC1.
                Link->Item[MC_2] = false; //Removes MCP2.
				Link->Item[MC_3] = false; //Removes MCP3.
				Link->Item[MC_4] = false; //Removes MCP4.
                Link->MP += 256; //Increases MP by a fixed value.
                Link->MaxMP += 256; //Increases Max MP by a fixed value.
            }
-OR-
 
if	  ( (Link->Item[MC_1] == true) &&
		(Link->Item[MC_2] == true) &&
		(Link->Item[MC_3] == true) &&
		(Link->Item[MC_4] == true) )

) //If Link has four Magic Containers
            {
                Link->Item[MC_1] = false; //Removes MPC1.
                Link->Item[MC_2] = false; //Removes MCP2.
				Link->Item[MC_3] = false; //Removes MCP3.
				Link->Item[MC_4] = false; //Removes MCP4.
                item MCWhole = Screen->CreateItem(58); //Gives link a whole MC.
				MCWhole->X = Link->X;
				MCWhole->Y = Link->Y;
				MCWhole->Z = Link->Z;
            }
--OR--
 
if	  (Game->Counter[MC_COUNTER] > 3)

) //If Link has more than three MP Pieces
            {
                Game->Counter[MC_COUNTER] == 0; //Remduces MC Piece COunter to 0
                item MCWhole = Screen->CreateItem(58); //Gives link a while MC.
				MCWhole->X = Link->X;
				MCWhole->Y = Link->Y;
				MCWhole->Z = Link->Z;
            }
--OR--
 
if	  (Game->Counter[MC_COUNTER] > 3)

) //If Link has more than three MP Pieces
            {
                Game->Counter[MC_COUNTER] == 0; //Reset MC Piece counter to zero.
                Link->MP += 256; //Increases MP by a fixed value.
                Link->MaxMP += 256; //Increases Max MP by a fixed value.
            }

You will have to tie this into your subscreen and the item pickups, but without something like this in your global active, while(true) loop, the counter will not reset to zero.

This is just out of my head, bu it is likely to be a complete script set for this:
 
//////////////////////////////
/// MAGIC CONTAINER PIECES ///
//////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// D0: Item number of Real Magic Container Piece No. 1                      //
// D1: Item number of Real Magic Container Piece No. 2                      //
// D2: Item number of Real Magic Container Piece No. 3                      //
// D3: Item number of Real Magic Container Piece No. 4                      //
// Place this on a dummy (generic) Magic Container Item as a Pickup Script. //
//////////////////////////////////////////////////////////////////////////////

item script MCPieces{
void run (int MC_1, int MC_2, Int MC_3, int MC_4){

if	  ( (Link->Item[MC_1] == false) &&
		(Link->Item[MC_2] == false) &&
		(Link->Item[MC_3] == false) &&
		(Link->Item[MC_4] == false) )
		{
                (Link->Item[MC_1] == true)
        }

else if	  ( (Link->Item[MC_1] == true) &&
		(Link->Item[MC_2] == false) &&
		(Link->Item[MC_3] == false) &&
		(Link->Item[MC_4] == false) )
		{
                (Link->Item[MC_2] == true)
        }
		
else if 	  ( (Link->Item[MC_1] == true) &&
		(Link->Item[MC_2] == true) &&
		(Link->Item[MC_3] == false) &&
		(Link->Item[MC_4] == false) )
		{
                (Link->Item[MC_3] == true)
        }
		
else if 	  ( (Link->Item[MC_1] == true) &&
		(Link->Item[MC_2] == true) &&
		(Link->Item[MC_3] == true) &&
		(Link->Item[MC_4] == false) )
		{
                (Link->Item[MC_4] == true)
        }
		
		}
	}
	
global script active{
    void run(){
        int fastWalkTimer;
        int lastScreen = Game->GetCurDMapScreen();
        int lastDMap = Game->GetCurDMap();
        while(true){
			if	  ( (Link->Item[MC_1] == true) &&  //Manually enter item number for MC_1.
					(Link->Item[MC_2] == true) && //Manually enter item number for MC_2.
					(Link->Item[MC_3] == true) && //Manually enter item number for MC_3.
					(Link->Item[MC_4] == true) ) //Manually enter item number for MC_4.

					) //If Link has four Magic Containers
					{
						Link->Item[MC_1] = false; //Removes MPC1; Manually enter item number for MC_1.
						Link->Item[MC_2] = false; //Removes MCP2; Manually enter item number for MC_2.
						Link->Item[MC_3] = false; //Removes MCP3; Manually enter item number for MC_3.
						Link->Item[MC_4] = false; //Removes MCP4; Manually enter item number for MC_4.
						item MCWhole = Screen->CreateItem(58); //Gives link a whole MC.
						MCWhole->X = Link->X;
						MCWhole->Y = Link->Y;
						MCWhole->Z = Link->Z;
					}
				}
			}

Edited by ZoriaRPG, 08 August 2013 - 09:15 AM.


#51 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 09 August 2013 - 04:30 PM

So, I plugged that code in (Had to do a little cleanup in order to get it to compile, there were a few places where you placed "{" and "}" where you should have had a semicolon, although that was all in the item script I couldn't get working, anyways), and ran into a problem: I can set the MC piece dummy item in the shop, but when I pick it up, it doesn't give me the first level MC piece, and then I can't buy it again. So, I got rid of the pickup script and just used my upgrade script, instead (in conjunction with your global) and now, when I pick up the container, I get the first MC piece, but I (again) can't buy the MC piece from the shop (I'm using the shop to test, because the game treats the shops exactly like other drops, but I can go in over and over) Anyways, here's the (altered) script (just the section that goes inside the while(true) loop, since there are no longer any other scripts affecting the MC pieces)

const int I_MCPDUMMY = 143;
const int I_MCPIECE1 = 208;
const int I_MCPIECE2 = 209;
const int I_MCPIECE3 = 210;
const int I_MCPIECE4 = 211;


for ( int i = 1; i <= Screen->NumItems(); i++){
                item drop = Screen->LoadItem(i);
                    //Magic Container checks
                if ( (drop->ID == I_MCPDUMMY))
                drop->ID = I_MCPIECE1; // If the item placed on the overworld is the MCP dummy, link will pick up piece 1
                if ( (drop->ID == I_MCPIECE1 && Link->Item[I_MCPIECE1]))
                drop->ID = I_MCPIECE2; //Checks to see if Link has MCP 1, if so, replaces drop with MCP 2
                if ( (drop->ID == I_MCPIECE2 && Link->Item[I_MCPIECE2]))
                drop->ID = I_MCPIECE3; //Checks to see if Link has MCP 2, if so, replaces drop with MCP 3 
                if ( (drop->ID == I_MCPIECE3 && Link->Item[I_MCPIECE3]))
                drop->ID = I_MCPIECE4; //Checks to see if Link has MCP 2, if so, replaces drop with MCP 3

            }
            
            if      ( (Link->Item[I_MCPIECE1] == true) && 
                    (Link->Item[I_MCPIECE2] == true) && 
                    (Link->Item[I_MCPIECE3] == true) && 
                    (Link->Item[I_MCPIECE4] == true) ) 

                      //If Link has four Magic Containers
                    {
                        Link->Item[I_MCPIECE1] = false; //Removes MCP1
                        Link->Item[I_MCPIECE2] = false; //Removes MCP2
                        Link->Item[I_MCPIECE3] = false; //Removes MCP3
                        Link->Item[I_MCPIECE4] = false; //Removes MCP4
                        item MCWhole = Screen->CreateItem(I_MAGICCONTAINER); //Gives link a whole MC.
                        MCWhole->X = Link->X;
                        MCWhole->Y = Link->Y;
                        MCWhole->Z = Link->Z;
                    }

I'm wondering if I could alter the checks so that it only CHECKS for the fourth piece when removing the pieces, but I'm not sure if that would do anything.

 

EDIT: Yeah, that didn't do anything. I'm not sure what the issue is. I've never had the game just not let me pick something up.

 

EDIT: I don't think it's the script, actually. Well, maybe its the script, but I can't get get it to pick up the dummy item a second time, even when I took your script out completely and just used my own upgrade script, which has worked with every other item I've tried it with. and i've tried it on a lot. I have like 300+ lines of hardcoded item upgrades and drop alterations, so the script SHOULD work perfectly (and, in fact, I'm pretty sure it does, since it gives you the first MCP when you pick it up the first time). All of my MCPs are set properly (I think, they're equipment items, custom item class 5, and have "keep lower level items" checked, and they're all different levels, counter reference is set to none, and all numeric values other than level and pickup sound are set to 0) , and it definitely only allows you to buy the item once (I thought it might have something to do with the item levels, so I added my "Empty container" to the upgrade code, and I could get piece one when i had the empty container in my init data, but if I don't have it in the init data, and I use the shop to buy the empty container, I can't buy the MCP1 on return trip, so it's definitely not the upgrade script, otherwise It would have given me problems (and I was already having these problems, anyways, before), but it doesn't explain why the issue persists when I removed your script completely... Ugh, my head hurts...

 

 

EDIT: Y'know, random thought, but I've never used the upgrade codes on custom item classes before, all the items I've used them on have had a set item class (i.e. swords, shields, boomerangs, hookshots, hammers, arrows, and bows) is it maybe having a problem with multiple levels of a custom item class that has no scripts attached?

 

EDIT: OK, well, the global part for removing the items definitely doesn't work, at very least. When I placed the four items separately, I could pick them all up, but when I picked up the fourth piece, it did not reset me to 0...

 

FURTHER EDIT:Ok, following a hunch, I got it (partly) worked out, I had to move your part of the script to another section, I had combined them into the same spot, before, but that was causing it to only upgrade me if there was an item drop on screen, still. But when I moed it to the end, it dropped the Magic Container instantly and reset my counter. I can continue to pick them up on other screens and it will upgrade properly, but I still can't buy it from a shop more than once, which seems odd. But, I guess I won't ever need to... Unless... Nope! It works ok still with the "special item" room type. I guess it's just shops that don't like it for some reason. It should be workable in its current form, actually. Still, it's gonna bug the crap out of me if I can never figure out why shops give it trouble...


Edited by Lineas, 09 August 2013 - 06:30 PM.


#52 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 10 August 2013 - 08:27 AM

It might have something to do with the way shops give items: I don't think they act as an item pickup:

In other words, the item is added as (true), but the pickup script isn't activated when buying it. thus, you can't upgrade it...

 

You see, the option 'Upgrade when collected twice' breaks on L3 and L4 items. When you set this on a L1 item, and buy it twice, it upgrades to L2, but when you get it a third time, it does not upgrade to level 3. You need to buy another level 2 item of that type to upgrade from Level 2 to Level 3, and another Level 3 item of that kind to upgrade from Level 3 to Level 4.

 

I can share MM's shop code that should fix that, which will also allow for making shops with talkable NPCs,more (or fewer items), an examine function that tells the player what the item is and how much it costs, and more; however it requires a deal of setup and FFCs for each shop.


Edited by ZoriaRPG, 10 August 2013 - 08:30 AM.


#53 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 10 August 2013 - 01:44 PM

No need for the shop code, as I explained, the way my upgrading script works allows me to bypass the upgrade limitations normally set. It does this by actively replacing the drop you see on screen with a higher level item when you pick it up, so (if I were to add it to my code) I could set up the wooden sword in a shop, but then, I use the scripts so that if I already HAVE the wooden sword, the sword I pick up when i go over the icon is the white sword, then if I do it again, it becomes the magic sword, and if I do it again, it becomes the master sword. So far, I've set it up to work with swords (which i took out, because I am using a different system for my swords), shields, hammers (cuz I have upgradeable hammers), arrows , bows, and boomerangs, and this (the MC piece) is literally the ONLY item it doesn't work in shops with, and it's not the script, because it works on the OW. But again, I don't think I'll need to ever place an MC piece in a shop, it would kinda break the game, no? I mean, if I'm going to do something that ridiculous, I might as well just make it a heart container or full magic container.

 

 

EDIT: To be clear, I had already looked into the shop script before I wrote the upgrade script, Well, "wrote" is a big word, I just combined elements from the ammo drop fix that MM helped me make, (I say helped me make, but he basically wrote the script, I just kinda filled in the blanks, and just had to adjust a couple small things, cuz he wasn't really trying) a while back, and the dummy item script I was using and tweaked a couple things... So it's not really my creation, it's a frankenstein of other people's creations. Still, it's functional.


Edited by Lineas, 10 August 2013 - 01:54 PM.


#54 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 10 August 2013 - 03:21 PM

Frankenscript: I like that.

 

At least, it seems that some of what I thew at you was helpful. I went for MC halves, rather than quarters for my game, and the pick-uo was thus easier to accomplish. Gain one, it shows in the display; gain another, the display clears, and the player gains +mp. (When I did this, it was before I started to get used to ZScript, and I was being lazy.)

 

What sections of the code that I posted did you need to rearrange?

 

I'm also curious how you managed to gain multiple levels of upgrades in shops, as that would be useful for potions for most questmakers, if not for other items.

 

One thing you may consider doing, which is amazingly evil, is to flag a sword that you can upgrade in a shop with the can be eaten option. I did that for the steel sword in TGC, as it;s not horribly expensive, and it makes it possible to lose it. Most players will be taken aback in shock, when a LikeLike takes not only their shield, but also their 'better sword'.



#55 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 10 August 2013 - 03:54 PM

The {} around the returns for the "if statements" for the item script, it wouldn't compile until I changed them to ; Of course, I wasn't able to get the pickup script to work after I did that, either, so I may have done nothing useful. Anyways, I posted the one I made specifically for swords, here, somewhere.... Ah, here it is, in my thread about needing an upgrade shop:

for ( int i = 1; i <= Screen->NumItems(); i++) 
			{ 

				item drop = Screen->LoadItem(i);
				
                if ( (drop->ID == I_SWORD1 && !Link->Item[I_SWORD1])) 
                    Remove (drop); //This checks if you have the wooden sword, if not, it removes the drop
                if ( (drop->ID == I_SWORD1 && Link->Item[I_SWORD1]))
                    drop->ID = I_SWORD2; //This checks if you have the wooden sword, if you do, it changes the picked up item to the white sword
                if ( (drop->ID == I_SWORD2 && Link->Item[I_SWORD2]))
                    drop->ID = I_SWORD3; //THis checks if you have the white sword, if you do, it replaces it with the magic sword
                if ( (drop->ID == I_SWORD3 && Link->Item[I_SWORD3]))
                    drop->ID = I_SWORD4;  //This checks if you have the magic sword, if you do, it replaces it with the master sword 
 
			}

The drawback to using this method is that you HAVE to use dummy items if you want them to be able to pick up the wooden sword outside of a shop, because it will remove ALL wooden sword drops, if you don't already have it. Or you can just remove the line of code that removes the drop and set it to sell the white sword instead, but I think using the L1 weapon is better, because the tile you see never changes (i.e. when you see the item in the shop, it's wooden and the sprite doesn't change until you touch it, when Link will hold up the white sword, instead), so it can be treated like an "item class" icon

 

 

 

 I haven't tried it on potions, but I don't see why it WOULDN'T work.



#56 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 10 August 2013 - 03:55 PM

Keep in mind, this (the code in my last post) is all usually a part of my global drop script, so it's POSSIBLE (although, unlikely) that I may have neglected to copy over a piece of the code (if I did, it would be in the first part of the dropfix). The actual script I use in game looks more like

 

 

I removed the sword script because I have 9 interchangeable swords that all use the same class, and since I got that attack ring script, there's very little reason to do damage upgrades on weapons, most of the upgrades are elemental based, instead, so there's a lot of removing drops in this one instead of straight upgrades. The shield one is almost identical to the version I used for swords, though, and it works quite well. ALL of these (except the MCPiece one, for some reason) work in shops.


Edited by Lineas, 10 August 2013 - 03:56 PM.


#57 Binx

Binx

    Formerly Lineas

  • Members
  • Real Name:Brian
  • Location:Lancaster, CA

Posted 11 August 2013 - 09:55 PM

Oh, random note, I worked this little tidbit out for the Triforce thing:

//Triforce Pieces
const int I_TFP = 144; //Insert item number for "triforce of power"
const int I_TFW = 145; //Insert item number for "triforce of wisdom"
const int I_TFC = 146; //Insert item number for "triforce of courage"
const int I_TFPW = 147; //Insert item number for "Triforce (power/wisdom"), this is when link has both the power and wisdom pieces
const int I_TFCP = 148; //Insert item number for "Triforce (courage/power"), this is when link has both the power and courage pieces
const int I_TFWC = 149; //Insert item number for "Triforce (wisdom/courage"), this is when link has both the courage and wisdom pieces
const int I_TFWHOLE = 141; //Insert item number for "Full Triforce" (not the big piece that Ganon drops, it's a dummy item)

//Insert into the while(true) loop
            for ( int i = 1; i <= Screen->NumItems(); i++){
                item drop = Screen->LoadItem(i);    
                if ( (drop->ID == I_TFP && Link->Item[I_TFW]))
                drop->ID = I_TFPW;
                if ( (drop->ID == I_TFC && Link->Item[I_TFP]))
                drop->ID = I_TFCP;
                if ( (drop->ID == I_TFW && Link->Item[I_TFP]))
                drop->ID = I_TFPW;
                if ( (drop->ID == I_TFP && Link->Item[I_TFC]))
                drop->ID = I_TFCP;
                if ( (drop->ID == I_TFC && Link->Item[I_TFW]))
                drop->ID = I_TFWC;
                if ( (drop->ID == I_TFW && Link->Item[I_TFC]))
                drop->ID = I_TFWC;
                if ( (drop->ID == I_TFP && Link->Item[I_TFWC]))
                drop->ID = I_TFWHOLE;
                if ( (drop->ID == I_TFC && Link->Item[I_TFPW]))
                drop->ID = I_TFWHOLE;
                if ( (drop->ID == I_TFW && Link->Item[I_TFCP]))
                drop->ID = I_TFWHOLE;

Attach an item bundle script (or really, whatever script you want to, I use the item bundle, but if you can find a better use, more power to you)to the "full triforce" item, set it to level 3, set the first three "pieces" to level one, the three sets of 2 pieces to level 2, and then, no matter what order you get the triforce pieces in, you'll gain the appropriate piece (so, if you pick up power, you'll get the top piece, wisdom will get you the left and courage will get you the right, this is why there's seven items, so the pieces will appear where they're supposed to), so if you have power (the top piece) and you get wisdom, it'll appear that you have the top and left, but if you pick up courage, instead, it'll appear that you have the top and right and so on.

 

And yes, it's the same script as the last 3. Of course it is, it's a damned useful and versatile script if you don't mind having to hard-code the hell out of your game.


Edited by Lineas, 11 August 2013 - 09:57 PM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users