Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Game programming (http://www.go4expert.com/forums/game-programming-forum/)
-   -   Blacksmith Setup game programing (http://www.go4expert.com/forums/blacksmith-setup-game-programing-t11299/)

XXxxImmortalxxXX 12Jun2008 21:19

Blacksmith Setup game programing
 
Hey i have a error in this script whats wrong with it?
Code:

Function Main()

        Player = Actor()
        D = OpenDialog(Player, ContextActor(), "Fat Ivan's Magic Shop")
                DialogOutput(Player, D, "Welcome to my shop! And what may I do for you?", 255, 255, 255)
                Result = DialogInput(Player, D, "Magic skill increase (10 gp)", "Mana boost (2 gp)", "Healing spell (15 gp)", "Charm creature spell (5 gp)", "Speed! (5 gp)", "Trade", "Nothing, goodbye")
                If (Result == 1)
                        If (Gold(Player) > 9)
                                ChangeGold(Player, -10)
                                SetAttribute(Player, "Magic", Attribute(Player, "Magic") + 2)
                                DialogOutput(Player, D, "Attribute increased!", 255, 255, 255)
                                ScreenFlash(Player, 255, 255, 255, 255, 1000)
                        Else
                                DialogOutput(Player, D, "You do not have enough gold!", 255, 255, 255)
                        EndIf
                ElseIf (Result == 2)
                        If (Gold(Player) > 1)
                                CurrentLevel = Attribute(Player, "Mana")
                                If (CurrentLevel < MaxAttribute(Player, "Mana"))
                                        ChangeGold(Player, -2)
                                        SetAttribute(Player, "Mana", CurrentLevel + 1)
                                        DialogOutput(Player, D, "Mana restored!", 255, 255, 255)
                                Else
                                        DialogOutput(Player, D, "Your mana is already full...", 255, 255, 255)
                                EndIf
                        Else
                                DialogOutput(Player, D, "You do not have enough gold!", 255, 255, 255)
                        EndIf
                ElseIf (Result == 3)
                        If (Gold(Player) > 14)
                                If (Attribute(Player, "Magic") > 9)
                                        ChangeGold(Player, -15)
                                        AddAbility(Player, "Heal Self", 1)
                                        DialogOutput(Player, D, "Spell learned!", 255, 255, 255)
                                Else
                                        DialogOutput(Player, D, "Sorry, your magic skill is not high enough.", 255, 255, 255)
                                EndIf
                        Else
                                DialogOutput(Player, D, "You do not have enough gold!", 255, 255, 255)
                        EndIf
                ElseIf (Result == 4)
                        If (Gold(Player) > 4)
                                If (Attribute(Player, "Magic") > 4)
                                        ChangeGold(Player, -5)
                                        AddAbility(Player, "Charm Creature", 1)
                                        DialogOutput(Player, D, "Spell learned!", 255, 255, 255)
                                Else
                                        DialogOutput(Player, D, "Sorry, your magic skill is not high enough.", 255, 255, 255)
                                EndIf
                        Else
                                DialogOutput(Player, D, "You do not have enough gold!", 255, 255, 255)
                        EndIf
                ElseIf (Result == 5)
                        If (Gold(Player) > 4)
                                ChangeGold(Player, -5)
                                AddActorEffect(Player, "Speed!", "Speed", 15, 30, 131)
                                ScreenFlash(Player, 255, 50, 50, 255, 1000)
                                DialogOutput(Player, D, "Vrrrrooooom!", 255, 50, 50)
                        Else
                                DialogOutput(Player, D, "You do not have enough gold!", 255, 255, 255)
                        EndIf
                ElseIf (Result == 6)
                        OpenTrading(Player, ContextActor())
                        DialogOutput(Player, D, "Thanks for coming!", 255, 255, 255)
                ElseIf (Result == 7)
                        CloseDialog(Player, D)
                        Return()
                EndIf
                DialogInput(Player, D, "Goodbye...")
        CloseDialog(Player, D)
        EndThen
        Return()

End Function





and






Function Main()

        GiveItem(Actor(), "Forge Hammer", 1)
        GiveItem(Actor(), "questionmark", 1)
        GiveItem(Actor(), "Razor Mace", 2)
        GiveItem(Actor(), "Leather Shirt", 1)
        GiveItem(Actor(), "Odd Mushroom", 4)
        GiveItem(Actor(), "Beer", 11)
        SetName(Actor(), "Thoreg")
        Return()

End Function



All times are GMT +5.5. The time now is 21:56.