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

How to implement quests.


lollicat
 Share

Recommended Posts

First off all go to the script folder in the server folder. Create a folder called Quests.

When you make the quest click to get the code. Now you will see a ton of code. Copy this code…..now go to the server folder....go to scripts...events...then go to scriptednpc.ess......after that paste it after the case you see there but before case else. A case is the script number so make sure you never have duplicate cases.

Now in the editor you chiose the case number, keep q track of this. If the quest is case 1 then you need to create a npc. Set its stats to 1\. Click it to be scripted and set it to script 1\. The scripted npc corresponds to the case number.

I am writing this on my phone so its kinda annoying but if you need more help let me know and I will jump on my computer
Link to comment
Share on other sites

@chiccora:

> First off all go to the script folder in the server folder. Create a folder called Quests.
>
> When you make the quest click to get the code. Now you will see a ton of code. Copy this code…..now go to the server folder....go to scripts...events...then go to scriptednpc.ess......after that paste it after the case you see there but before case else. A case is the script number so make sure you never have duplicate cases.
>
> Now in the editor you chiose the case number, keep q track of this. If the quest is case 1 then you need to create a npc. Set its stats to 1\. Click it to be scripted and set it to script 1\. The scripted npc corresponds to the case number.
>
> I am writing this on my phone so its kinda annoying but if you need more help let me know and I will jump on my computer

Actually, I did exactly that as you instructed, and got an error when trying to talk to the NPC:
"TYPE: Type mismatch: 'ScriptedNPC'
LINE: 1
COLUMN: 0
CODE: (this was blank)"
Link to comment
Share on other sites

Hmm..

Could you please copy and paste your entire Scripted Npc ess file here..I would like to take a look at it.

Here is a sample code:

```
Sub ScriptedNPC(Index, Script)
Select Case Script
Case 0
Call PlayerMsg(Index, "This scripted NPC has no apparent use.", WHITE)

Exit Sub

Case 1

'If the player has not started the quest, start the quest for them. This also prevents errors occuring in the script later on
If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest5" ) = vbNullString Then

'Start the quest for the player by setting their status to 0
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest5", "0")

End If

'If the player level is greater than or equal to the needed player level
If GetPlayerLevel(Index) >= 0 Then

'If the player is not the right class - tell them and then exit
If GetPlayerClass(Index) <> 7 Then

Call PlayerMsg(Index, "Mercachio: You are not the right class to begin this quest!",GREEN)
Exit Sub

End If

'If the player has not started the quest yet
If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest5" ) = "0" Then

'The player has now started the quest and can go onto the next part
Call PlayerMsg(Index, "Mercachio: I am in need of your assistance Paladin. I used to be part of the Holy Union of Paladins but I was recently banished. I was framed in the murder of my wife by a dark knight. I have been exiled from the Sacred City. There is hope though, the Dark Knight resides currently in a cave by the Great Forest. The Dark Knight has an emblem that belongs to the royal family. The emblem has the ability to record events so I am sure it recorded my wife's dead and can prove my innocence..Please help me..", GREEN)

'The player started the quest, set their status to 1
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest5", "1")

'If the player has started the quest and needs to attempt to finish it
ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest5" ) = "1" Then

'If the player has the needed item
If CanTake(Index, 66, 1) = True Then

'If the player does not have enough free slots for items given as rewards
If Not GetFreeSlots(Index) >= 1 Then

'If they can't take the rewards - tell them and exit
Call PlayerMsg(Index, "Mercachio: You don't have enough free slots to take my reward, you need 1 slot(s)!", GREEN)
Exit Sub

End If

'Take the needed item
Call TakeItem(Index, 66, 1)
Call PlayerMsg(Index, "Mercachio: Thank you for getting this " & GetItemName(66) & " for me!", GREEN)

'Give the player the non-stackable reward item
Call GiveItem(Index, 67, 1)
Call PlayerMsg(Index, "Mercachio: Please take this " & GetItemName(67) & "!", GREEN)

'Give the player exp
Call SetPlayerExp(Index, GetPlayerExp(Index) + 185)
Call SendStats(Index)
Call PlayerMsg(Index, "Mercachio: Please take 185 experience for helping me!", GREEN)

'The player has completed the quest
Call PlayerMsg(Index, "Mercachio: Thank you.", GREEN)

'The player has completed the quest, set their status to 2
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest5", "2")

Else

'The player does not have the item
Call PlayerMsg(Index, "Mercachio: We must make haste. I will stock up on supplies, I suggest you do the same. We will meet in a bit by the cave outside the Great Forest.", GREEN)

End If

'If the player has completed the quest and claimed their reward
ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest5" ) = "2" Then

'Tell them they have completed the quest
Call PlayerMsg(Index, "Mercachio: Your heart is pure. You are a great Paladin...Cyrus would have been proud to have you as one of his own. ", GREEN)

End If

End If

Exit Sub

Case Else
Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE)

Exit Sub
End Select
End Sub
```
Make sure you dont delete Case Else at the end there, and just start at Case 1\. Exit sub after each Case is needed too..again let me see your code…make sure there is a "Quest" folder and remember the word is case sensitive..also make sure everything you wrote n the quest editor is correct :)
Link to comment
Share on other sites

