Ability Problem

HG-Bonfire

New Member
Reaction score
22
OK i decided to try and make a Puppeteer hero which I had thought of on this thread , and his Ulti spell can take control of 10 units around the hero aslong as he keeps channeling. Heres the triggers I used for it.

Code:
Pulling Strings
    Events
        Unit - A unit Begins channeling an ability
    Conditions
        (Ability being cast) Equal to Pulling Strings 
        (Unit-type of (Casting unit)) Equal to Puppeteer
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of Pulling Strings  for (Casting unit)) Equal to 1
            Then - Actions
                Set Puppeteer = (Casting unit)
                For each (Integer A) from 1 to 10, do (Actions)
                    Loop - Actions
                        Player Group - Pick every player in (All enemies of (Owner of Puppeteer)) and do (Actions)
                            Loop - Actions
                                Set Units_under_Control[(Integer A)] = (Random unit from (Units within 1000.00 of (Position of Puppeteer) matching ((((Matching unit) is A Hero) Equal to False) and ((Owner of (Matching unit)) Equal to (Picked player)))))
                        Lightning - Create a Magic Leash lightning effect from source (Position of Puppeteer) to target (Position of Units_under_Control[(Integer A)])
                        Set Lightning_Effect[(Integer A)] = (Last created lightning effect)
                        Trigger - Turn on Pulling Strings Lightning Effect <gen>
                        Unit - Change ownership of Units_under_Control[(Integer A)] to (Owner of (Casting unit)) and Retain color
            Else - Actions
                Do nothing

and
Code:
Pulling Strings Lightning Effect
    Events
        Time - Every 0.10 seconds of game time
    Conditions
    Actions
        Lightning - Move Lightning_Effect[1] to source (Position of Puppeteer) and target (Position of Units_under_Control[1])
        Lightning - Move Lightning_Effect[2] to source (Position of Puppeteer) and target (Position of Units_under_Control[2])
        Lightning - Move Lightning_Effect[3] to source (Position of Puppeteer) and target (Position of Units_under_Control[3])
        Lightning - Move Lightning_Effect[4] to source (Position of Puppeteer) and target (Position of Units_under_Control[4])
        Lightning - Move Lightning_Effect[5] to source (Position of Puppeteer) and target (Position of Units_under_Control[5])
        Lightning - Move Lightning_Effect[6] to source (Position of Puppeteer) and target (Position of Units_under_Control[6])
        Lightning - Move Lightning_Effect[7] to source (Position of Puppeteer) and target (Position of Units_under_Control[7])
        Lightning - Move Lightning_Effect[8] to source (Position of Puppeteer) and target (Position of Units_under_Control[8])
        Lightning - Move Lightning_Effect[9] to source (Position of Puppeteer) and target (Position of Units_under_Control[9])
        Lightning - Move Lightning_Effect[10] to source (Position of Puppeteer) and target (Position of Units_under_Control[10])

The problem is that the trigger is only taking over units belonging to player 2, even though I have put in several more enemy players of the Puppeteer. Anybody see whats wrong?
 
E

Eilhal

Guest
it looks like it should work... are you sure that they are all enemies of the puppeteer :p lol... I really have no clue what the problem may be
 

Daelin

Kelani Mage
Reaction score
172
Begins channeling an ability works just like begins casting an ability. Use "Starts the effect of an ability".

Use (Triggering Unit) instead of (Casting Unit). It is faster.

(Integer A) is dangerous because if another spell uses as well, the two may get messed up if cast at the same time.

And your problem is obvious. Just check how this piece of code works:
Code:
For each (Integer A) from 1 to 10, do (Actions)
                    Loop - Actions
                        Player Group - Pick every player in (All enemies of (Owner of Puppeteer)) and do (Actions)
                            Loop - Actions
                                Set Units_under_Control[(Integer A)] = blahblah

Well... The loop will be executed 10 times, there's no doubt. But the Pick up every unit picks all player I do not in which order, and for each player it assigns an unit to Unit_under_Control[x]. Problem is that if all the units are stored in the same variable, then only the unit of the last picked player will be taken. Clear? ;)

~Daelin
 

HG-Bonfire

New Member
Reaction score
22
Umm im sorry but im not sure what you're talking about, could you explain in a bit more detail?

and as for the integer A and stuff, it doesnt matter because there will only be 1 of the hero.
 
M

Masterfrog

Guest
I think what he means is because you got a loop in a loop, as long as integer A is 1, it will be fine, but when it loops it the second time, i.e. integer A is 2, it does the same thing over again, wich overwrite what it did do when it was 1, i.e. teh first time. and it will keep overwriting it 10 times. So as far as I can see that for each integer A loop actually does nothing.
 

Daelin

Kelani Mage
Reaction score
172
No... actually it's something like this.

Consider that you have nine footmen, three for player red, three for player blue, and three for player teal that may be picked by the trigger. You are player purple (let's consider that no other player exists).

Now, let's see how the trigger works (logically), with the loop above:

- (Integer A) = 1
- Player 16 is picked.
- Units_under_Control[1] = none //no such unit exists
- Player 15 is picked
- Units_under_Control[1] = none //no such unit exists
[...] //so on
- Player 4 (purple) is picked
- Units_under_Control[1] = none //you can't picked allied unit
- Player 3 (teal) is picked
- Units_under_Control[1] = footman
- Player 2 (blue) is picked
- Units_under_Control[1] = footman
- Player 1 (red) is picked
- Units_under_Control[1] = footman

In the end, only a red footman is picked. Why? Because all the units are stored in the same variable. But a variable can store only a single value. The value currently stored in a variable, is actually the last value. In this case, the read footman.

Of course, I am unaware of how players are picked. I am thinking that if the last player picked is the owner of the caster for example, then in the end, no unit will be stored in the variable.

Buggy code! Bad algorithm!

~Daelin
 

HG-Bonfire

New Member
Reaction score
22
actually i figured out the problem, it had apsolutly nothing to do with the triggers. For some reason, when i test the game, only player 2 is listed as a computer, I have to actually open the game from wc3 and set the other computers to computer, they were on Open for some reason, and that meant they were the only enemy of the puppeteer

[EDIT]
Ok even after setting the fixed player settings in forces, now it only selects player 5, which is very strange, Is there a way to fix this?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • 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 Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top