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?
 

MissKerrigan

Active Member
Reaction score
23
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
 

X-maul

AKA: Demtrod
Reaction score
201
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.
 

Dave312

Censored for your safe viewing
Reaction score
269
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.
 

X-maul

AKA: Demtrod
Reaction score
201
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
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
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.
 

X-maul

AKA: Demtrod
Reaction score
201
hmm - well I will try that, but the trigger works for every unit but not the morphed unit.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
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.
 

MissKerrigan

Active Member
Reaction score
23
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
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
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
 

Siretu

Starcraft 2 Editor Moderator
Reaction score
293
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.
 

X-maul

AKA: Demtrod
Reaction score
201
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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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