HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Crashes! Woohoo!

03-04-2007, 10:59 PM#1
Falitian
So i have a system where creeps and other non-hero units gain hp and attack through upgrades. Regular units gain attack bonuses directly, but creeps gain it through an increase in their attack dice.

Now this just started happening, not sure why, but for some reason now, when the average hero level become 6 (the first point at which the units gain upgrades) the game crashes without an error window.

Here's all the triggers i'm using for this system:
Trigger:
Set Average
Collapse Events
Unit - A unit Gains a level
Collapse Conditions
((Triggering unit) is A Hero) Equal to True
Collapse Actions
Game - Display to (All players) the text: (Name of (Random unit from herogroup))
Collapse Unit Group - Pick every unit in (Units in (Playable map area)(((Matching unit) is A Hero) Equal to True)) and do (Actions)
Collapse Loop - Actions
Set amountheros = (amountheros + 1)
Set averagelvlnum = (averagelvlnum + (Hero level of (Picked unit)))
Set Averagelevel = (averagelvlnum / amountheros)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Averagelevel Equal to 6
Averagelevel Equal to 7
Averagelevel Equal to 8
Collapse Then - Actions
Player - Set the current research level of Upgrade 1 to 1 for Player 1 (Red)
Player - Set the current research level of % hp boost to 1 for Player 1 (Red)
Player - Set the current research level of Upgrade 1 to 1 for Player 2 (Blue)
Player - Set the current research level of % hp boost to 1 for Player 2 (Blue)
Player - Set the current research level of % hp boost to 1 for Neutral Hostile
Player - Set the current research level of Damage Inc 1 to 1 for Neutral Hostile
Set Creepexp = 1
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Averagelevel Equal to 9
Averagelevel Equal to 10
Averagelevel Equal to 11
Collapse Then - Actions
Player - Set the current research level of Upgrade 1 to 2 for Player 1 (Red)
Player - Set the current research level of Upgrade 1 to 2 for Player 2 (Blue)
Player - Set the current research level of Damage Inc 1 to 2 for Neutral Hostile
Player - Set the current research level of % hp boost to 2 for Player 1 (Red)
Player - Set the current research level of % hp boost to 2 for Player 2 (Blue)
Player - Set the current research level of % hp boost to 2 for Neutral Hostile
Set Creepexp = 2
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Averagelevel Equal to 12
Averagelevel Equal to 13
Averagelevel Equal to 14
Collapse Then - Actions
Player - Set the current research level of Upgrade 1 to 3 for Player 1 (Red)
Player - Set the current research level of Upgrade 1 to 3 for Player 2 (Blue)
Player - Set the current research level of Upgrade 1 to 3 for Neutral Hostile
Player - Set the current research level of Damage Inc 1 to 3 for Neutral Hostile
Player - Set the current research level of % hp boost to 3 for Player 1 (Red)
Player - Set the current research level of % hp boost to 3 for Player 2 (Blue)
Player - Set the current research level of % hp boost to 3 for Neutral Hostile
Set Creepexp = 3
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Averagelevel Equal to 15
Averagelevel Equal to 16
Averagelevel Equal to 17
Collapse Then - Actions
Player - Set the current research level of Upgrade 1 to 4 for Player 1 (Red)
Player - Set the current research level of Upgrade 1 to 4 for Player 2 (Blue)
Player - Set the current research level of Damage Inc 1 to 4 for Neutral Hostile
Player - Set the current research level of % hp boost to 4 for Player 1 (Red)
Player - Set the current research level of % hp boost to 4 for Player 2 (Blue)
Player - Set the current research level of % hp boost to 4 for Neutral Hostile
Set Creepexp = 4
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Averagelevel Equal to 18
Averagelevel Equal to 19
Averagelevel Equal to 20
Collapse Then - Actions
Player - Set the current research level of Damage Inc 1 to 5 for Neutral Hostile
Player - Set the current research level of % hp boost to 5 for Player 1 (Red)
Player - Set the current research level of % hp boost to 5 for Player 2 (Blue)
Player - Set the current research level of % hp boost to 5 for Neutral Hostile
Player - Set the current research level of Upgrade 1 to 5 for Player 1 (Red)
Player - Set the current research level of Upgrade 1 to 5 for Player 2 (Blue)
Set Creepexp = 5
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Averagelevel Equal to 21
Averagelevel Equal to 22
Averagelevel Equal to 23
Collapse Then - Actions
Player - Set the current research level of Upgrade 1 to 6 for Player 1 (Red)
Player - Set the current research level of Upgrade 1 to 6 for Player 2 (Blue)
Player - Set the current research level of Damage Inc 1 to 6 for Neutral Hostile
Player - Set the current research level of % hp boost to 6 for Player 1 (Red)
Player - Set the current research level of % hp boost to 6 for Player 2 (Blue)
Player - Set the current research level of % hp boost to 6 for Neutral Hostile
Set Creepexp = 6
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Averagelevel Equal to 24
Averagelevel Equal to 25
Averagelevel Equal to 26
Collapse Then - Actions
Player - Set the current research level of Upgrade 1 to 7 for Player 1 (Red)
Player - Set the current research level of Upgrade 1 to 7 for Player 2 (Blue)
Player - Set the current research level of Upgrade 1 to 7 for Neutral Hostile
Player - Set the current research level of Damage Inc 1 to 7 for Neutral Hostile
Player - Set the current research level of % hp boost to 7 for Player 1 (Red)
Player - Set the current research level of % hp boost to 7 for Player 2 (Blue)
Player - Set the current research level of % hp boost to 7 for Neutral Hostile
Set Creepexp = 7
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Averagelevel Equal to 27
Averagelevel Equal to 28
Averagelevel Equal to 29
Collapse Then - Actions
Player - Set the current research level of Upgrade 1 to 8 for Player 1 (Red)
Player - Set the current research level of Upgrade 1 to 8 for Player 2 (Blue)
Player - Set the current research level of Upgrade 1 to 8 for Neutral Hostile
Player - Set the current research level of Damage Inc 1 to 8 for Neutral Hostile
Player - Set the current research level of % hp boost to 8 for Player 1 (Red)
Player - Set the current research level of % hp boost to 8 for Player 2 (Blue)
Player - Set the current research level of % hp boost to 8 for Neutral Hostile
Set Creepexp = 7
Collapse Else - Actions
Do nothing
Set amountheros = 0
Set averagelvlnum = 0
Set Averagelevel = 0




