HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

A couple of Scripting Problems...

08-17-2006, 02:07 PM#1
DeltaOne
Oh oh, hello everybody!

As seen in my other topic (who had a great deal of misc. questions in it), my last post was about a certain Trigger-Dialog thingy which I was puzzled (and still am puzzled) about.

So... The Below Trigger creates the Dialog with its buttons:
Trigger:
VotingCreate
Collapse Events
Time - Elapsed game time is 0.01 seconds
Conditions
Collapse Actions
Dialog - Clear DialogVoting
Dialog - Change the title of DialogVoting to Vote - Number of Ki...
Wait 0.01 seconds
Dialog - Create a dialog button for DialogVoting labelled 5 Kills
Set Dialog05Kills = (Last created dialog Button)
Wait 0.01 seconds
Dialog - Create a dialog button for DialogVoting labelled 10 Kills
Set Dialog10Kills = (Last created dialog Button)
Wait 0.01 seconds
Dialog - Create a dialog button for DialogVoting labelled 20 Kills
Set Dialog20Kills = (Last created dialog Button)
Wait 0.01 seconds
Dialog - Create a dialog button for DialogVoting labelled 30 Kills
Set Dialog30Kills = (Last created dialog Button)
Wait 0.01 seconds
Dialog - Create a dialog button for DialogVoting labelled 40 Kills
Set Dialog40Kills = (Last created dialog Button)
Wait 0.01 seconds
Dialog - Create a dialog button for DialogVoting labelled 50 Kills
Set Dialog50Kills = (Last created dialog Button)
Wait 0.01 seconds
Game - Display to (All players) the text: You have 15 seconds...
Wait 2.00 seconds
Player Group - Pick every player in (All players controlled by a User player) and do (Dialog - Show DialogVoting for (Picked player))

The Below counts for how many times a dialog button has been clicked:
Trigger:
VotingCount
Collapse Events
Dialog - A dialog button is clicked for DialogVoting
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Clicked dialog button) Equal to Dialog05Kills
Collapse Then - Actions
Set DialogVotingCount[1] = (DialogVotingCount[1] + 1)
Dialog - Hide DialogVoting for (Triggering player)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Clicked dialog button) Equal to Dialog10Kills
Collapse Then - Actions
Set DialogVotingCount[2] = (DialogVotingCount[2] + 1)
Dialog - Hide DialogVoting for (Triggering player)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Clicked dialog button) Equal to Dialog20Kills
Collapse Then - Actions
Set DialogVotingCount[3] = (DialogVotingCount[3] + 1)
Dialog - Hide DialogVoting for (Triggering player)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Clicked dialog button) Equal to Dialog30Kills
Collapse Then - Actions
Set DialogVotingCount[4] = (DialogVotingCount[4] + 1)
Dialog - Hide DialogVoting for (Triggering player)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Clicked dialog button) Equal to Dialog40Kills
Collapse Then - Actions
Set DialogVotingCount[5] = (DialogVotingCount[5] + 1)
Dialog - Hide DialogVoting for (Triggering player)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Clicked dialog button) Equal to Dialog50Kills
Collapse Then - Actions
Set DialogVotingCount[6] = (DialogVotingCount[6] + 1)
Dialog - Hide DialogVoting for (Triggering player)
Collapse Else - Actions
Do nothing


The Below counts which of the options above has the most clicks:
Trigger:
VotingDecide
Events
Conditions
Collapse Actions
Collapse For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
DialogVotingCount[TempInt] Less than DialogVotingCount[(Integer A)]
Collapse Then - Actions
Set DialogVotingCount[TempInt] = DialogVotingCount[(Integer A)]
Collapse Else - Actions
Do nothing

