Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Stopping Quests from Re-Starting


ozziedave
 Share

Recommended Posts

Hi All,

I have a bit of code from the Scripting Forum, but I want to stop the Quest from starting again,
couls someone please help me.

Case 2  '########## RING QUEST ###########
                  Call PlayerMsg(index, "I'm the Gate Keeper, can you buy me Zorgon's Ring from the store?", 12)

                          If CanTake(Index, 4, 1) = false then
                          Call PlayerMsg(index, "Better Hurry Now !!", 12)
                      Else
                          Call TakeItem(index, 4, 1)
                          Call GiveItem(index, 4, 100)
                          Call PlayerMsg(index, "Thanks I've increased your HP and Exp ", 12)
                          Call SetPlayerHP(index, GetPlayerHP(index) + 8)
                          Call SetPlayerExp(index, GetPlayerExp(index) + 10)
                          Call SendStats(index)
                          Call PlayerMsg(index, "This Quest has been completed ", 15)
                          End If
                      Exit Sub   

Many Thanks
Link to comment
Share on other sites

make a folder called "player" in your main server folder

These will the the lines your using

> Call putvar("/player/" & getplayername(index) & ".ini", "QUEST", "quest1", 0)

And this line

> If getvar("/player/" & getplayername(index) & ".ini", "QUEST", "quest1") = 0

Now, you will have to rig the OnNewChar sub to add each entry to the .ini file for each quest, changing the "quest1" to quest2, quest3, ect, or however you want to keep track of them.

> Sub OnNewChar(Index, CharNum)
> Call putvar("/player/" & getplayername(index) & ".ini", "QUEST", "quest1", 0)
> End Sub

this will make a .ini named after the player that will look like this

> [QUEST]
> quest1=0

In this example we are using the assumption that 0 = not started yet, is a simple way to do it.

Now you add a check to the beginning of the script to see if quest1=0, if its 0, they can do the quest, if its 1, they have dont the quest.

> If getvar("/player/" & getplayername(index) & ".ini", "QUEST", "quest1") = 0 Then
> script for quest
> Else
> call message that says quest done or whatever
> End If

The final version of your quest will look like this (however read what I wrote so you will understand .ini's for future use, very usefull)

> If getvar("/player/" & getplayername(index) & ".ini", "QUEST", "quest1") = 0 Then
> Call PlayerMsg(index, "I'm the Gate Keeper, can you buy me Zorgon's Ring from the store?", 12)
>                        
>                           If CanTake(Index, 4, 1) = false then
>                           Call PlayerMsg(index, "Better Hurry Now !!", 12)
>                       Else
>                           Call TakeItem(index, 4, 1)
>                           Call GiveItem(index, 4, 100)
>                           Call PlayerMsg(index, "Thanks I've increased your HP and Exp ", 12)
>                           Call SetPlayerHP(index, GetPlayerHP(index) + 8)
>                           Call SetPlayerExp(index, GetPlayerExp(index) + 10)
>                           Call SendStats(index)
>                           Call PlayerMsg(index, "This Quest has been completed ", 15)
>                           End If
> Else
> Call PlayerMsg(index, "Thank you for your assistance.", 12)
> End If

Not you can make multi layered quests like this, say after buying the ring you must deliver something for the guy, add an extra check, if quest1=1 then (next scripted step) ect ect.
Link to comment
Share on other sites

Hi DrNova,

Sorry but this did not work for me, it didn't make an ini file, so I set one up myself
Server/player - Zorgon.ini - [QUEST]

                                      quest1=1

Would not read or write the variable to the ini file 'If Getvar' did not work, with a 1 it should
not have displayed the Quest, but it did, what am I doing wrong ?.

Case 2  '########## RING QUEST ###########
                          Call putvar("\player\"& getplayername(index) & ".ini", "QUEST", "quest1", 0)
                          If getvar("\player\" & getplayername(index) & ".ini", "QUEST", "quest1") = 0 Then

                          Call PlayerMsg(index, "I'm the Gate Keeper, can you buy me Zorgon's Ring from the store?", 12)
                          If CanTake(Index, 4, 1) = false then
                          Call PlayerMsg(index, "Better Hurry Now !!", 12)
                      Else
                          Call TakeItem(index, 4, 1)
                          Call GiveItem(index, 4, 100)
                          Call PlayerMsg(index, "Thanks I've increased your HP and Exp ", 12)
                          Call SetPlayerHP(index, GetPlayerHP(index) + 8)
                          Call SetPlayerExp(index, GetPlayerExp(index) + 10)
                          Call SendStats(index)
                          Call PlayerMsg(index, "This Quest has been completed ", 15)
                          Call putvar("player\" & getplayername(index) & ".ini", "QUEST", "quest1", 1)
                          End If
                      Else
                      Call PlayerMsg(index, "Thank you for your assistance.", 12)
                  End If
            Exit Sub
Link to comment
Share on other sites

GOT IT.

Had to chage it slightly to get it to work, placed my Zorgon.ini in the Server Directory and it works fine.

              Case 2  '########## RING QUEST ###########

                        If getvar(getplayername(index) & ".ini", "QUEST", "quest1") = 0 Then
                          Call PlayerMsg(index, "I'm the Gate Keeper, can you buy me Zorgon's Ring from the store?", 12)
                          If CanTake(Index, 4, 1) = false then
                          Call PlayerMsg(index, "Better Hurry Now !!", 12)
                      Else
                          Call TakeItem(index, 4, 1)
                          Call GiveItem(index, 4, 100)     
                          Call PlayerMsg(index, "Well done your Quest has been accomplished", 12)
                          Call SetPlayerHP(index, GetPlayerHP(index) + 8)
                          Call SetPlayerExp(index, GetPlayerExp(index) + 10)
                          Call SendStats(index)                               
                          Call PlayerMsg(index, "I've increased your HP and Exp", 15)
                          Call putvar(getplayername(index) & ".ini", "QUEST", "quest1", 1)
                        End If
                      Else
                      Call PlayerMsg(index, "Sorry this quest has been completed", 12)
                  End If
            Exit Sub

A BIG thanks to all and DrNova, Mr Fahrenheit.
Link to comment
Share on other sites

@[SB:

> Nubbs aka mR. FahREnhEIT link=topic=40084.msg391656#msg391656 date=1236507070]
> check your spelling on the PutVar/GetVar you are using"\" instead of "/" and missing a few quotes here and there recheck your spelling and this should work

Its supposed to be \
Link to comment
Share on other sites

nice script and nice topic lol this topic has alot of good info in it.. if you post it in the script database make sure you tell people it takes godlords inventory script to run.. you could also tell people how to alter this script so they can use the same .ini for each one time quest , good job
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...