scn FruitMachineMain
float timer
short init
float fQuestDelayTime ; for quest script timing
long FuseFruitStage
short open
short Stopped1
short Stopped2
short Stopped3
short Reel1Val
short Reel2Val
short Reel3Val
float NewAngle1
float NewAngle2
float NewAngle3
long Movements
short RNDmin
short RNDmax
short randVal
short NoOfCherries
short NoOfApples
short NoOfMellons
short NoOfSnails
short NoOfRings
Begin OnActivate
if open == 0 && player.GetGold > 0
playgroup forward 1
set open to 1
set init to 0
player.RemoveItem Gold001 1
endif
if player.GetGold < 1
messagebox "Du hast nicht genug Gold um zu spielen."
endif
End
Begin GameMode
if init == 0
;set the timer value
set timer to 1 ;delay
set init to 1
;set fQuestDelayTime to 1
set Movements to 0
set RNDmin to 1
set RNDmax to 14
set randVal to 0
set Stopped1 to 0
set Stopped2 to 0
set Stopped3 to 0
set NoOfCherries to 0
set NoOfApples to 0
set NoOfMellons to 0
set NoOfSnails to 0
set NoOfRings to 0
set NewAngle1 to 334
set NewAngle2 to 282
set NewAngle3 to 358
set FuseFruitStage to 10
else
if FuseFruitStage == 10 && open == 1
if timer > 0
set timer to timer - getSecondsPassed
else
set NewAngle1 to NewAngle1 + 8
set NewAngle2 to NewAngle2 + 8
set NewAngle3 to NewAngle3 + 8
if Stopped1 == 0
"010011D1".SetAngle x, NewAngle1
endif
if Stopped2 == 0
"010011D2".SetAngle x, NewAngle2
endif
if Stopped3 == 0
"01000CE7".SetAngle x, NewAngle3
endif
;if NewAngle > 2000
set Movements to Movements + 1
if Movements == 200
PlaySound DRSBarrelOpen
set Stopped1 to 1
set randVal to RNDmin + (GetRandomPercent * (RNDmax - RNDmin)) / 99
if randVal == 1
"010011D1".SetAngle x, 77
elseif randVal == 2
"010011D1".SetAngle x, 51
elseif randVal == 3
"010011D1".SetAngle x, 25
elseif randVal == 4
"010011D1".SetAngle x, 358
elseif randVal == 5
"010011D1".SetAngle x, 334
elseif randVal == 6
"010011D1".SetAngle x, 308
elseif randVal == 7
"010011D1".SetAngle x, 282
elseif randVal == 8
"010011D1".SetAngle x, 257
elseif randVal == 9
"010011D1".SetAngle x, 232
elseif randVal == 10
"010011D1".SetAngle x, 206
elseif randVal == 11
"010011D1".SetAngle x, 181
elseif randVal == 12
"010011D1".SetAngle x, 155
elseif randVal == 13
"010011D1".SetAngle x, 129
elseif randVal == 14
"010011D1".SetAngle x, 103
endif
set Reel1Val to randVal
endif
if Movements == 300
PlaySound DRSBarrelOpen
set Stopped2 to 1
set randVal to RNDmin + (GetRandomPercent * (RNDmax - RNDmin)) / 99
if randVal == 1
"010011D2".SetAngle x, 77
elseif randVal == 2
"010011D2".SetAngle x, 51
elseif randVal == 3
"010011D2".SetAngle x, 25
elseif randVal == 4
"010011D2".SetAngle x, 358
elseif randVal == 5
"010011D2".SetAngle x, 334
elseif randVal == 6
"010011D2".SetAngle x, 308
elseif randVal == 7
"010011D2".SetAngle x, 282
elseif randVal == 8
"010011D2".SetAngle x, 257
elseif randVal == 9
"010011D2".SetAngle x, 232
elseif randVal == 10
"010011D2".SetAngle x, 206
elseif randVal == 11
"010011D2".SetAngle x, 181
elseif randVal == 12
"010011D2".SetAngle x, 155
elseif randVal == 13
"010011D2".SetAngle x, 129
elseif randVal == 14
"010011D2".SetAngle x, 103
endif
set Reel2Val to randVal
endif
if Movements == 400
PlaySound DRSBarrelOpen
set Stopped3 to 1
set randVal to RNDmin + (GetRandomPercent * (RNDmax - RNDmin)) / 99
if randVal == 1
"01000CE7".SetAngle x, 77
elseif randVal == 2
"01000CE7".SetAngle x, 51
elseif randVal == 3
"01000CE7".SetAngle x, 25
elseif randVal == 4
"01000CE7".SetAngle x, 358
elseif randVal == 5
"01000CE7".SetAngle x, 334
elseif randVal == 6
"01000CE7".SetAngle x, 308
elseif randVal == 7
"01000CE7".SetAngle x, 282
elseif randVal == 8
"01000CE7".SetAngle x, 257
elseif randVal == 9
"01000CE7".SetAngle x, 232
elseif randVal == 10
"01000CE7".SetAngle x, 206
elseif randVal == 11
"01000CE7".SetAngle x, 181
elseif randVal == 12
"01000CE7".SetAngle x, 155
elseif randVal == 13
"01000CE7".SetAngle x, 129
elseif randVal == 14
"01000CE7".SetAngle x, 103
endif
set Reel3Val to randVal
set FuseFruitStage to 20
endif
endif
elseif FuseFruitStage == 20
if Reel1Val == 1 || Reel1Val == 5 || Reel1Val == 8 || Reel1Val == 11
set NoOfCherries to NoOfCherries +1
elseif Reel1Val == 2 || Reel1Val == 4 || Reel1Val == 9 || Reel1Val == 13
set NoOfApples to NoOfApples +1
elseif Reel1Val == 3 || Reel1Val == 6 || Reel1Val == 12
set NoOfMellons to NoOfMellons +1
elseif Reel1Val == 10 || Reel1Val == 14
set NoOfSnails to NoOfSnails +1
elseif Reel1Val == 7
set NoOfRings to NoOfRings +1
endif
if Reel2Val == 1 || Reel2Val == 5 || Reel2Val == 8 || Reel2Val == 11
set NoOfCherries to NoOfCherries +1
elseif Reel2Val == 2 || Reel2Val == 4 || Reel2Val == 9 || Reel2Val == 13
set NoOfApples to NoOfApples +1
elseif Reel2Val == 3 || Reel2Val == 6 || Reel2Val == 12
set NoOfMellons to NoOfMellons +1
elseif Reel2Val == 10 || Reel2Val == 14
set NoOfSnails to NoOfSnails +1
elseif Reel2Val == 7
set NoOfRings to NoOfRings +1
endif
if Reel3Val == 1 || Reel3Val == 5 || Reel3Val == 8 || Reel3Val == 11
set NoOfCherries to NoOfCherries +1
elseif Reel3Val == 2 || Reel3Val == 4 || Reel3Val == 9 || Reel3Val == 13
set NoOfApples to NoOfApples +1
elseif Reel3Val == 3 || Reel3Val == 6 || Reel3Val == 12
set NoOfMellons to NoOfMellons +1
elseif Reel3Val == 10 || Reel3Val == 14
set NoOfSnails to NoOfSnails +1
elseif Reel3Val == 7
set NoOfRings to NoOfRings +1
endif
set FuseFruitStage to 30
elseif FuseFruitStage == 30
if NoOfCherries == 2
messagebox "Du hast 2 Kirschen in einer Reihe, du gewinnst 1 Gold!"
player.additem Gold001 "1"
elseif NoOfCherries == 3
messagebox "Du hast 3 Kirschen in einer Reihe und bekommst 3 Gold!"
player.additem Gold001 "5"
elseif NoOfApples == 3
messagebox "Du hast 3 Äpfel in einer Reihe und gewinnst 10 Gold!"
player.additem Gold001 "10"
elseif NoOfMellons == 3
messagebox "Du hast 3 Melonen in einer Reihe und bekommst 20 Gold!"
player.additem Gold001 "20"
elseif NoOfSnails == 3
messagebox "Du hast 3 Schnecken, du gewinnst 50 Gold!"
player.additem Gold001 "50"
elseif NoOfRings == 3
messagebox "Du hast 3 Ringe und gewinnst 100 Gold!"
player.additem Gold001 "100"
endif
set FuseFruitStage to 40
set open to 0
endif
endif
End