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

A script for my game is having a problem


Sakis
 Share

Recommended Posts

Okay my script is messing up right now and I need some help on this one:

```
' Executes whenever a scripted NPC does an action.
Sub ScriptedNPC(index, Script)
On Error Resume next
Dim status
Dim start_msg
Dim questing_msg
Dim end_msg
Dim completed_msg
Dim has_needed
Dim need_count
Dim give_count
Dim slot
Dim count
Dim found
Dim number
Dim durability
Dim value
Dim experience
Dim name
Dim reqitem
Dim rewitem
Dim reqval
Dim rewval
Dim pm
pm = GetPlayerMap(index)
reqitem = GetVar("Quests\Basic.ini", pm, "reqitemnum")
reqval = GetVar("Quests\Basic.ini", pm, "reqitemval")
rewitem = GetVar("Quests\Basic.ini", pm, "rewitemnum")
rewval = GetVar("Quests\Basic.ini", pm, "rewitemval")
Select Case Script 
    Case 0
        If CheckInventoryForItem(index, reqitem) = true Then
            Call TakeItem(index, reqitem, reqval)

            Call GiveItem(index, rewitem, rewval)
            Call PlayerMsg(index, "Congrats you have completed your quest!", 4)
        Else
            Call PlayerMsg(index, "You don't have the requested item, the Slime Goo.", 4)
        End If
End Select
End Sub

Sub CheckInventoryForItem(index, reqitem)
CheckInventoryForItem = false
SLOT = 1
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = item Then
CheckInventoryForItem = true
SLOT = 24
End If
SLOT = SLOT+1
Loop
End Sub
```
```
Sub TakeItem(index, item, value)
If value = "all" Then
SLOT = 1
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = item Then
Call SetPlayerInvItemNum(index, SLOT, 0)
Call SetPlayerInvItemValue(index, SLOT, 0)
Call SendInventoryUpdate(index, SLOT)
SLOT = 24
End If
SLOT = SLOT+1
Loop
End Sub
Else
SLOT = 1
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = item Then
Call SetPlayerInvItemNum(index, SLOT, 0)
Call SetPlayerInvItemValue(index, SLOT, GetPlayerInvItemValue(index, SLOT) - value)
Call SendInventoryUpdate(index, SLOT)
SLOT = 24
End If
SLOT = SLOT+1
Loop
End Sub
End If

Sub GiveItem(index, item, value)
SLOT = 1
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = 0 Then
Call SetPlayerInvItemNum(index, SLOT, item)
Call SetPlayerInvItemValue(index, SLOT, value)
Call SendInventoryUpdate(index, SLOT)
SLOT = 24
End If
SLOT = SLOT+1
Loop
End Sub
```
it keeps having the npc saying the quest is complete but it don't take the item and i don't receive the reward either
Link to comment
Share on other sites

@ÅÐмiядζ:

> PS: You do have a "Quests" folder and inis in your server folder, right?

yeah i got that and i followed the rule that Godlord put up in the tutorial to make this quest script but for some reason it is not at all working for me…its like all he ever says is quest is complete and i got all the things the way it should be but it is not working at all...is their something wrong with it because it is really annoying that it always happens
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...