Trigger:
Creep Exp
Collapse Events
Unit - A unit Dies
Collapse Conditions
(Owner of (Triggering unit)) Equal to Neutral Hostile
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Creepexp Equal to 0
Collapse Then - Actions
Hero - Add ((Level of (Triggering unit)) x 4) experience to (Killing unit), Show level-up graphics
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Creepexp Equal to 1
Collapse Then - Actions
Hero - Add ((Level of (Triggering unit)) x 6) experience to (Killing unit), Show level-up graphics
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Creepexp Equal to 2
Collapse Then - Actions
Hero - Add ((Level of (Triggering unit)) x 9) experience to (Killing unit), Show level-up graphics
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Creepexp Equal to 3
Collapse Then - Actions
Hero - Add ((Level of (Triggering unit)) x 13) experience to (Killing unit), Show level-up graphics
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Creepexp Equal to 4
Collapse Then - Actions
Hero - Add ((Level of (Triggering unit)) x 18) experience to (Killing unit), Show level-up graphics
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Creepexp Equal to 5
Collapse Then - Actions
Hero - Add ((Level of (Triggering unit)) x 24) experience to (Killing unit), Show level-up graphics
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Creepexp Equal to 6
Collapse Then - Actions
Hero - Add ((Level of (Triggering unit)) x 31) experience to (Killing unit), Show level-up graphics
Collapse Else - Actions
Do nothing
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Creepexp Equal to 7
Collapse Then - Actions
Hero - Add ((Level of (Triggering unit)) x 39) experience to (Killing unit), Show level-up graphics
Collapse Else - Actions
Do nothing
[/hidden]

I would really appreciate in insight into what the problem is.

And please no flaming telling me to learn Jass.
03-04-2007, 11:08 PM#2
Kalvorod
Well the first time they gain upgrades actually is level 6.

And unless you are thinking that 1 hero is going to gain levels a lot faster than everyone else, and then leave the game, you don't need the 2nd and 3rd conditions for each of those:

OR
Averagelvl =6
//Averagelvl=7 don't need
//Averagelvl=8 don't need

The reason for this is you are setting the stuff equal to a level and it remains the same whether their level is 6 7 or 8. Unless they all skip level 6 and go right to 7 you don't need it. (The average level will advance on average less that 1 per level gained (exactly 1/number of players). So unless there are 1 player who gains 2 levels (2/1 =2) then that can't happen.

That might help fix the problem, though I don't know if setting the upgrade to the same level affects things.
03-04-2007, 11:51 PM#3
Falitian
Yeah, i have the other two conditions in there in the case of a player leaving, or somehow two players manage to level at the exact same time or whatnot. Nothing wrong with a failsafe here or there.

And i fixed the 7 thing.

Ohh, and it is possible in my game, unfortunately, to gain multiple levels, so it is good to have in there.
That's because of the exp system I'm using.