```
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Module: ScriptedNPC.ess '
' Author: Stephan J.R. van Schaik '
' Date: August 30th, 2009. '
' Version: 1.0.0 '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: ScriptedNPC '
' Brief: executes when somebody talks to a NPC. '
' Parameters: '
' Index: the index of the player. '
' Script: the script to execute. '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Quest script created using cloudwolf00s Quest Maker (cloudwolf00s Quest Maker is © cloudwolf00 2010)
'You may not remove this or the above credit!
Case 1

'If the player has not started the quest, start the quest for them. This also prevents errors occuring in the script later on
If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = vbNullString Then

'Start the quest for the player by setting their status to 0
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "0")

End If

'If the player level is greater than or equal to the needed player level and less than or equal to the maximum level
If (GetPlayerLevel(Index) >= 0) And (GetPlayerLevel(Index) <= 10) Then

'If the player has not started the quest yet
If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "0" Then

'The player has now started the quest and can go onto the next part
Call PlayerMsg(Index, "Mimi: I am going to help you do an easy quest. I lost an important treasure chest, and I need you to go around and look for it. To pick it up, you can press ENTER on your keyboard.", BLACK)

'The player started the quest, set their status to 1
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "1")

'If the player has started the quest and needs to attempt to finish it
ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "1" Then

'If the player has the needed item
If CanTake(Index, 8, 1) = True Then

'If the player does not have enough free slots for items given as rewards
If Not GetFreeSlots(Index) >= 1 Then

'If they can't take the rewards - tell them and exit
Call PlayerMsg(Index, "Mimi: You don't have a free slot to take my reward, you need one more inventory slot!", BLACK)
Exit Sub

End If

'Take the needed item
Call TakeItem(Index, 8, 1)
Call PlayerMsg(Index, "Mimi: Thank you for getting this " & GetItemName(8) & " for me!", BLACK)

'Give the player the stackable reward item
Call GiveCurrency(Index, 3, 5)
Call PlayerMsg(Index, "Mimi: Please take this " & GetItemName(3) & "!", BLACK)

'Give the player exp
Call SetPlayerExp(Index, GetPlayerExp(Index) + 15)
Call SendStats(Index)
Call PlayerMsg(Index, "Mimi: For helping me, you get 15 experience!", BLACK)

'The player has completed the quest
Call PlayerMsg(Index, "Mimi: Thank goodness! I was just about to panic, as it had my lunch in here...it would be terrible if I had to starve!", BLACK)

'The player has completed the quest, set their status to 2
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "2")

Else

'The player does not have the item
Call PlayerMsg(Index, "Mimi: Please get me " & GetItemName(8) & "!", BLACK)

End If

'If the player has completed the quest and claimed their reward
ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "2" Then

'Tell them they have completed the quest but can do it again
Call PlayerMsg(Index, "Mimi: Now, where did I put that chest...?", BLACK)

'Set the player status back to 0 so that they can do the quest again
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "0")
End If

End If

        Exit Sub

      Case Else
        Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE)

        Exit Sub
  End Select
End Sub

Exit Sub

```
Link to comment
Share on other sites

You pasted over the sub name, looks like. Give this a try:

