• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Make unit's upgrade like a building?

Status
Not open for further replies.
Level 5
Joined
May 31, 2010
Messages
96
Hello I was wondering how can you make a ability that costs money and turns the unit into different one, and it's not a building. I can't really explain it right. So it's pretty much a ability that costs gold and ONLY transforms the casting unit.

:ogre_hurrhurr:
 
Level 12
Joined
Jan 30, 2009
Messages
1,067
I would assume you would have to trigger it.

Use If/Then/Else to determine if the player has enough gold. If he does, subtract the gold and allow the usage of the ability.

If he doesn't, don't allow it to do anything except maybe give an error message "You don't have enough gold!"

And don't forget to make it visible somewhere how much the cost is, ;)
 
Level 12
Joined
Jan 30, 2009
Messages
1,067
Something along these lines:
  • YourAbilityName
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) (Your Ability)
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 1 (Red) Current gold) Greater than or equal to (>=) 100
        • Then - Actions
          • Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) - 100)
          • -------- Then use the ability --------
        • Else - Actions
          • -------- You can leave this blank which is the same as "Do Nothing" but more efficient. Or do the following if you wish. --------
          • -------- I'm not sure the following will actually work correctly. I have not tested this. --------
          • Game - Display to (Owner of (Triggering unit)), at offset (0.00, 0.00) the text: Not enough gold!
Remember to replace "Your Ability" with the name of the ability.
Change the gold cost as you see fit, and don't forget to balance it!

The action for the text is "Text Message to Player (Auto-timed)". Not regular "Text Message"
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Temporarily turn the unit into a building in object editor. Change the upgrade entry to your desired unit, then reset the building-state. Your unit will be able to upgrade to the other one despite being no structure, though, won't show a progress bar.

Progress bar can be done by using Upgrade/Research
Use this:
  • Triggered Upgrade
    • Events
      • Unit - A unit Finishes an upgrade/research
    • Conditions
    • Actions
      • Unit - Replace (Triggering unit) with a Unit B using The new unit's max life and mana
You can either use Upgrade event or Research event
This will show the progress bar
 
Progress bar can be done by using Upgrade/Research
Use this:
  • Triggered Upgrade
    • Events
      • Unit - A unit Finishes an upgrade/research
    • Conditions
    • Actions
      • Unit - Replace (Triggering unit) with a Unit B using The new unit's max life and mana
You can either use Upgrade event or Research event
This will show the progress bar

Thats a problem if he wan'ts multiple units of the same type owned by the same player to be able to upgrade.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
This has nothing to do with indexing, just that researches can only be done once per player and that they cannot be unlearnt. To show a loading bar, you could also use training a unit, but either have differences to normal upgrading. Researching and training have other captions above the bar and are queued, upgrading blackens out the command card (only cancel icon), already takes the new type's model and icon. Replacing the unit via trigger as shown might change the unit's handle id and can erase other things as well.
 
Level 5
Joined
May 31, 2010
Messages
96
A test map worths thousand.
Any question, feel free to ask =D

Theres a bug with that through. When I have 2 of those types of abilities for the same unit.. it only spawns one type of unit. Okay like if I wanted to upgrade the unit into a footmen, but there was also a upgrade ability for the knight on the same unit. It would only spawn the knight no matter which ability I picked.

:ogre_frown:
 
Status
Not open for further replies.
Top