Some basic trigger help

Banes

New Member
Reaction score
0
I finally joined Thehelper :p I'll have to start off by saying it's nice to see people reply fairly quick on here . . I've waited hours on the battle.net forum to find no responses . . lol. Alright /rant off

This is just a fairly easy trigger (for most of you I'm sure) . . . I'll just jump into it.

Trigger: Create Wisps
What is should do:
Create a wisp for the selected player at the selected region every 3 kills the player gains. (Count kills to 3 for selected player, spawn wisp for selected player, reset kill count for selected player)
What it is doing:
Well, it's not creating the wisp :p I'm not sure why but I think it has something to do with the conditions / actions used to keep track of the kills

CreateMoreWisps
Events
Unit - A unit Dies
Conditions
((Killing unit) belongs to an ally of Player 1 (Red)) Equal to True
((Owner of (Killing unit)) controller) Equal to User
Actions
Set Player_Kills[(Player number of (Owner of (Killing unit)))] = Player_Kills[((Player number of (Owner of (Killing unit))) + 1)]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Player_Kills[(Player number of (Owner of (Killing unit)))] Equal to 3
Then - Actions
Unit - Create 1 Wisp for (Picked player) at (Center of YellowWisp <gen>) facing Default building facing degrees
Set Player_Kills[(Player number of (Picked player))] = 0
Else - Actions
Do nothing

So . . . that's it, I need to know how to get it working properly :D


Also it's setup for just red right now for testing purposes, I'd like to get it to work before I set it up for each player :D

Thanks!


Additional Question:

How would I go about making a menu at map initialization and setting up a second game mode?
(Example, standard game mode would spawn one wisp per 3 kills, extreme game mode would spawn one wisp per single kill.
 

Skippy

Active Member
Reaction score
39
You use Picked player but you don't have a Pick every player in Player group and do action.
 

Tyman2007

Ya Rly >.
Reaction score
74
Trigger:
  • CreateMoreWisps
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) belongs to an ally of Player 1 (Red)) Equal to True
      • ((Owner of (Killing unit)) controller) Equal to User
    • Actions
      • Set Player_Kills[(Player number of (Owner of (Killing unit)))] = Player_Kills[((Player number of (Owner of (Killing unit))) + 1)]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Player_Kills[(Player number of (Owner of (Killing unit)))] Equal to 3
        • Then - Actions
          • Unit - Create 1 Wisp for (Picked player) at (Center of YellowWisp &lt;gen&gt;) facing Default building facing degrees
          • Set Player_Kills[(Player number of (Picked player))] = 0
        • Else - Actions
          • Do nothing

much better :)

one second while I review this to see what else could be done.

EDIT:
The guy above me had posted that picked unit is wrong, well it is. change to owner of killing unit.
As for the "Do Nothing" at the bottom, remove that, that's just an extra line that's useless
"Center of YellowWisp <gen>" leaks. Make a location variable for the center of the rect and remove it after use.

Really all there is that I see.
 

Rushhour

New Member
Reaction score
46
try using Owner of(Killing Unit) instead of Picked Player

for your additional question:
I guess there are some ways to do this.
You can make player(s) choose the mode at the first 1 minute of your game by checking if they type in -hardmode for example. (You should tell them they can do so with a Displaytext to Player of course :D)

A trigger checks if -hardmode is typed as an exact match, this sets a <killsneaded> an integer variable to 1
then turn of the trigger
If noone types -harmode make another trigger turn of this trigger after 1 minute.
And yes set <killsneaded> standarf value to 3 and add it to the trigger that creates the wisps^^

Sorry I can't write the trigger for you because of my German WE, unless you understand some German :D

Edit:eek:k, forget it^^
 

Tyman2007