>! ```
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Module: ScriptedNPC.ess '
' Author: Stephan J.R. van Schaik '
' Date: August 30th, 2009. '
' Version: 1.0.0 '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>! '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: ScriptedNPC '
' Brief: executes when somebody talks to a NPC. '
' Parameters: '
' Index: the index of the player. '
' Script: the script to execute. '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub ScriptedNPC(index, script)
'Quest script created using cloudwolf00s Quest Maker (cloudwolf00s Quest Maker is © cloudwolf00 2010)
'You may not remove this or the above credit!
Case 1
>! 'If the player has not started the quest, start the quest for them. This also prevents errors occuring in the script later on
If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = vbNullString Then
>! 'Start the quest for the player by setting their status to 0
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "0")
>! End If
>! 'If the player level is greater than or equal to the needed player level and less than or equal to the maximum level
If (GetPlayerLevel(Index) >= 0) And (GetPlayerLevel(Index) <= 10) Then
>! 'If the player has not started the quest yet
If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "0" Then
>! 'The player has now started the quest and can go onto the next part
Call PlayerMsg(Index, "Mimi: I am going to help you do an easy quest. I lost an important treasure chest, and I need you to go around and look for it. To pick it up, you can press ENTER on your keyboard.", BLACK)
>! 'The player started the quest, set their status to 1
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "1")
>! 'If the player has started the quest and needs to attempt to finish it
ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "1" Then
>! 'If the player has the needed item
If CanTake(Index, 8, 1) = True Then
>! 'If the player does not have enough free slots for items given as rewards
If Not GetFreeSlots(Index) >= 1 Then
>! 'If they can't take the rewards - tell them and exit
Call PlayerMsg(Index, "Mimi: You don't have a free slot to take my reward, you need one more inventory slot!", BLACK)
Exit Sub
>! End If
>! 'Take the needed item
Call TakeItem(Index, 8, 1)
Call PlayerMsg(Index, "Mimi: Thank you for getting this " & GetItemName(8) & " for me!", BLACK)
>! 'Give the player the stackable reward item
Call GiveCurrency(Index, 3, 5)
Call PlayerMsg(Index, "Mimi: Please take this " & GetItemName(3) & "!", BLACK)
>! 'Give the player exp
Call SetPlayerExp(Index, GetPlayerExp(Index) + 15)
Call SendStats(Index)
Call PlayerMsg(Index, "Mimi: For helping me, you get 15 experience!", BLACK)
>! 'The player has completed the quest
Call PlayerMsg(Index, "Mimi: Thank goodness! I was just about to panic, as it had my lunch in here...it would be terrible if I had to starve!", BLACK)
>! 'The player has completed the quest, set their status to 2
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "2")
>! Else
>! 'The player does not have the item
Call PlayerMsg(Index, "Mimi: Please get me " & GetItemName(8) & "!", BLACK)
>! End If
>! 'If the player has completed the quest and claimed their reward
ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "2" Then
>! 'Tell them they have completed the quest but can do it again
Call PlayerMsg(Index, "Mimi: Now, where did I put that chest...?", BLACK)
>! 'Set the player status back to 0 so that they can do the quest again
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "0")
End If
>! End If
>!         Exit Sub
>!       Case Else
        Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE)
>!         Exit Sub
  End Select
End Sub
>! Exit Sub

```
Link to comment
Share on other sites

@Ballie:

