Mineral cost of unit?

X-maul

AKA: Demtrod
Reaction score
201
What value is the value loaded by the "Mineral cost of unit" action?
I need it for a "Sell Tower" ability, and it gives the correct value (the value i spent on building it), but when I upgrade it (with a morph ability with a mineral cost) it gives 0 minerals back (even though the cost of the unit it 20?
 
you have to make a value that goes below 'zero'

If you spent 300 on a unit, then make an ability that costs -300
When you upgrade the unit with a morph ability, you have to make a new ability which cost more minerals
 
Uhm - Well I already did create the ability and the cost - the problem is that when I call the mineral cost of a unit, it does not give the correct value.
 
That function returns the value specified in the Cost: Cost+ property of the unit. It does not return the actual value spent on upgrading the unit.

What I suggest you do, is specify the actual cost of the upgrade in the Ability: Info+ property (use the sub-property Info - Technology Resource Cost) and also check Ignore Unit Cost in the Stats: Flags + on the morph ability. Then use the Cost: Cost + property on the unit to determine how much the tower will sell for.
 
hmm - well I tried to set the mineral cost of the unit to 20 - but it still leaves me with 0?
I might work around this - The units I want to sell are all invulnerable, so I might just set their HP to my cost value and call that value instead.
Even though it still bothers me that I cant figure this outo_O

EDIT: I'm not able to call the amount of HP a unit have?
EDIT 2: I'll post my trigger, so you can see if I did something wrong:
Code:
Sell Tower
    Events
        Unit - Any Unit uses  Sell Tower at Generic6 - Complete stage (Ignore shared abilities)
    Local Variables
    Conditions
    Actions
        Unit - Pause (Triggering unit)
        General - Wait 0.5 Game Time seconds
        Unit - Kill (Triggering unit)
        Player - Modify player (Owner of (Triggering unit)) Minerals: Add ((Minerals cost of (Unit type of (Triggering unit))) / 2)
        Environment - Create a Large Protoss explosion at (Position of (Triggering unit))
        Text Tag - Create a text tag with the text ("+" + ((Text(((Minerals cost of (Unit type of (Triggering unit))) / 2))) + "</c>")) for (Player group((Owner of (Triggering unit)))), using a font size of 24, at (Position of (Triggering unit)) and height offset 1.0, initially Visible, and fog of war enforcement set to False
        Text Tag - Set Duration time for (Last created text tag) to 1.5 seconds
        Text Tag - Set Fade Duration time for (Last created text tag) to 2.0 seconds
 
I think the wait is causing problems. I've had problems where the reference to the Triggering Unit is lost when you use waits. Save the triggering unit in a local variable and refer to the local variable instead of the triggering unit. It should work better.

I think that might also be the reason that the mineral cost action didn't work for you.
 
hmm - well I will try that, but the trigger works for every unit but not the morphed unit.
 
Modify the minerals BEFORE you kill the unit, im pretty sure the kill unit function removes the unit and plays a generic death, but if the unit is already gone, you cant use that unit properly as an argument to another function, ie:
Code:
Player - Modify player (Owner of (Triggering unit)) Minerals: Add ((Minerals cost of (Unit type of (Triggering unit))) / 2)
You do this when the triggering unit no longer exists, unless it is like wc3 where the unit exists until it decays.
 
lol what you guys doing all difficould with triggers, just set the 'cost' to -300 and you'll get 300 minerals when use the ability
 
but then he needs to make an ability for every tower and set it correctly with the mineral cost... like this he doesnt need to make all those abilities, just 1 and give it to all the towers
 
Modify the minerals BEFORE you kill the unit, im pretty sure the kill unit function removes the unit and plays a generic death, but if the unit is already gone, you cant use that unit properly as an argument to another function, ie:
Code:
Player - Modify player (Owner of (Triggering unit)) Minerals: Add ((Minerals cost of (Unit type of (Triggering unit))) / 2)
You do this when the triggering unit no longer exists, unless it is like wc3 where the unit exists until it decays.
Ah right, that's what I was getting at but I was focused on the wait instead of the kill unit.
 
Ah, will try this when I get time :) It does make sense, but I still dont understand why it works for units not being morphed.

But thank you anyway guys :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top