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.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top