> You pasted over the sub name, looks like. Give this a try:
>
> >! ```
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> ' Module: ScriptedNPC.ess '
> ' Author: Stephan J.R. van Schaik '
> ' Date: August 30th, 2009. '
> ' Version: 1.0.0 '
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> >! '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> ' Function: ScriptedNPC '
> ' Brief: executes when somebody talks to a NPC. '
> ' Parameters: '
> ' Index: the index of the player. '
> ' Script: the script to execute. '
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> Sub ScriptedNPC(index, script)
> 'Quest script created using cloudwolf00s Quest Maker (cloudwolf00s Quest Maker is © cloudwolf00 2010)
> 'You may not remove this or the above credit!
> Case 1
> >! 'If the player has not started the quest, start the quest for them. This also prevents errors occuring in the script later on
> If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = vbNullString Then
> >! 'Start the quest for the player by setting their status to 0
> Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "0")
> >! End If
> >! 'If the player level is greater than or equal to the needed player level and less than or equal to the maximum level
> If (GetPlayerLevel(Index) >= 0) And (GetPlayerLevel(Index) <= 10) Then
> >! 'If the player has not started the quest yet
> If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "0" Then
> >! 'The player has now started the quest and can go onto the next part
> Call PlayerMsg(Index, "Mimi: I am going to help you do an easy quest. I lost an important treasure chest, and I need you to go around and look for it. To pick it up, you can press ENTER on your keyboard.", BLACK)
> >! 'The player started the quest, set their status to 1
> Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "1")
> >! 'If the player has started the quest and needs to attempt to finish it
> ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "1" Then
> >! 'If the player has the needed item
> If CanTake(Index, 8, 1) = True Then
> >! 'If the player does not have enough free slots for items given as rewards
> If Not GetFreeSlots(Index) >= 1 Then
> >! 'If they can't take the rewards - tell them and exit
> Call PlayerMsg(Index, "Mimi: You don't have a free slot to take my reward, you need one more inventory slot!", BLACK)
> Exit Sub
> >! End If
> >! 'Take the needed item
> Call TakeItem(Index, 8, 1)
> Call PlayerMsg(Index, "Mimi: Thank you for getting this " & GetItemName(8) & " for me!", BLACK)
> >! 'Give the player the stackable reward item
> Call GiveCurrency(Index, 3, 5)
> Call PlayerMsg(Index, "Mimi: Please take this " & GetItemName(3) & "!", BLACK)
> >! 'Give the player exp
> Call SetPlayerExp(Index, GetPlayerExp(Index) + 15)
> Call SendStats(Index)
> Call PlayerMsg(Index, "Mimi: For helping me, you get 15 experience!", BLACK)
> >! 'The player has completed the quest
> Call PlayerMsg(Index, "Mimi: Thank goodness! I was just about to panic, as it had my lunch in here...it would be terrible if I had to starve!", BLACK)
> >! 'The player has completed the quest, set their status to 2
> Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "2")
> >! Else
> >! 'The player does not have the item
> Call PlayerMsg(Index, "Mimi: Please get me " & GetItemName(8) & "!", BLACK)
> >! End If
> >! 'If the player has completed the quest and claimed their reward
> ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "2" Then
> >! 'Tell them they have completed the quest but can do it again
> Call PlayerMsg(Index, "Mimi: Now, where did I put that chest...?", BLACK)
> >! 'Set the player status back to 0 so that they can do the quest again
> Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "0")
> End If
> >! End If
> >!         Exit Sub
> >!       Case Else
>         Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE)
> >!         Exit Sub
>   End Select
> End Sub
> >! Exit Sub

> ```

I got the same error, unfortunately.
Link to comment
Share on other sites

Your scriptedNPC.ess should look like this.

```
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Module: ScriptedNPC.ess '
' Author: Stephan J.R. van Schaik '
' Date: August 30th, 2009. '
' Version: 1.0.0 '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: ScriptedNPC '
' Brief: executes when somebody talks to a NPC. '
' Parameters: '
' Index: the index of the player. '
' Script: the script to execute. '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub ScriptedNPC(index, script)
'Quest script created using cloudwolf00s Quest Maker (cloudwolf00s Quest Maker is © cloudwolf00 2010)
'You may not remove this or the above credit!
      Select Case script
            Case 1

'If the player has not started the quest, start the quest for them. This also prevents errors occuring in the script later on
If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = vbNullString Then

'Start the quest for the player by setting their status to 0
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "0")

End If

'If the player level is greater than or equal to the needed player level and less than or equal to the maximum level
If (GetPlayerLevel(Index) >= 0) And (GetPlayerLevel(Index) <= 10) Then

'If the player has not started the quest yet
If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "0" Then

'The player has now started the quest and can go onto the next part
Call PlayerMsg(Index, "Mimi: I am going to help you do an easy quest. I lost an important treasure chest, and I need you to go around and look for it. To pick it up, you can press ENTER on your keyboard.", BLACK)

'The player started the quest, set their status to 1
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "1")

'If the player has started the quest and needs to attempt to finish it
ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "1" Then

'If the player has the needed item
If CanTake(Index, 8, 1) = True Then

'If the player does not have enough free slots for items given as rewards
If Not GetFreeSlots(Index) >= 1 Then

'If they can't take the rewards - tell them and exit
Call PlayerMsg(Index, "Mimi: You don't have a free slot to take my reward, you need one more inventory slot!", BLACK)
Exit Sub

End If

'Take the needed item
Call TakeItem(Index, 8, 1)
Call PlayerMsg(Index, "Mimi: Thank you for getting this " & GetItemName(8) & " for me!", BLACK)

'Give the player the stackable reward item
Call GiveCurrency(Index, 3, 5)
Call PlayerMsg(Index, "Mimi: Please take this " & GetItemName(3) & "!", BLACK)

'Give the player exp
Call SetPlayerExp(Index, GetPlayerExp(Index) + 15)
Call SendStats(Index)
Call PlayerMsg(Index, "Mimi: For helping me, you get 15 experience!", BLACK)

'The player has completed the quest
Call PlayerMsg(Index, "Mimi: Thank goodness! I was just about to panic, as it had my lunch in here...it would be terrible if I had to starve!", BLACK)

'The player has completed the quest, set their status to 2
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "2")

Else

'The player does not have the item
Call PlayerMsg(Index, "Mimi: Please get me " & GetItemName(8) & "!", BLACK)

End If

'If the player has completed the quest and claimed their reward
ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "2" Then

'Tell them they have completed the quest but can do it again
Call PlayerMsg(Index, "Mimi: Now, where did I put that chest...?", BLACK)

'Set the player status back to 0 so that they can do the quest again
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "0")
End If

End If

        Exit Sub

      Case Else
        Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE)

        Exit Sub
  End Select
End Sub

```
Link to comment
Share on other sites