Ya Rly >.
Reaction score
74
I guess there are some ways to do this.
You can make player(s) choose the event at the first 1 minute of your game by checking if they type in -hardmode for example. (You should tell them they can do so with a Displaytext to Player of course

ooorrr make a dialog box
 

Emu.Man00

New Member
Reaction score
41
Set Player_Kills[(Player number of (Owner of (Killing unit)))] = Player_Kills[((Player number of (Owner of (Killing unit))) + 1)]

The square bracket is the index for the array. You're replacing the owner of killing unit's kill count with the kill count of another player. The '+ 1' should be outside of the bracket.
 

Banes

New Member
Reaction score
0
The square bracket is the index for the array. You're replacing the owner of killing unit's kill count with the kill count of another player. The '+ 1' should be outside of the bracket.

I'm trying to figure out how to fix this . . but it's not going so good. The only way I've been able to find to get the '+1' outside of the bracket is by not including the second "Player_Kills"

"Set Player_Kills[(Player number of (Owner of (Killing unit)))] = Player_Kills[((Player number of (Owner of (Killing unit))) + 1)]"

Any ideas? By the way, thanks everyone . . you're making this process a lot less painful :)
 

Banes

New Member
Reaction score
0
Nevermind, I figured that '+1' part out . . . I'll post back here and let you know what problems arise next (because of course this isn't going to work, nothing ever works with this) lol


Thanks so much guys.
 

Banes

New Member
Reaction score
0
More questions (hurray?)

Alright . . this one should be really simple . . . basically if you read above the idea is to spawn a new wisp every 3 kills. It IS working now thanks to you, except for one minimal part . . it spawns the first wisp on the FOURTH kill, instead of the third. Then every 3 kills after that it works perfectly.

It may be one of the triggers or both . . but here's what I have (I'll put images in since apparently that is preferred :) )

Wisp Trigger
Thehelper1.jpg


Leaderboard (I really don't think that this is the problem, but you never know)
Thehelper2.jpg



A recent problem which was kind of similar was because the trigger would only run the needed part after the first time the trigger was actually ran . . . is this a similar case?

As always thank you . . you guys have made this so much easier lol

PS: The Dialog box for the game mode menu worked beautifully and was a lot easier to figure out than I thought :)
 

Joccaren

You can change this now in User CP.
Reaction score
54
Is you integer variable set to something already (Check this in the variable panel)

Also, why not use WC3 tags? simpler than taking screenshots.
 

Banes

New Member
Reaction score
0
Because I don't know how to use the WC3 GUI tags yet :)

It's only set to this particular trigger, I have a different variable for the leaderboard (it wasn't originally but I figured that part out).

Right now when I go to test it, it counts the FIRST unit/hero kill as 2 kills, then the rest as 1. It's supposed to count the first as 1. This really isn't a big deal but I'm spending a lot of time on this and I don't want to send out another half-completed buggy as **** map :)
 

Joccaren

You can change this now in User CP.
Reaction score
54
I meant is your integer variable already set to one or two or something, check that in the variables panel.

To use a WC3 tag, right click the page icon above you trigger. Say, Save as text. Then click the WC3 tags or type them as
Trigger:
  • [/WC3 ] to close them. Then just paste you trigger as text between the tags
 

Banes

New Member
Reaction score
0
Alright, I feel stupid but I still don't understand what I should be checking.

When I view the variable screen I see Player_Kills as an integer with an array of 12 (assumed it needed to be 12 for 12 players).

Initial Value is set to 0 [Default]

and thanks.
 

Joccaren

You can change this now in User CP.
Reaction score
54
It should be set to zero, yes, but if it is taking four kills instead of three the first time, try setting it to one
 

Banes

New Member
Reaction score
0
I tried setting the variable initial value to 0 and 1, as well as changing the integer arrays to 0 and 1 since you didn't specify which to change (or maybe I missed it). Either way . . neither of them worked, still counts the first kill as 2 kills then the rest as one.
 

Rushhour

