killing value

MissKerrigan

Active Member
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
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.
 

X-maul

AKA: Demtrod
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
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
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
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
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
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
 

MissKerrigan

Active Member
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
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
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
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
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
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.
  • Varine Varine:
    Did we get a new chat thing?
  • Ghan Ghan:
    We did!
  • Ghan Ghan:
    The old shoutbox wasn't supported anymore. We updated xenForo, so it had to be replaced.
  • jonas jonas:
    let's see if everyone finds it... the nice thing about the shoutbox was I could check on it even while logged out, but the existence of this one is hidden when you're not logged in
  • Ghan Ghan:
    We can fix that.
  • Ghan Ghan:
    Chat should show on the sidebar when not logged in now.
  • Ghan Ghan:
    (You'll still need to log in to post messages)
  • Ghan Ghan:
    Test!
  • tom_mai78101 tom_mai78101:
    I must be in a test server.
  • tom_mai78101 tom_mai78101:
    Nice, Twitter tweets embedding now works
  • Wizard Wizard:
    Yup.
  • Ghan Ghan:
    Excellent.
  • Ghan Ghan:
    @tom_mai78101 Hello there.
  • Ghan Ghan:
    Tagging works in the chat too.
  • tom_mai78101 tom_mai78101:
    @Ghan Missed it.
  • Wizard Wizard:
    Still fixing things here and there. Added widgets to the portal, will make it match the ones here on the forum index tomorrow.
  • Ghan Ghan:
    The venerable World Editor Tutorials site has been converted to HTTPS at last.
  • jonas jonas:
    cool
  • jonas jonas:
    and I can even edit my messages, nice
  • seph ir oth seph ir oth:
    GENERAL CHIT CHAT, YOU ARE A BOLD ONE
  • Ghan Ghan:
    Hello there
  • The Helper The Helper:
    this new chatbox is great and the forum software update is great too
    +1
  • The Helper The Helper:
    upgrade has fixed forum registration spam problem
  • tom_mai78101 tom_mai78101:
    Something tells me we might be able to customize the chatbox a bit, considering that there's a gap under every message.

    Members online

    No members online now.

    Affiliates

    Hive Workshop
    Top