HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Strangest bug ever!

08-09-2004, 09:11 PM#1
Voi
This bug is weird. I have worked 5 days with only this bug and I have made like 523895 different solutions but the same thing always happens at end. Please dont think I have missed something easy or that Im a noob map maker because I havent /Im not.

Problem: In one of my minigames it seems like all players just get a random score (its not random). All players gets a specific amount of points I really havent found out yet because I cant find any logic.
The only thing Im sure about is that u get 2 points if u answer right first round and 1 point if u are wrong.
I want you to get max (number of players in game) points and if 2 ppl die at the same time then both should get points equal to the best of them.
I know all variables except the "Points[#]" works.

Here comes my code in the buggy trigger:

Set MathSignNumber = (Random integer number between 1 and 3)
If MathSignNumber equal to 1
Set MathSign = +
If MathSignNumber equal to 2
Set MathSign = -
If MathSignNumber equal to 3
SetMathSign = ×
Set MathNumber[1] = (Random integer number between 0 and HighestMathNumber[MathSignNumber])
If MathSignNumber not equal to 2
Set MathNumber[2] = (Random integer number between 0 and HighestMathNumber[MathSignNumber])
Else
Set MathNumber[2] = (Random integer number between 0 and MathNumber[1])
If MathSignNumber equal to 1
Set CorrectMathAnswerString = (String((MathNumber[1] + MathNumber[2])))
If MathSignNumber equal to 2
Set CorrectMathAnswerString = (String((MathNumber[1] - MathNumber[2])))
If MathSignNumber equal to 3
Set CorrectMathAnswerString = (String((MathNumber[1] × MathNumber[2])))
Floating Text - Create floating text that reads (((String(MathNumber[1])) + MathSign) + (String(MathNumber[2]))) at (Center of Math <gen>) with Z offset 100, using font size 10.00, color (100.00%, 100.00%, 100.00%) with 0.00% transparency
Set MathText = (Last created floating text)
For each (Integer A) from 1 to 8, do (Actions)
Unit - Remove NoAnswerUnit[(Integer A)] from the game
Unit - Remove TimeToAnswerUnit[(Integer A)] from the game
Set NoAnswerUnit[(Integer A)] = No unit
Set TimeToAnswerUnit[(Integer A)] = No unit
If (CurrentMinigameUnit[(Integer A)] is alive) equal to true and ((Player((Integer A))) slot status) equal to Is Playing and ((Player((Integer A))) controller status) equal to User
Unit - Create 1 No answer for (Player((Integer A))) at (Center of PMCStart[(Integer A)]) facing 90.00 degrees
Set NoAnswerUnit[(Integer A)] = Last created unit
Unit - Create 1 Time to guess for (Player((Integer A))) at (Center of PMCStart[(Integer A)]) facing 90.00 degrees
Set TimeToGuessUnit[(Integer A)] = Last created unit
Wait 10.00 game-time seconds.
For each (Integer A) from 1 to 8, do (Actions)
Unit - Remove TimeToAnswerUnit[(Integer A)] from the game
Set TimeToAnswerUnit[(Integer A)] = No unit
If (CurrentMinigameUnit[(Integer)] is alive) equal to True and (MathAnswerString[(Integer A)] not equal to CorrectMathAnswerString and HaveAnsweredMath[(Integer A)] equal to True) or HaveAnsweredMath[(Integer A)] equal to False
Wait 0.50 game-time seconds
Unit - Order Warrior-of-Pain 0000 <gen> to Attack Once CurrentMinigameUnit[(Integer A)]
Player Group - Add (Owner of (CurrentMinigameUnit[(Integer A)])) to PlayersDyingThisRound
Unit Group - Add CurrentMinigameUnit[(Integer A)] to UnitsWhoWillDieThisRound
Set MathAnswerString[(Integer A)] = <Empty String>
Set HaveAnsweredMath[(Integer A)] = False
Set HighestMathNumber[1] = (HighestMathNumber[1] + 5)
Set HighestMathNumber[2] = (HighestMathNumber[2] + 5)
Set HighestMathNumber[3] = (HighestMathNumber[3] + 1)
Floating Text - Destroy MathText
Wait 2.00 game-time seconds
Set CurrentLevelPoints = (TotalPlayersInGame - (Number of units in (Units in 16PainsMathClass <gen> matching (((Unit-Type of (Matching unit)) equal to Pupil) and (((Matching unit) is alive) equal to true)))))
Player Group - Pick every player in PlayersDyingThisRound and do (Actions)
Set Points[(Player number of (Picked player))] = (Points[Player number of (Picked player))] + CurrentLevelPoints)
Remove all players from PlayersDyingThisRound
If (Number of units in (Units in 16PainsMathClass <gen> matching (((Unit-Type of (Matching unit)) equal to Pupil) and (((Matching unit) is alive) equal to true)))))) equal to 0
Unit Group - Pick every unit in UnitsWhoWillDieThisRound and do (Actions)
Special effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
Unit Group - Remove all units from UnitsWhoWillDieThisRound from UnitsWhoWillDieThisRound
Wait 2.50 game-time seconds
Unit - Remove Warrior-of-Pain 0000 <gen> from the game
Trigger - Run StartNextGame <gen> (ignoring conditions)
Skip remaining actions
If (Number of units in (Units in 16PainsMathClass <gen> matching (((Unit-Type of (Matching unit)) equal to Pupil) and (((Matching unit) is alive) equal to true)))))) equal to 1
Unit Group - Remove all units from UnitsWhoWillDieThisRound from UnitsWhoWillDieThisRound
Set CurrentLevelPoints = TotalPlayersInGame
Unit Group - Pick every unit in (Units in 16PainsMathClass <gen> matching (((Unit-Type of (Matching unit)) equal to Pupil) and (((Matching unit) is alive) equal to true)))) and do (Actions)
Unit - Kill (Picked unit)
Special effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Items\TomeOfRetraining\TomeOfRetrainingCaster.mdl
Set Points[(Player number of (Owner of (Picked unit)))] = (Points[(Player number of (Owner of (Picked unit)))] + CurrentLevelPoints)
Wait 2.50 game-time seconds
Unit - Remove Warrior-of-Pain 0000 <gen> from the game
Trigger - Run StartNextGame <gen> (ignoring conditions)
Skip remaining actions
Unit Group - Remove all units from UnitsWhoWillDieThisRound from UnitsWhoWillDieThisRound
Trigger - Run (This trigger) (ignoring conditions)
08-10-2004, 06:13 AM#2
Anitarf
Code:
If (CurrentMinigameUnit[(Integer)] is alive) equal to True and (MathAnswerString[(Integer A)] not equal to CorrectMathAnswerString and HaveAnsweredMath[(Integer A)] equal to True) or HaveAnsweredMath[(Integer A)] equal to False
Wait 0.50 game-time seconds
Unit - Order Warrior-of-Pain 0000 <gen> to Attack Once CurrentMinigameUnit[(Integer A)]

It's bad having waits in loops. This could be your problem. (haven't looked at the trigger further from this). Also, put the trigger in [code] brackets so we can more easily see the spaces in front of the lines so we can see which actions are under loops and which stand by themselves.