HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Shops that sell items only during certain events...

07-30-2003, 10:51 PM#1
Katarina
Ok, I want certain buildings to sell items or units only when an event happens... so I've been using triggers. I've tried two things:

Ive tried using pause/unpause in various ways. Sure, it pauses the building just fine, but no matter what it won't unpause it!

I also tried using the remove/add sell unit ability, but this seems to clear the shops item list, (and I hhave my reasons why I can't just tell it to replace all the items.)

What else could I try?
07-31-2003, 12:21 AM#2
Thewanderer
You could try making two shops then deleting the shop that's newest, that should be on top, after buying the item? I have no idea how you can do that, but I'm sure there's a way...
07-31-2003, 12:26 AM#3
|)@rk-Revenant
use all the market place's abilities in your shops, and when you want items to be added/deleted from the shop, simply use the action nueteral building - add/remove item.
07-31-2003, 12:29 AM#4
Katarina
I can't use add/delete item because the shop's inventories changes according to each player's actions :(
07-31-2003, 01:51 AM#5
Katarina
Is there something special I have to do for a unit to fully unpause? It doesn't make sense...

I can pause the unit and it no longer does anything, but I can't unpause it, hrm.
07-31-2003, 03:02 AM#6
Taion
The pause/unpause actions work fine for me with shops.

Make sure your unpause trigger is working.
07-31-2003, 03:11 AM#7
Katarina
Okay, here is the trigger I have for an event - a unit sells a unit

Code:
Unit Group - Pick every unit in (Units owned by (Owner of (Selling unit)) of type Barracks) and do (Actions)
            Loop - Actions
                Set Bots[(Player number of (Owner of (Selling unit)))] = (Bots[(Player number of (Owner of (Selling unit)))] - 1)
                Neutral Building - Remove Mercenary from (Picked unit)
                If (Bots[(Player number of (Owner of (Selling unit)))] Equal to 0) then do (Unit - Pause to (Picked unit)) else do (Do nothing)

This does in fact pause the building from letting the player buy any more units.


Code:
Set Bots[(Player number of (Owner of (Selling unit)))] = (Bots[(Player number of (Owner of (Selling unit)))] + 1)
Unit Group - Pick every unit in (Units owned by (Owner of (entering unit)) of type Barracks) and do (Unit - Unpause to (Picked unit))

This SHOULD be unpausing.... no?

The event is when a unit enters a particular region.
07-31-2003, 03:51 AM#8
Taion
Hmm...

Well, the first trigger is removing the merc unit type. If thats the only thing it can sell, it would seem like its paused. I assume the mercenary is added back in some other trigger?

If its not that, then I'm not sure what it is. Nothing seems wrong with the actual pausing.

Also, I'm not sure if this is intended or not, but the loop will subtract 1 from Bots[n] for each barracks that the player owns. So, if you have 3, and buy one unit, you lose 3 from Bots[n].
07-31-2003, 04:07 AM#9
Katarina
They only have one Barracks, so that's not the problem... The rest of the unpause trigger adds units depending on what region they enter or what units they have using an if/then/else...

BUT!!! It just doesn't want to unpause!

If I disable the pause-action from the first trigger then the shops behave like theyre supposed to... with the exception that they can keep buying as many units as they want instead of the limit Im trying to impose. :(
07-31-2003, 04:15 AM#10
Taion
Jeez. The graphics on the buttons here just changed.

Well, lets try some text commands.

Pause
Events
Player - Player 1 (Red) types a chat message containing -pause as An exact match
Conditions
Actions
Unit - Pause <Barracks>

Unpause
Events
Player - Player 1 (Red) types a chat message containing -unpause as An exact match
Conditions
Actions
Unit - Unpause <Barracks>

See if those work like you would expect. If they don't, I have no idea what to do.

If they do, then something else is wrong.
07-31-2003, 04:44 AM#11
Katarina
Hmmm, that worked like it should have, I tried something like that earlier.. but I cant for the life of me figure out what else might be throwing unpause out of whack :(
07-31-2003, 05:02 AM#12
Katarina
Is there another way to "turn off" a shop besides pause? I think I give up with pause....
07-31-2003, 05:12 AM#13
Taion
Ah. In the second trigger, you are using (Owner of Selling Unit) in the first action instead of (Owner of Entering Unit.)

It is never adding anything back to Bots[n], since there is no sold unit in that trigger.

Edit:... Hmm. Wonder if that actually helps with the pausing/unpausing at all.
07-31-2003, 06:13 AM#14
Katarina
oh, Ive tried it a ton of different ways... I don't think unpausing works.

I even tried it "unpause every unit in the game" and it still wasnt working right...

So is there some other way? I can't change control of the barracks, how will it know which barracks belonged to which player?
07-31-2003, 05:49 PM#15
Taion
Well, you could use a unit array to do that.

Code:
Startup
    Events
        Map initialization
    Conditions
    Actions
        Set Barracks[1] = Barracks 0189 <gen>
        Set Barracks[2] = Barracks 0190 <gen>

Disable Barracks
    Events
        Unit - A unit Sells a unit
    Conditions
    Actions
        Set Loopy = (Loopy - 1)
        Neutral Building - Remove Footman from (Selling unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Loopy Equal to 0
            Then - Actions
                Unit - Change ownership of (Selling unit) to <Not Sure. Neutral?> and Retain color
            Else - Actions

Enable Barracks
    Events
        Unit - A unit enters Wherever <gen>
    Conditions
    Actions
        Set Loopy = (Loopy + 1)
        Unit - Change ownership of Barracks[(Player number of (Owner of (Entering unit)))] to (Owner of (Entering unit)) and Change color

You would pick each players barracks in the startup trigger. So for Barracks[1] you select player 1's barracks.

You'd have to use the 'shop sharing' ability so you couldn't buy from it while it is 'disabled.' I'm not entirely sure how that ability works with neutrals.

Might have to have a computer player that is enemy to all players, but the players are allied to it. You could also use neutral hostile if the barracks are invulnerable.