Income ofr killed unit + table with income

Discussion in 'World Editor Help' started by Whiteelektroman, Apr 2, 2017.

  1. Whiteelektroman

    Whiteelektroman New Member

    Ratings:
    +0 / 0 / -0
    Hello, I need trigger that

    If player brown peasant die it gives income x for player blue and red every 10 or 20 seconds
    + I need a table that shows your( or your team) income + some timer...

    Also some menu( only for red) that allows to chose mode game with or without heroes and table in which you can chose heroes...

    Also when you type -l on chat it changes x gold for y wood.


    I am pretty green in w3 editor...
     
  2. Accname

    Accname 2D-Graphics enthusiast

    Ratings:
    +1,543 / 4 / -4
    So what exactly are you asking for?
    Nobody is going to just write it for you. If you have an exact question we would gladly give you an answer, but right now you are all over the place.

    If you want to give players a periodic income I would suggest having an integer array which holds the income value for each player with the player number as an index. You would have a trigger that periodically increases each players gold by this value.
    If you want to increase the value if a unit of a certain type dies it would be a straight forward implementation. Example: (pseudo code)
    Code:
    Event
        Every X seconds of game time
    Conditions
    Actions
        for each integer A from 1 to 12
            set gold of ( player by index ( A ) ) to ( gold of ( player by index ( A ) ) + Income[A] )
    
    Code:
    Event
        Unit dies
    Conditions
        Type of ( triggering unit ) is Peasant
    Actions
        set Index = player number of ( owner of ( killing unit ) )
        set Income[Index] = Income[Index] + 10
    
    With your "tables" or "menues" I assume you mean leaderboards or multiboards. These are a fair bit more complicated and require some more work. If you are not as experienced I would recommend against using one and instead using a dummy unit with dummy abilities instead.

    Your chat command is rather simple though. The event should be obvious. To get the value of your "x" you will need to take the substring from the entered chat message and convert it to an integer. This may or may not fail in which case you probably want to print out an error message. Next you should check if the triggering player actually has "x" much gold. If he does take the gold away and give him the lumber. It would look something like this: (pseudo code)
    Code:
    Event
        Player X enters chat message containing "-l"
    Conditions
    Actions
        set X = Integer( Substring ( entered Chat Message, 3, ( length of ( entered chat message ) ) ) )
        if ( gold of ( triggering player ) >= X )
            set gold of ( triggering player ) to ( gold of ( triggering player ) - X )
            set lumber of ( triggering player ) to ( lumber of ( triggering player ) + X )
    
     
  3. Whiteelektroman

    Whiteelektroman New Member

    Ratings:
    +0 / 0 / -0
    I think this shall do....
    Exactly as you said.. .So it looks for example
    If player a single swordman( player 12) dies some price (10g) is added t oyour every 20 sec income so if you kill 5 swordsman(brown) you have 50g every 20 seconds.

    And what about table it should be to right and show like just timer that counts 20 second and loop it and udner income that calculate if (brown) swordman is killed it adds 10 ( other unit other value)

    I am gonnna try out those triggers and let know if they work. :)
     
  4. Whiteelektroman

    Whiteelektroman New Member

    Ratings:
    +0 / 0 / -0
    Oh damn... I made mistake.... I wanted for every bought/created unit value is added to income
     
  5. Whiteelektroman

    Whiteelektroman New Member

    Ratings:
    +0 / 0 / -0
    I got everything except, when player from team 1 press f1 or f3 it is like click on tower building... how to make it for other players other building?
     
  6. Accname

    Accname 2D-Graphics enthusiast

    Ratings:
    +1,543 / 4 / -4
    I dont understand your question.
     
  7. Whiteelektroman

    Whiteelektroman New Member

    Ratings:
    +0 / 0 / -0
    oh I know.. i need to make hero of building... I think topic can be closed...
     

Share This Page