killing value

MissKerrigan

Active Member
Reaction score
23
Hey there,

This will be a silly question, but I'm having problems with the next thing:


In my tower defense, creeps give minerals if you killed them

- level 1/10 must give 1 mineral for killing a creep
- level 10/20 must give 2 minerals for killing a creep
- level 20/30 must give 3 minerals for killing a creep
- level 30/40....... etc

I tried to create an integer and called it 'mineral value' and set it to 1
Every 10 waves I set it +1 but it is not working

Does anyone know how this is solved?

I know there must be a simple solution for this
I should shame myself using the editor for about 2 years now...

MissKerrigan
 

Fatmankev

Chef, Writer, and Midnight Toker
Reaction score
240
If you're not using it already, just assign the 1 mineral, 2 mineral, etc., to the Point Value of each set of units in the Unit Editor. Then just add x minerals to the killing player's resources, with x being the Point Value of the killed unit, and that should do it. Little messier, little more work, and maybe it has leaks - I don't know enough about coding to say for sure. But it should do what you want it to do.
 

Dave312

Censored for your safe viewing
Reaction score
269
You should post your triggers if you want to know why your solution is not working.
 

X-maul

AKA: Demtrod
Reaction score
201
Please do as Dave312 says - If you did just post your trigger the first time, the problem would most likely have been solved in a matter of hours.
___________________________________________________

I dont quite understand why it does not work, the only thing I could think of, is that you do not set the bounty value at all.
make sure you use the action Set Unit Property and set it to Bounty (Minerals);
Code:
        Unit - Set (Last created unit) Bounty (Minerals) to mineral value
Make sure you put this action right after you spawn each unit.
 

MissKerrigan

Active Member
Reaction score
23
I know why it IS not working because:

- If level 11 is spawning and I set the 'income integer' +1 then some of the creeps of level 10 are still in the map, they will given 2 minerals now instead of 1

- If I wait till level 10 is killed and THEN set the integer +1, there might be already killed some creeps of level 11


so these both cases are not working, I can't post the triggers because it are to much triggers + variables
 

X-maul

AKA: Demtrod
Reaction score
201
Did you try my method? When you set the bounty of the unit to a variable, the bounty of that unit wont change if you change the variable value later on.
 

MissKerrigan

Active Member
Reaction score
23
Yes I red your bounty explanation, but I have no idea where I can find this

Besides, I still would have trouble with the correct 'text tag' I create on the unit after killing
 

X-maul

AKA: Demtrod
Reaction score
201
This trigger, would spawn a unit periodically, give an order, and set the bounty to a variable, then increase the value of the variable by one. And go on and run the trigger again.
Code:
SPAWN
    Events
        Timer - Every 5.0 seconds of Game Time
    Local Variables
    Conditions
    Actions
        Unit - Create 1 Marine for player 1 at (Center of (Entire map)) facing 270.0 degrees (No Options)
        Unit - Order (Last created unit) to ( Move targeting (Center of (Entire map))) (Replace Existing Orders)
        Unit - Set (Last created unit) Bounty (Minerals) to KILLINGVALUE
        Variable - Set KILLINGVALUE = (KILLINGVALUE + 1)
NOTE: KILLINGVALUE is a global integer variable.

I'm confused by why you would like to create a text tag when the unit dies, if you just set the bounty, it will automatically display a text tag with the minerals earned.
 

MissKerrigan

Active Member
Reaction score
23
ok listen, here is what I think:


If I kill the first marine AFTER a new marine is spawned, the KILLINGVALUE is set to 2, and the text tag will be +2 minerals instead of 1 when I kill the FIRST marine

If you think I'm wrong then explain me why the text tag is showing the wrong number please
 

X-maul

AKA: Demtrod
Reaction score
201
because your text tag displays the variable and not the bounty of the dying unit.
 

MissKerrigan

Active Member
Reaction score
23
I got 2 variables:


1. Bounty (integer)

2. Text Tag (combined with integer)


So I MUST kill the unit before the next unit appears, or the integer will add +1, I can't escape from this
 

X-maul

AKA: Demtrod
Reaction score
201
the text tag should NOT be using the integer, but instead show the bounty of the dying unit.
 

X-maul

AKA: Demtrod
Reaction score
201
Oh, well I thought I used that at some point. Well it seems that there is no way to get the bounty of a unit.
Then what you want to do is to create a variable named "Bounty" with array of as much as possible (8192) and when a unit is spawned:
Code:
                        Variable - Set Bounty[(Unit tag of (Last created unit))] = KILLINGVALUE
Then when a unit dies, just refer to the Bounty[Unit tag of (Dying Unit))].

(A unit tag is an individual tag that each unit gets, that can never be mistaken for another unit)
 

X-maul

AKA: Demtrod
Reaction score
201
Uhmm... not an integer, that's a variable TYPE - click the variable (of type behavior) and check the "Array" box and set the array to the highest possible, even though it's only 128, you should still try the method I suggested.
 

Dave312

Censored for your safe viewing
Reaction score
269
I would just be using the Custom Value property of a unit rather than trying to save the values into an array. When a unit is created, set the Custom Value of the unit using the Set Unit Custom Value to the amount of bounty. Then when you want to give the bounty, just use the function Custom Value of Unit. Leave the Index parameter as 0.


Also X-Maul, you can reference a Unit's bounty (as specified in the data editor or a value assigned for that particular unit) by using the Unit Property function. You probably couldn't find it because the data type is Real, not Integer.

There are a lot of different ways you can go about doing this, but personally I would but using the built in Bounty system (as X-Maul suggested) as it displays the bounty text tag automatically for you.
 

MissKerrigan

Active Member
Reaction score
23
I found already a way to do it, not that correct way, but it works for my map

can somebody explain me the next 3 things?


1. custom value?

2. parameter?

3. string?


(sorry I'm not english, probably it's more understandable to english people)
 

Dave312

Censored for your safe viewing
Reaction score
269
Every unit has a Custom Value property which you can use to store a number. This number will be tied directly with that particular unit. In your case, you could use this property to store the bounty by setting the custom value when the unit is created and then retrieving this value when the unit dies.

A Parameter is a value you set when you call an action, function, condition or event. For example, the Unit Dies event has the parameter Unit where it allows you to specify which Unit the event responds to.

A string is a series of characters (numbers, letters and symbols). It is similar to the text data type except it does not store formatting (i.e you can't make the text a particular colour or font).
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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