HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Detecting whether or not an upgrade has been researched.

10-16-2003, 04:55 AM#1
ZealousDemon
I'm creating a spell called "Hydra Revenge", in which a 2 hydras are born after the first one dies, with the addition of the countdown timer. The spelt is learnt through a custom upgrade. I normally would have based it off the spell already implemented into the regular hydras, but due to hardcoding I'm assuming, it won't give the spell a picture within the unit, no matter what fields I change. So, I figure I could work around this bug by using triggers. So, I believe I needed to go down the path of making a dummy spell, and then having the spell work through triggers. Here's what I got so far.

Code:
Hydra Revenge1
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Hydra Castigator
    Actions
        Unit - Create 2 Hydra Neophyte for (Triggering player) at (Position of (Triggering unit)) facing Default building facing degrees

However, I need a condition to determine either...

A.) The triggering Castigator had the spell.
OR
B.) The player owning the Castigator had researched the upgrade associated with the dummy ability.

... and I cannot seem to find any condition that would give me what I'm looking for.

Any help is appreciated.
10-16-2003, 05:03 AM#2
Zachary_Shadow
Events
Unit - A unit Finishes an upgrade
Conditions
(Unit-type of (Triggering unit)) Equal to Hydra Revenge
Actions
Set HydraRevenge = 1

Hydra Revenge1
Events
Unit - A unit Dies
Conditions
HydraRevenge = 1
(Unit-type of (Triggering unit)) Equal to Hydra Castigator
Actions
Unit - Create 2 Hydra Neophyte for (Triggering player) at (Position of (Triggering unit)) facing Default building facing degrees

Badaboom :) There u have it ( Not sure about the way to check if the unit has the spell...)
10-16-2003, 03:03 PM#3
ZealousDemon
Hmmm... a variable is needed eh? I need to get use to using those.

2 Questions:

1.) Wouldn't the trigger you have for detection check to see if the Castigator has been upgraded check to see if I actually upgraded within the Castigator? Wouldn't I need it to check the barracks it comes from?

2.) I'm assuming I'll need multiple variables for multiple players?
10-16-2003, 07:46 PM#4
Zachary_Shadow
Actually no, just make the variable an array of (number of players) and set the array index of the variable to get the number of the player....wait..think I'm confusing this :P

Gimme some time, just got back from work. I'll post a little later on with the exact trigger for you :)

This is something I have in my map also, something like it at least :)

I'll reply in an hour or less :)
10-16-2003, 09:00 PM#5
Zachary_Shadow
Ok, here is the way you need to set your trigger, to make it respond to the specific player:

Upgrade[(Player number of (Owner of (Unit upgrading)))] Equal to 1

The:
Upgrade[(Player number of (Owner of (Unit upgrading)))] Equal to 1

Is where it gets the array number, from the player number. The array of Upgrade needs to be as high as there are players/computers (so if u have 2 sides 1 computer on each and 4 players on each = 10)

If say red was doing the upgrade, the trigger would set itself to this:

Upgrade[1] Equal to 1

Try it out, if it doesn't work, make a demo map with what you got, and let me take a look :)
10-16-2003, 10:45 PM#6
ZealousDemon
Ah, got it working. I found out you told me wrong before though. :////
Here's what I ended up doing:

Code:
HRDetect
    Events
        Unit - A unit Finishes research
    Conditions
        And - All (Conditions) are true
            Conditions
                (Unit-type of (Triggering unit)) Equal to Serpent's Den
                (Researched tech-type) Equal to Hydra Revenge 
    Actions
        Set HR[(Player number of (Triggering player))] = 1.00
Code:
HRExe
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Hydra Castigator
        HR[(Player number of (Owner of (Triggering unit)))] Equal to 1.00
    Actions
        Unit - Create 2 Hydra Neophyte for (Triggering player) at (Position of (Triggering unit)) facing Default building facing degrees
Code:
HRNeophyte
    Events
        Unit - A unit enters (Playable map area)
    Conditions
        (Unit-type of (Triggering unit)) Equal to Hydra Neophyte
    Actions
        Unit - Add a 60.00 second Generic expiration timer to (Triggering unit)