And the Below changes the Leaderboard Title based on the most clicked button:
Trigger:
VotingFinal
Collapse Events
Time - Elapsed game time is 18.00 seconds
Conditions
Collapse Actions
Player Group - Pick every player in (All players) and do (Dialog - Hide DialogVoting for (Picked player))
Wait 0.10 seconds
Dialog - Clear DialogVoting
Wait 0.10 seconds
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
DialogVotingCount[TempInt] Equal to DialogVotingCount[1]
Collapse Then - Actions
Leaderboard - Change the title of (Last created leaderboard) to Score (max 5 Kills)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
DialogVotingCount[TempInt] Equal to DialogVotingCount[2]
Collapse Then - Actions
Leaderboard - Change the title of (Last created leaderboard) to Score (max 10 Kills...
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
DialogVotingCount[TempInt] Equal to DialogVotingCount[3]
Collapse Then - Actions
Leaderboard - Change the title of (Last created leaderboard) to Score (max 20 Kills)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
DialogVotingCount[TempInt] Equal to DialogVotingCount[4]
Collapse Then - Actions
Leaderboard - Change the title of (Last created leaderboard) to Score (max 30 Kills)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
DialogVotingCount[TempInt] Equal to DialogVotingCount[5]
Collapse Then - Actions
Leaderboard - Change the title of (Last created leaderboard) to Score (max 40 Kills)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
DialogVotingCount[TempInt] Equal to DialogVotingCount[6]
Collapse Then - Actions
Leaderboard - Change the title of (Last created leaderboard) to Score (max 50 Kills)
Collapse Else - Actions
Do nothing


Now.. it kinda works.. rather than, clicking the 4th button changes the Leaderboard title to the 1st button, clicking the 1st will change the Leaderboard title as the 2nd button would have done.. heh.. what's wrong?
08-17-2006, 04:18 PM#2
Naakaloh
Firstly, you can remove all of the 0.01 waits as they are not doing anything except putting a pause between the function calls.

The second thing deals with your counting trigger; it doesn't determine which index is set to the highest value, it instead just gives you the highest value, which means if option 1 and 2 are tied for the most votes, option 1 will be selected. Of course, this is good if that's how you want it.

It would be odd if either of these had anything to do with your problem, but I thought I should point them out anyway, since I couldn't figure out what was actually wrong.
08-17-2006, 08:13 PM#3
Daelin
I have a hunch it is the initial values.
What's the initial value of TempInt? If it is less than 7 then you may have a problem. I would simply avoid it and use DialogVotingCount[7] and initialize it in the first trigger with 0.
You should also initialize DialogVotingCount[1], DialogVotingCount[2] [...] DialogVotingCount[6] with 0 at the beginning of the first trigger. Why? Because I'm not sure how initial values are assigned to the array. Just a hunch but I think it will work!

~Daelin
08-17-2006, 09:09 PM#4
The)TideHunter(
in wc3map.j, all arrays get declared with a value of null, 0, "", false or if their certain types of handles, they will be created.
Arrays are declared up to the array size of the array, setting the array size to 10 for instance, will loop 10 times and set all the values to nothing. (as above, 0, "" etc)
So i doubt its that problem.
But its worth a try.
08-17-2006, 11:21 PM#5
DeltaOne
Nope, it still won't damn work.

Heh, apparently, each time I test this, I get the trigger as if I clicked on the first dialog button, changing the Leaderboard title to Score - 5 Kills, as in everyone clicked only the first button.
And once when I clicked on the first Dialog Button the leaderboard changed to Score - 10 Kills, as in the Second Dialog Button.

I don't really care to use the above, I just really... REALLY need something that works. And.. the above is odd...



Can anyone help me out by crafting a similar trigger that works, one that is able to change the Leaderboard Title also?
08-19-2006, 07:36 PM#6
Captain Griffen
Get rid of third trigger. Change fourth to:

Trigger:
VotingFinal
Collapse Events
Time - Elapsed game time is 18.00 seconds
Conditions
Collapse Actions
Collapse For each Loop Integer A from 1 to 12
Collapse loop
Dialog - Hide DialogVoting for Player(Integer A)
Dialog - Clear DialogVoting
Set HighValue = 0
Collapse For each Loop Integer A from 1 to 6
Collapse loop
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
DialogVotingCount[Integer A] is Greater than HighValue
Collapse Then - Actions
Set HighValue = DialogVotingCount[Integer A]
Set HighNumber = Integer A
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HighNumber is Equal to 1
Collapse Then - Actions
Leaderboard - Change the title of (Last created leaderboard) to Score (max 5 Kills)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HighNumber is Equal to 2
Collapse Then - Actions
Leaderboard - Change the title of (Last created leaderboard) to Score (max 10 Kills...
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HighNumber is Equal to 3
Collapse Then - Actions
Leaderboard - Change the title of (Last created leaderboard) to Score (max 20 Kills)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HighNumber is Equal to 4
Collapse Then - Actions
Leaderboard - Change the title of (Last created leaderboard) to Score (max 30 Kills)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HighNumber is Equal to 5
Collapse Then - Actions
Leaderboard - Change the title of (Last created leaderboard) to Score (max 40 Kills)
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
HighNumber is Equal to 6
Collapse Then - Actions
Leaderboard - Change the title of (Last created leaderboard) to Score (max 50 Kills)
Collapse Else - Actions
Do nothing
08-19-2006, 11:10 PM#7
DeltaOne
Although I thanked you earlier, thanks again! :)


My last trigger problem is a fairly easy one which I don't have any idea about why isn't working.

The trigger sounds like this:
Trigger:
Team1LevelUp
Events
Collapse Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Team1Score Equal to 3
Team1Score Equal to 6
Team1Score Equal to 9
Team1Score Equal to 12
Team1Score Equal to 15
Team1Score Equal to 18
Team1Score Equal to 21
Team1Score Equal to 24
Team1Score Equal to 27
Team1Score Equal to 30
Team1Score Equal to 33
Team1Score Equal to 36
Team1Score Equal to 39
Team1Score Equal to 42
Team1Score Equal to 45
Team1Score Equal to 48
Collapse Actions
Game - Display to (All allies of Player 1 (Red)) the text: By the Mighty Power...
Wait 1.00 seconds
Player Group - Pick every player in (All allies of Player 1 (Red)) and do (Unit Group - Pick every unit in (Units in (Playable map area) owned by (Picked player)) and do (Hero - Set (Picked unit) Hero-level to ((Hero level of (Picked unit)) + 1), Show level-up graphics))

First of it all, when a unit dies, the TeamScore increases with +1. I'd like this script to see when the TeamScore reaches a certain amount, and then to do the Actions.

Right now, I'm confused. This won't work at all, not even the text thingy won't appear, not to mention the level-up. Is it something I'm missing?