HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Powerups in item recipe system

01-27-2007, 02:23 AM#1
Oblivion9
This might have been addressed by someone, I am not sure, but I did scour jassvault, other sites, here (thanks for the reply Antiarf to one of your systems) and what I am try to do is have 2 different triggers that track the events Sold Item from Shop and Unit Acquires Item (not sold item). I apologize ahead of time for using GUI tags to represent what I'm saying... I'm attempting to learn jass so it's easier for me to explain things that way.

Before I start rambling, let me explain what I want to do:
Code:
Unit buys an item
     allied shop?  
          Yes, Give item
          No, destroy item, give refund
     Only 1 sail/hull/wood/crew check
          Yes, give item
          No destroy item, give refund
     Powerup?
          Yes,
               Has required items for combo?
                    Yes, remove 1 or 2 items & create item and give
                    No, refund money, msg to player missing required item names
          No, do nothing

Unit acquires an item
     Unit in enemy harbor?
          Yes, move item to position of unit
          No:
               Only 1 sail/hull/wood/crew check
                    Yes, give item
                    No, instantly move item to position of unit
For the Sold Item I want to first check the shop which it was purchased (since there are 2 teams and I don't want one team buying from the other team's shop)... if it's an 'allied shop' then there are more checks to be run, if not I want to remove the item and refund the money. Assuming it's an allied shop, then I want to check if it's a powerup (since i'm trying to use powerups as recipe items. Ex: 1 Long Arrow + 1 Spear + 1 Recipe: Harpoon Powerup = remove Long Arrow & Spear + Give Harpoon) Would I create a function almost like a database sorta like:
Code:
function passing 3 items returns nothing 
     if-then loop 
          unit has item-typeI[loop]
          unit has item-typeII[loop]
          unit has Powerup[loop]
     then do stuff (remove items, create new one, fix leaks, skip remaining actions, etc)
There are a couple of other checks that would need to be run as well (only one sail, only one hull, etc etc)

I was also thinking that maybe you can track picking up an item outside of purchase by doing an item boolean check
Code:
if last created item <> item being manipulated then blah blah
Which I hope checks to see if that is the exact same item, not an item-type check...

The reason why this is so tricky (at least for me) is that there's so many combos of checks to be performed (only 1 of similar item type, powerup + items = combo, can't pick up items in enemy territory, etc) that I'm finding that may glitches have occured because of GUI triggers (or at least the way I have them set up now). What I've come to understand is that local variables (which I understand are necessary for MUI) can not be used in IF-THENs, amongst other functions.

If it would be helpful, I could post the triggers that I am already using to assist in fixing this crazy mess...