• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Selling structures

Status
Not open for further replies.
Level 11
Joined
Jan 23, 2015
Messages
788
  • sell
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Sell
    • Actions
      • Unit - Remove (Trained unit) from the game
      • Unit - Remove (Triggering unit) from the game
      • Player - Add (Point-value of (Triggering unit)) to (Owner of (Triggering unit)) Current gold
I made this trigger for selling structures, but it doesn't works, do you know why?
 
Level 12
Joined
Dec 11, 2014
Messages
662
  • sell
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Sell
    • Actions
      • Unit - Remove (Trained unit) from the game
      • Unit - Remove (Triggering unit) from the game
      • Player - Add (Point-value of (Triggering unit)) to (Owner of (Triggering unit)) Current gold
I made this trigger for selling structures, but it doesn't works, do you know why?

Idk, it should work I have the same one and it works
Sell
Events
Unit - A unit Finishes training a unit
Conditions
(Unit-type of (Trained unit)) Equal to Sell
Actions
Unit - Remove (Trained unit) from the game
Unit - Remove (Triggering unit) from the game
Player - Add (Point-value of (Triggering unit)) to (Owner of (Trained unit)) Current gold
 
Level 11
Joined
Jan 23, 2015
Messages
788
Yes, actually I made it similar with another map's trigger, and at the end I copied it, cause I was frustrated of my own which wasn't working.. now I see that this one's not working neither.. Might the problem be in the object editor?
 
Level 12
Joined
Dec 11, 2014
Messages
662
Yes, actually I made it similar with another map's trigger, and at the end I copied it, cause I was frustrated of my own which wasn't working.. now I see that this one's not working neither.. Might the problem be in the object editor?

What exactly doesnt work? You need to add the "Sell" on the list of trainable units for that building. Not sure what exactly isn't working for you.
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,894
  • sell
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Sell
    • Actions
      • Unit - Remove (Trained unit) from the game
      • Unit - Remove (Triggering unit) from the game
      • Player - Add (Point-value of (Triggering unit)) to (Owner of (Triggering unit)) Current gold
I made this trigger for selling structures, but it doesn't works, do you know why?
Genius, it must be like this:
  • Events
    • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Sell
    • Actions
      • Player - Add (Point-value of (Triggering unit)) to (Owner of (Triggering unit)) Current gold
      • Unit - Remove (Trained unit) from the game
      • Unit - Remove (Triggering unit) from the game
If you remove the trained unit and triggering unit first from the game, (Point-value of (Triggering unit)) and (Owner of (Triggering unit)) will return null xD
Also, note that point-value must be greater than 0 if you want it to give you gold.
 
Level 12
Joined
Dec 11, 2014
Messages
662
I am not 100% sure what you mean.
Here is the sell system that I use:

  • Sell
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Sell
    • Actions
      • Unit - Remove (Trained unit) from the game
      • Unit - Remove (Triggering unit) from the game
      • Player - Add (Point-value of (Triggering unit)) to (Owner of (Trained unit)) Current gold
      • Game - Display to (Player group((Owner of (Trained unit)))) the text: (You received + ((String((Point-value of (Triggering unit)))) + Gold for selling a Tower))
This pretty much adds the "Point-Value" of that building to the player and tells them they got that much gold.
Then just add to the building this:
242398-albums7980-picture94966.png

And to set how much the player gets just change this:
242398-albums7980-picture94967.png

Ofcouse first you must make a custom unit which will be named "sell"
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
Better exlain HOW exactly it is not working. At what state does it fail ?
First looks is telling me that you are either receiving no gold or it fails totaly.

-does it fail totaly, does absolutely nothing ?
-the dummy is not removed ?
-the building is not removed ?
-does not give gold ?

1st if you have just copied teh trigger over without changing the unit in teh conditions it may be passing garbage data.

4th It is passing some garbage data so you should not get gold, try rearanging the gold before you destroy units

===================
About you other question:
===================

Use "convert integer to sting" or "convert real to string", the gold is integer (I think) so it needs to be converted to string to be displayed.

To combine multiple things use concatenate string, this will allow you to output 2 different things, like PlayerName + SomeNumber.

Here it may become a bit confusing. If you want to do it for more than 2 values use nested concatenate strings, meaning set one of teh values of the concatenate string to concatenate string.


Edit// @Wrda "Triggering unit" is a special case. It can survive waits and I believe it should survive removing teh unit from the game... maybe... probably... although is very counter logical to do so, if you do some weird stuff like this you may get a very nasty bugs, like trying to retrive data from it like its possition and doing something with it...
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,894
Edit// @Wrda "Triggering unit" is a special case. It can survive waits and I believe it should survive removing teh unit from the game... maybe... probably... although is very counter logical to do so, if you do some weird stuff like this you may get a very nasty bugs, like trying to retrive data from it like its possition and doing something with it...
Please, don't believe in things, test them first, if you try to remove unit and then give gold, the giving gold part doesn't work because you removed the unit and it returns null.

You're not getting it, first you need to give gold to the player, and THEN remove the triggering unit and trained unit or ofc you won't receive gold.
 
Last edited:
Level 25
Joined
May 11, 2007
Messages
4,651
Please use abilites instead of a unit that you train, I always hated the rally points on towers that only exists beccause there is a sell unit type on it.

Change it to a spell, check which unit-type it is and then give a value of gold to the owner of the unit instead.
 
Level 11
Joined
Jan 23, 2015
Messages
788
Please use abilites instead of a unit that you train, I always hated the rally points on towers that only exists beccause there is a sell unit type on it.

Change it to a spell, check which unit-type it is and then give a value of gold to the owner of the unit instead.

Actually, it was an ability, and it worked, but it was giving me only 100 gold, for every building I sell.
 
Level 11
Joined
Jan 23, 2015
Messages
788
I am not 100% sure what you mean.
Here is the sell system that I use:

  • Sell
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • (Unit-type of (Trained unit)) Equal to Sell
    • Actions
      • Unit - Remove (Trained unit) from the game
      • Unit - Remove (Triggering unit) from the game
      • Player - Add (Point-value of (Triggering unit)) to (Owner of (Trained unit)) Current gold
      • Game - Display to (Player group((Owner of (Trained unit)))) the text: (You received + ((String((Point-value of (Triggering unit)))) + Gold for selling a Tower))
This pretty much adds the "Point-Value" of that building to the player and tells them they got that much gold.
Then just add to the building this:
242398-albums7980-picture94966.png

And to set how much the player gets just change this:
242398-albums7980-picture94967.png

Ofcouse first you must make a custom unit which will be named "sell"

You solved my problem, thank you, this can be made with ability too, and that option is better, the problem was that the point value of all my buildings was 100, now I fixed that.. thank you all!!
 
Status
Not open for further replies.
Top