Unbridled rage ensues! >=(

I broke your server, BTW, trying to see what happens. It was only afterwards that I realized that I won't be able to do shit because of the server error. Oops.

There's nothing wrong with the script, though, from what I can see, so it's puzzling.
Link to comment
Share on other sites

I am not sure if Case 0 is an issue, but I did have a problem similar because I did not include that case so just try this, its worth a shot:

```
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Module: ScriptedNPC.ess '
' Author: Stephan J.R. van Schaik '
' Date: August 30th, 2009. '
' Version: 1.0.0 '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: ScriptedNPC '
' Brief: executes when somebody talks to a NPC. '
' Parameters: '
' Index: the index of the player. '
' Script: the script to execute. '
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Select Case Script
Case 0
Call PlayerMsg(Index, "This scripted spell has no apparent use.", WHITE)
Exit Sub
            Case 1

'If the player has not started the quest, start the quest for them. This also prevents errors occuring in the script later on
If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = vbNullString Then

'Start the quest for the player by setting their status to 0
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "0")

End If

'If the player level is greater than or equal to the needed player level and less than or equal to the maximum level
If (GetPlayerLevel(Index) >= 0) And (GetPlayerLevel(Index) <= 10) Then

'If the player has not started the quest yet
If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "0" Then

'The player has now started the quest and can go onto the next part
Call PlayerMsg(Index, "Mimi: I am going to help you do an easy quest. I lost an important treasure chest, and I need you to go around and look for it. To pick it up, you can press ENTER on your keyboard.", BLACK)

'The player started the quest, set their status to 1
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "1")

'If the player has started the quest and needs to attempt to finish it
ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "1" Then

'If the player has the needed item
If CanTake(Index, 8, 1) = True Then

'If the player does not have enough free slots for items given as rewards
If Not GetFreeSlots(Index) >= 1 Then

'If they can't take the rewards - tell them and exit
Call PlayerMsg(Index, "Mimi: You don't have a free slot to take my reward, you need one more inventory slot!", BLACK)
Exit Sub

End If

'Take the needed item
Call TakeItem(Index, 8, 1)
Call PlayerMsg(Index, "Mimi: Thank you for getting this " & GetItemName(8) & " for me!", BLACK)

'Give the player the stackable reward item
Call GiveCurrency(Index, 3, 5)
Call PlayerMsg(Index, "Mimi: Please take this " & GetItemName(3) & "!", BLACK)

'Give the player exp
Call SetPlayerExp(Index, GetPlayerExp(Index) + 15)
Call SendStats(Index)
Call PlayerMsg(Index, "Mimi: For helping me, you get 15 experience!", BLACK)

'The player has completed the quest
Call PlayerMsg(Index, "Mimi: Thank goodness! I was just about to panic, as it had my lunch in here...it would be terrible if I had to starve!", BLACK)

'The player has completed the quest, set their status to 2
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "2")

Else

'The player does not have the item
Call PlayerMsg(Index, "Mimi: Please get me " & GetItemName(8) & "!", BLACK)

End If

'If the player has completed the quest and claimed their reward
ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "2" Then

'Tell them they have completed the quest but can do it again
Call PlayerMsg(Index, "Mimi: Now, where did I put that chest...?", BLACK)

'Set the player status back to 0 so that they can do the quest again
Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "0")
End If

End If

        Exit Sub

      Case Else
        Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE)

        Exit Sub
  End Select
End Sub

```
Add this, hit reload of the scripts in the server and try it with the NPC who is scripted to 1\.
Link to comment
Share on other sites

@chiccora:

> I am not sure if Case 0 is an issue, but I did have a problem similar because I did not include that case so just try this, its worth a shot:
>
> ```
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> ' Module: ScriptedNPC.ess '
> ' Author: Stephan J.R. van Schaik '
> ' Date: August 30th, 2009. '
> ' Version: 1.0.0 '
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> ' Function: ScriptedNPC '
> ' Brief: executes when somebody talks to a NPC. '
> ' Parameters: '
> ' Index: the index of the player. '
> ' Script: the script to execute. '
> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> Select Case Script
> Case 0
> Call PlayerMsg(Index, "This scripted spell has no apparent use.", WHITE)
> Exit Sub
>             Case 1
>
> 'If the player has not started the quest, start the quest for them. This also prevents errors occuring in the script later on
> If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = vbNullString Then
>
> 'Start the quest for the player by setting their status to 0
> Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "0")
>
> End If
>
> 'If the player level is greater than or equal to the needed player level and less than or equal to the maximum level
> If (GetPlayerLevel(Index) >= 0) And (GetPlayerLevel(Index) <= 10) Then
>
> 'If the player has not started the quest yet
> If GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "0" Then
>
> 'The player has now started the quest and can go onto the next part
> Call PlayerMsg(Index, "Mimi: I am going to help you do an easy quest. I lost an important treasure chest, and I need you to go around and look for it. To pick it up, you can press ENTER on your keyboard.", BLACK)
>
> 'The player started the quest, set their status to 1
> Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "1")
>
> 'If the player has started the quest and needs to attempt to finish it
> ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "1" Then
>
> 'If the player has the needed item
> If CanTake(Index, 8, 1) = True Then
>
> 'If the player does not have enough free slots for items given as rewards
> If Not GetFreeSlots(Index) >= 1 Then
>
> 'If they can't take the rewards - tell them and exit
> Call PlayerMsg(Index, "Mimi: You don't have a free slot to take my reward, you need one more inventory slot!", BLACK)
> Exit Sub
>
> End If
>
> 'Take the needed item
> Call TakeItem(Index, 8, 1)
> Call PlayerMsg(Index, "Mimi: Thank you for getting this " & GetItemName(8) & " for me!", BLACK)
>
> 'Give the player the stackable reward item
> Call GiveCurrency(Index, 3, 5)
> Call PlayerMsg(Index, "Mimi: Please take this " & GetItemName(3) & "!", BLACK)
>
> 'Give the player exp
> Call SetPlayerExp(Index, GetPlayerExp(Index) + 15)
> Call SendStats(Index)
> Call PlayerMsg(Index, "Mimi: For helping me, you get 15 experience!", BLACK)
>
> 'The player has completed the quest
> Call PlayerMsg(Index, "Mimi: Thank goodness! I was just about to panic, as it had my lunch in here...it would be terrible if I had to starve!", BLACK)
>
> 'The player has completed the quest, set their status to 2
> Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "2")
>
> Else
>
> 'The player does not have the item
> Call PlayerMsg(Index, "Mimi: Please get me " & GetItemName(8) & "!", BLACK)
>
> End If
>
> 'If the player has completed the quest and claimed their reward
> ElseIf GetVar( "Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1" ) = "2" Then
>
> 'Tell them they have completed the quest but can do it again
> Call PlayerMsg(Index, "Mimi: Now, where did I put that chest...?", BLACK)
>
> 'Set the player status back to 0 so that they can do the quest again
> Call PutVar("Scripts\Quests\" & GetPlayerName(Index) & ".ini", "Quests", "Quest1", "0")
> End If
>
> End If
>
>         Exit Sub
>
>       Case Else
>         Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE)
>
>         Exit Sub
>   End Select
> End Sub

> ```
> Add this, hit reload of the scripts in the server and try it with the NPC who is scripted to 1.

Still getting the error. >:U
Link to comment
Share on other sites

  • 5 months later...
I am having this exact same issue. It is a mismatch type error whenever I try to interact with a scripted NPC. I finally just removed all my quest text and set it to the exact original ScriptedNPC.ess, still getting the error. I can't use a scripted NPC no matter what the code looks. I'm using SE, and I'm starting to think that is where the problem lies. Anyone know what the problem could be any maybe how to fix it?
Link to comment
Share on other sites

@ewielang:

> I am having this exact same issue. It is a mismatch type error whenever I try to interact with a scripted NPC. I finally just removed all my quest text and set it to the exact original ScriptedNPC.ess, still getting the error. I can't use a scripted NPC no matter what the code looks. I'm using SE, and I'm starting to think that is where the problem lies. Anyone know what the problem could be any maybe how to fix it?

This post is extremely old. Your best bet would be to try a new topic.
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...