[Solved] Individual True Sight Upgrade

Level 15
Joined
Sep 11, 2013
Messages
557
Greetings!:peasant-waving:

I want to create an individual True Sight upgrade for each tower, but I don’t know how to make the upgrade stay enabled when a tower is upgraded to another tower—if the base building had already purchased it.

This spell "BUY TRUE SIGHT" is "Charge Gold and Lumber" because must cost a price when I click on it.
  • Buy True SIGHT
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to BUY TRUE SIGHT
    • Actions
      • Unit - Remove BUY TRUE SIGHT from (Triggering unit)
      • Unit - Add Real Magic Sentry (Human Towers)x to (Triggering unit)
So I have a base tower with this spell on it and that base tower can upgrade in 3 possible other towers.

The other 3 towers has also the same spell "BUY TRUE SIGHT" in order to buy True Sight upgrade.
The problem is.. I don't know how to make the true sight to remain enabled on whatever upgraded tower if I buy the true sight upgrade on the base tower.

I tried this, but never worked. :peasant-sad:
  • Finish an Upgrade with True Sight On
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • (Level of Real Magic Sentry (Human Towers)x for (Triggering unit)) Equal to 1
    • Actions
      • Unit - Remove BUY TRUE SIGHT from (Triggering unit)
      • Unit - Add Real Magic Sentry (Human Towers)x to (Triggering unit)
      • Game - Display to (All players) the text: finish upgrade
The help will be appreciated! :peasant-bowing:
 

Attachments

You can make the ability permanent, then it should remain on the unit even after it was upgraded. There's no gui action for this, it can only be called via custom script:
  • Custom script: call UnitMakeAbilityPermanent(whichUnit, true, abilityCode)
For simplicity, you could create two variables:
  • "unit" variable, let's name it "tower"
  • "abilityCode" variable, let's name it "abilCode"
Then your trigger could look like this:
  • Buy True SIGHT
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to BUY TRUE SIGHT
    • Actions
      • Set VariableSet tower = (Triggering unit)
      • Set VariableSet abilCode = Real Magic Sentry (Human Towers)x
      • Unit - Remove BUY TRUE SIGHT from tower
      • Unit - Add abilCode to tower
      • Custom script: call UnitMakeAbilityPermanent(udg_tower, true, udg_abilCode)
 
You can make the ability permanent, then it should remain on the unit even after it was upgraded. There's no gui action for this, it can only be called via custom script:
  • Custom script: call UnitMakeAbilityPermanent(whichUnit, true, abilityCode)
For simplicity, you could create two variables:
  • "unit" variable, let's name it "tower"
  • "abilityCode" variable, let's name it "abilCode"
Then your trigger could look like this:
  • Buy True SIGHT
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to BUY TRUE SIGHT
    • Actions
      • Set VariableSet tower = (Triggering unit)
      • Set VariableSet abilCode = Real Magic Sentry (Human Towers)x
      • Unit - Remove BUY TRUE SIGHT from tower
      • Unit - Add abilCode to tower
      • Custom script: call UnitMakeAbilityPermanent(udg_tower, true, udg_abilCode)
Thank you so much!

Seems to work perfect! :peasant-ok-hand:

I have a question.

If I want to create a second "BUY TRUE SIGHT - 2" and a second "Real Magic Sentry (Human Towers)x - 2" just for team 2, can I use the same variables like this or I should make new ones?

  • Buy True SIGHT
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to BUY TRUE SIGHT
    • Actions
      • Set VariableSet UnitTower = (Triggering unit)
      • Set VariableSet AbilCode = Real Magic Sentry (Human Towers)x
      • Unit - Remove BUY TRUE SIGHT from (Triggering unit)
      • Unit - Add AbilCode to UnitTower
      • Custom script: call UnitMakeAbilityPermanent(udg_UnitTower, true, udg_AbilCode)
  • Buy True SIGHT 2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to BUY TRUE SIGHT - 2
    • Actions
      • Set VariableSet UnitTower = (Triggering unit)
      • Set VariableSet AbilCode = Real Magic Sentry (Human Towers)x - 2
      • Unit - Remove BUY TRUE SIGHT - 2 from (Triggering unit)
      • Unit - Add AbilCode to UnitTower
      • Custom script: call UnitMakeAbilityPermanent(udg_UnitTower, true, udg_AbilCode)
- - - - - - - - - - - -
  • Finish an Upgrade with True Sight On
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • (Level of Real Magic Sentry (Human Towers)x for (Triggering unit)) Equal to 1
    • Actions
      • Unit - Remove BUY TRUE SIGHT from (Triggering unit)
  • Finish an Upgrade with True Sight On 2
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • (Level of Real Magic Sentry (Human Towers)x - 2 for (Triggering unit)) Equal to 1
    • Actions
      • Unit - Remove BUY TRUE SIGHT - 2 from (Triggering unit)
Edit1: In my map I can build hundreds of towers with true sight on both teams. I hope this trigger will work fine. :peasant-smile:
 
Last edited:
If I understood correct, you dont need triggers for this. Just a second "upgraded" version of the tower as unit-type that has true sight. In the unit properties of the un-upgraded, put the secodn tower as upgrade. And for the cost - there is cost in the unit properties.
This is an upgraded version of the tower for each tower-type.
 
If I understood correct, you dont need triggers for this. Just a second "upgraded" version of the tower as unit-type that has true sight. In the unit properties of the un-upgraded, put the secodn tower as upgrade. And for the cost - there is cost in the unit properties.
This is an upgraded version of the tower for each tower-type.
If the player decide to upgrade the un-upgraded tower, but without making the true sight upgrade, the second tower will have the true sight with your solution, and I don't want that..

Nichilus solution work very good.

Thanks for your help anyway!
:peasant-smile:
 
Back
Top