Scn 000EsmeraldaAnvilRepair
;This script runs the Repair window from static repair items
;script by JJMax
Begin OnActivate
short doonce 0
short charge
long startingRH
long gold
long maxRH
long totalRH
long finishRH
long spentRH
long usedRH
long cost
long removeRH
short Button
short Button2
;On activation of item by player, displays message, adds hammers, equips them
;and removes them once done.
if(IsActionRef player == 1)
if(Player.GetActorValue Mercantile > 0)
set charge to 13
endif
if(Player.GetActorValue Mercantile > 25)
set charge to 11
endif
if(Player.GetActorValue Mercantile > 50)
set charge to 9
endif
if(Player.GetActorValue Mercantile > 75)
set charge to 7
endif
if(Player.GetActorValue Mercantile >= 100)
set charge to 5
endif
set startingRH to player.getitemcount repairhammer
set gold to player.getitemcount 0000000F
set maxRH to gold / charge
set totalRH to startingRH + maxRH
MessageBox "Euer Gold und Eure eigenen Reparaturhämmer erlauben Euch, das Maximum von %.0f Hämmern zu benutzen.", totalRH "Lasst die Arbeit beginnen!"
set doonce to 1
[COLOR="Red"]end[/COLOR]
Begin Gamemode
if (doonce == 1)
set button to getbuttonpressed
if(button > -1)
if(button == 0)
player.additem repairhammer, maxRH
if(totalRH > 1)
player.equipitem repairhammer
set doonce to 2
endif
if(totalRH == 0)
MessageBox "Ihr habt leider nicht genügend Septime."
set doonce to 0
endif
endif
endif
endif
End
Begin gamemode
if(doonce == 2)
set finishRH to player.getitemcount repairhammer
set usedRH to totalRH - finishRH
set spentRH to usedRH - startingRH
set cost to spentRH * charge
if(spentRH > 0)
MessageBox "Ihr habt %.0f unserer Spezialhämmer benutzt. Dies wird Euch %.0f Gold kosten. Zusätzliche Hämmer werden nun aus Eurem Inventar entfernt.", spentRH, cost
player.removeitem 0000000F, cost
player.removeitem repairhammer, maxRH
set doonce to 0
endif
if(spentRH <= 0)
MessageBox "Ihr habt keinen unserer Spezialhämmer genutzt und müsst daher auch keine Abgabe leisten. Zusätzliche Hämmer werden nun aus Eurem Inventar entfernt."
player.removeitem repairhammer, maxRH
set doonce to 0
endif
endif
[COLOR="Red"]endif[/COLOR]
End