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

Can someone fix my script


Davader
 Share

Recommended Posts

well here is my first proper script but doesnt work so can someone help me fix it

This goes on the ScriptedNPC Sub

> Sub ScriptedNPC(Index, Script)
> Select Case Script                                               
> Case 1
> Dim Quest1
>
> Quest1 = GetVar("Quests.ini", getplayername(index), "Quest1")
>                                                              
>     If Quest1 = 0 Then                                 
>     Call PlayerMsg(Index, "Hi there do you see that portal down there?.", WHITE)
>     Call PlayerMsg(Index, "its the portal to the land of oblivian but its failing.", WHITE)
>     Call PlayerMsg(Index, "Could you go and see if everything is ok in oblivian?.", WHITE)
> Call PutVar("Quests.ini", getplayername(index), "Quest5", 1)
> End If
>
> If Quest1 = 2 Then
>       Call PlayerMsg(index, "Take this to Jonathan he's around here ", white)
>       Call GivePlayerItem(index, 46, 1, 1)
>       Call PutVar("Quests.ini", getplayername(index), "Quest1", 3)
>   End If
>   Exit Sub
>  
>   Case 2
>  
>   If Quest1 = 3 Then
>   Call PlayerMsg(index, "Wow i never thought this could ever happen", white)
>   Call PlayerMsg(index, "Im afraid i have to turn off the portal", white)
>   Call PlayerMsg(index, "What???", white)
>   Call PlayerMsg(index, "Its sinking into the ground????", white)
>   Call PlayerMsg(index, "Well i can handle it here heres your reward!", white)
>   Call TakeItem(index, 46, 1, 0)
>   Call GivePlayerItem(index, 48, 1, 1)
>   Call PutVar("Quests.ini", getplayername(index), "Quest1", 4)

And i add this too ScriptedTiles Sub

> Sub ScriptedTile(Index, Script)
> Select Case Script
> Case 0
> Call PutVar("Quests.ini", getplayername(index), "Quest1", 0)
> Exit Sub
>
> Case 1
>   Quest1 = GetVar("Quests.ini", getplayername(index), "Quest1")
>   If Quest1 = 1 Then
>   Call PlayerMsg(index, "There must not be enough power in this thing!", white)
>   Call PlayerMsg(index, "Maby i should tell Judy.", white)
>     Call PutVar("Quests.ini", getplayername(index), "Quest5", 2)
>   End If
>   Exit Sub

ORDER
1:CASE 0 Tile
2:CASE 0 NPC (pt1)
2:CASE 1 Tiile
3:CASE 0 NPC (pt2)
4:CASE 1 NPC

so its four simple steps to fix starting from the first

WHAT IS IT ABOUT
Well first of all my game is called sword of oblivian. The portal to the land of oblivian is failing but no one is sure how it happened so your charachter goes on a mini investigation so you get asked to go and see what is going on but the power is so low that you cant so you have to tell a girl named judy that you cant go in the portal so she sends a letter to a guy named jonathan but jonathan says the only way for to fix it is to shut the portal down (the portal get running at events like halloween and christmass)
Quest ends

but for some reason i cant start the quest thats why i need you guys/girls help please send in the script (fixed) copy into your post (AND DONT POST NEGATIVE COMMENTS)
THNX ALL! :cheesy: :cheesy: :cheesy: :cheesy:
Link to comment
Share on other sites

This'll be how I would do it.. It's offhand and not tested but I believe it should work.

```
Sub ScriptedNPC(Index, Script)
Dim charname
Dim charnum
charname = GetPlayerLogin(index)
charnum = GetPlayerCharNum(index)

  Select Case Script

Case 1
If GetVar("accounts\" & charname & "\char" & charnum & ".ini", "QUESTS", "Quest1") = "2" Then
    Call PlayerMsg(index, "Take this to Jonathan he's around here ", 15)
      Call GivePlayerItem(index, 46, 1, 1)
      Call PutVar("accounts\" & charname & "\char" & charnum & ".ini", "QUESTS", "Quest1", 3)
  ElseIf GetVar("accounts\" & charname & "\char" & charnum & ".ini", "QUESTS", "Quest1") = "0" Then
  Call PlayerMsg(Index, "Hi there do you see that portal down there?.", 15)
    Call PlayerMsg(Index, "its the portal to the land of oblivian but its failing.", 15)
    Call PlayerMsg(Index, "Could you go and see if everything is ok in oblivian?.", 15)
  Call PutVar("accounts\" & charname & "\char" & charnum & ".ini", "QUESTS", "Quest1", 2)
End If
Exit Sub

Case 2
If GetVar("accounts\" & charname & "\char" & charnum & ".ini", "QUESTS", "Quest1") = "3" Then
  Call PlayerMsg(index, "Wow i never thought this could ever happen", 15)
  Call PlayerMsg(index, "Im afraid i have to turn off the portal", 15)
  Call PlayerMsg(index, "What???", 15)
  Call PlayerMsg(index, "Its sinking into the ground????", 15)
  Call PlayerMsg(index, "Well i can handle it here heres your reward!", 15)
  Call TakeItem(index, 46, 1, 0)
  Call GivePlayerItem(index, 48, 1, 1)
  Call PutVar("accounts\" & charname & "\char" & charnum & ".ini", "QUESTS", "Quest1", 2)
End If
Exit Sub

End Select
End Sub
```
Your scripted tiles also have to be changed.

```
Sub ScriptedTile(Index, Script)
Dim charname
Dim charnum
charname = GetPlayerLogin(index)
charnum = GetPlayerCharNum(index)

  Select Case Script
      Case 0
  Call PutVar("accounts\" & charname & "\char" & charnum & ".ini", "QUESTS", "Quest1", 0)
  Exit Sub

      Case 1
  If GetVar("accounts\" & charname & "\char" & charnum & ".ini", "QUESTS", "Quest1") = "1" Then
  Call PlayerMsg(index, "There must not be enough power in this thing!", 15)
  Call PlayerMsg(index, "Maby i should tell Judy.", 15)
    Call PutVar("accounts\" & charname & "\char" & charnum & ".ini", "QUESTS", "Quest1", 2)
  End If
  Exit Sub

  End Select
  End Sub
```
End Select and End Sub should stay on the very end, for all future Select Cases you may have.
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...