New Member
Reaction score
46
Add "Display text to All players" to your "unit dies" trigger (after the variable is increased) and set the text to your variable (string to integer--> and the index of the array to player number of owner of killing unit)
Then you see what the variable is set to after each kill, so check out what happens at the first three kills and tell us^^
 

Banes

New Member
Reaction score
0
Ah . . I suck at this.

First off, it wont let me set the text to the variable "Player_Kills". If that's not what you meant, all I can see is Conversion - Integer to string, nothing with String to variable.

That's originally why I created the leaderboard to keep track of what happens easier, when I kill the first unit, the leaderboard shows 2 kills, then I kill another and it shows 3, I kill a THIRD and it shows 4 and then creates the wisp (since it's technically the third kill).

Wait . . now that I put it that way . . wouldn't it be the leaderboard that is screwy?

If so . . here's the 2 triggers I have for the leaderboard . . . (Not so sure it's the leaderboard anymore . . but who knows)

Trigger:
  • Leaderboard
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Leaderboard - Create a leaderboard for (All players) titled LeaderboardTEST
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player 1 (Red) controller) Equal to User
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • Leaderboard - Add (Picked player) to (Last created leaderboard) with label (Name of (Picked player)) and value 0
            • Else - Actions
      • Leaderboard - Show (Last created leaderboard)


Trigger:
  • LeaderboardSetKills
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) belongs to an ally of Player 1 (Red)) Equal to True
    • Actions
      • Set Kills[(Player number of (Owner of (Killing unit)))] = (Kills[(Player number of (Owner of (Killing unit)))] + 1)
      • Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to (Kills[(Player number of (Owner of (Killing unit)))] + 1)
      • Leaderboard - Sort (Last created leaderboard) by Value in Descending order


Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to (Kills[(Player number of (Owner of (Killing unit)))] + 1)
^
|
Bingo?

Fixed! It was the leaderboard - change the value . . bla bla

I can't believe it was something so simple . . thanks for the help everyone and sorry I made that such a wild goose chase.
 

Rushhour

New Member
Reaction score
46
At first, create a variable of type "Leaderboard" and set this variable to "last created leaderboard right after the trigger created it, otherwise you will get in trouble if you create another leaderboard in your game at another time^^
Then of course change all the "last created leaderboards" to your variable.

Second thing: Why do you have two triggers with the same event and same conditions? Combine them and you get a better overview. And is it necessary for your map to have to integer array variable (Kills and Player_kills) that count the same thing as far as I see?
Maybe thats the problem.

(And be sure that both array variables have their starting value set to 0)

Edit: Ok you fixed it right in the second where I posted this message :D but look if you can "improve" your triggers the way I told, otherwise I wasted a minute for nothing :-O
 

Banes

New Member
Reaction score
0
Well I actually have 3 variables to keep track of the kills, one for leaderboard, one for standard wisps every 3 kills and another for "advanced wisps" every (undecided) kills. The reason I created a variable for each is for the creation triggers . . once they run they set the chosen variable back to 0 . . So I didn't want that to effect the leaderboard . . and the advanced wisp one is every 50 kills . . so it would have never been achievable.

Thanks for all of the help man, you (and everyone else who helped) are always. And sorry I didn't think about the problem being with the leaderboard earlier lol

PS: I've been trying to organize / clean up the triggers whenever I haven't felt like figuring out how to do something or got stuck, so I'll try it later, thanks.
 

Summoned

New Member
Reaction score
51
You don't really need to do that. ;)

Just check if the number is divisible by 3 (or whatever):
Trigger:
  • Modulo
    • Events
      • Unit - A unit Dies
    • Conditions
      • (((Owner of (Killing unit)) Units Killed) mod 3) Equal to 0
      • -whatever other check you need-
    • Actions
      • Unit - Create 1 Wisp for (Owner of (Killing unit)) at (Center of (Playable map area)) facing Default building facing degrees

Can also put that in an "if" statement when you update the Leaderboard, too.
 
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