Problem with trigger

ajzdfd

New Member
Reaction score
5
plz tell me why this doesnt work:

Code:
Unit-A Unit begins casting an ability

(Owner of (Casting Unit)) Equal to Player 1 (Red)
(Ability Being Cast) Equal to Increase Taxes

Set Taxes[1] = (Taxes[1]+1)

what happens is when i cast any ability this goes into effect when it should only be for when "Increase Taxes" is cast
 

Samael88

Evil always finds a way
Reaction score
181
Copy the whole trigger instead of writing it.
At the top of the trigger there is a trigger icon with the triggers name, right click that and click "copy as text" then paste it, much easier to see the problem then.

It can be that you have a "or-all" on those conditions.
If not, try putting them in a "and-all", that may do the trick:thup:
 

Weegee

Go Weegee!
Reaction score
102
Code:
Unit-A Unit begins casting an ability

(Owner of (Casting Unit)) Equal to Player 1 (Red)
AND
(Ability Being Cast) Equal to Increase Taxes

Set Taxes[1] = (Taxes[1]+1)

really all you have to do is add the and condition so if they are both right then the action will work. I think it wasn't working because if one of them would work then it would do the actions and so it would check if player 1 red was doing that. Hope this makes sense lol
 

ajzdfd

New Member
Reaction score
5
ok sry about the bad format i didnt know how to convert it to text. I tried adding the "and" but it didnt work. I also have an event to show the variable on a leaderboard. Heres the exact trigger:
Code:
Raise Red Taxes
    Events
        Unit - A unit Begins casting an ability
    Conditions
        ((Owner of (Casting unit)) Equal to Player 1 (Red)) and ((Ability being cast) Equal to Increase Taxes )
    Actions
        Set Taxes[1] = (Taxes[1] + 1)
        Leaderboard - Change the value for Player 1 (Red) in (Leaderboard of Player 1 (Red)) to Taxes[1]
 

ajzdfd

New Member
Reaction score
5
heres another failed attempt:
Code:
Raise Red Taxes
    Events
        Unit - A unit owned by Player 1 (Red) Begins casting an ability
    Conditions
    Actions
        If ((Ability being cast) Equal to Increase Taxes ) then do (Set Taxes[1] = (Taxes[1] + 1)) else do (Do nothing)
        Leaderboard - Change the value for Player 1 (Red) in (Leaderboard of Player 1 (Red)) to Taxes[1]
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Triggers spells should use "starts the effect of".

But, either way, you sure there's not another trigger somewhere that you forgot about?
 

ajzdfd

New Member
Reaction score
5
i used "starts the effest of" and the same thing happens. I also deleted every other trigger that relates to the variable that is used.

Would the fact that the spells im testing this with were copied from eachother make a differnece? i made "increase taxes" then copied it and pasted it and chnaged the name to "Decrease Taxes". I dont know much but could that have possible effected something?

Edit: I think that might be the problem because i gave the unit another ability and it didnt effect the variable
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
hmmm... your trigger seems totaly right, are you sure you are using the right ability?
 

ajzdfd

New Member
Reaction score
5
ok i have another question and decided to post it here instead of creating another thread.
How would i set the value of an integer variable to equal the combined current mana of multiple units?
 

Fluffball

Well-Known Member
Reaction score
35
You will have to do a Unit Group - Pick Every Unit owned by Player (1) Red

then do Set Taxes[Player Number of (Owner of (Triggering Unit))] = Taxes[Player Number of (Owner of (Triggering Unit))] + (Picked Unit) Current Mana

As for the Taxes, you have to ALWAYS use Player Number of Owner of Triggering Unit, or Triggering Player, works better.

Did you do the Add Taxes to players gold, or take it?
 

ajzdfd

New Member
Reaction score
5
so by saying "(Picked Unit) Current Mana" it will combine the mana of all picked units?

Also i cant seem to find "Current Mana" as an option
 

vypur85

Hibernate
Reaction score
803
> instead of creating another thread

What's wrong with this? This is why you didn't get much response. Post a new one instead for new question.


> combine the mana of all picked units?

No. It only checks the mana of the current picked unit.


> i cant seem to find

'Unit - Properties'.



How would i set the value of an integer variable to equal the combined current mana of multiple units?
Code:
Set IntegerVariable = 0
Set TempUnitGroupVariable = Units within somehere matching something... 
Unit group - Pick every unit in [B]TempUnitGroupVariable[/B] and do multiple actions
  Loop - Actions
    Set IntegerVariable = (IntegerVariable + (Picked unit)'s Current mana)
-IntegerVariable is now combine mana value, use it as you wish [B]outside[/B] the loop-
 

Cheddar

This is the way it was meant to be.
Reaction score
126
I would probably pick every unit and throw them into a group called TempGroup.

Periodically pick a random unit out of the group and use Unit -- Property (I think it's a Real condition) to get its mana. Add that to TotalMana. Remove the unit from TempGroup. Repeat until no one is left in TempGroup.

Example: I've got 3 units, A, B, and C. To keep it simple, unit A has 1 mana, B 10 mana, C 100 mana.

Add A, B, and C into TempGroup. One will get chosen randomly; let's say A. Take A's mana (1) and add it to the total mana variable. Remove A from the group. Now you have B and C, and let's say it picks C. Add C's mana (100) to the variable and remove him. B is the only one left; we add 10. All of this added together -- what a coincidence! It's 111!

So yeah, keep taking units' mana until no one is left.
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
there is no option for Unit - Properties


He said propertys, not properties, and there is one, to learn where it is scrool down in the actions till you see units, then look for set unit mana or health, that will show you where it is.
 

ajzdfd

New Member
Reaction score
5
yes i know that. But im trying to make an integer variable equal the amount of combined mana multiple units have. heres my action:
Code:
Create Villagers
    Actions
        Unit Group - Pick every unit in Houses[1] and do (Actions)
            Loop - Actions
                Set Villagers[1] = (Villagers[1] + 1)
i want to replace that 1 at the end with "(picked unit) current mana" but it doesnt show on the options that i have.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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