Ok, I couldn't find the Sub ScriptedNPC(index, scripts) so I added it all to the end.
My main.txt now look like;
'********************************
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
Select Case Script
Case 0
If getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "Start_Msg") <> "" Then
If getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", "QUEST", GetPlayerMap(index) ) < 0 Then
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", "QUEST", GetPlayerMap(index), 0 )
End If
status = getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", "QUEST", GetPlayerMap(index))
name=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "name")
Select Case status
Case 0
start_msg=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "Start_Msg")
Call playermsg(index, name & " : " & start_msg, 15)
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", "QUEST", GetPlayerMap(index), 1 )
Case 1
need_count=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "need_count")
count=1
slot=1
has_needed=0
'CHECK FOR ITEMS
Do While count<=Int(need_count)
number=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", count & "_need_num")
value=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", count & "_need_val")
slot=1
Do While slot < 25
If Int(getplayerinvitemnum(index,slot))=Int(number) Then
If Int(getplayerinvitemvalue(index, slot))>=Int(value) Then
has_needed=has_needed+1
slot=25
End If
End If
slot=slot+1
Loop
count=count+1
Loop
'ACTUALLY TAKE ITEMS
If has_needed >= Int(need_count) Then
has_needed=1
count=1
Do While count<=Int(need_count)
number=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", count & "_need_num")
value=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", count & "_need_val")
slot=1
Do While slot < 25
If Int(getplayerinvitemnum(index,slot))=Int(number) Then
If Int(getplayerinvitemvalue(index, slot))>=Int(value) Then
Call quest_Take_Item(index, number, value)
Call Battlemsg(index, name & " removed an item from your inventory.", 15, 0)
slot=25
End If
End If
slot=slot+1
Loop
count=count+1
Loop
Else
has_needed=0
End If
'CHECK IF ITEMS WERE TAKEN
If has_needed = 0 Then
questing_msg=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "Questing_Msg")
Call playermsg(index, name & " : " & questing_msg, 15)
Else
end_msg=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "end_Msg")
Call playermsg(index, name & " : " & end_msg, 15)
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", "QUEST", GetPlayerMap(index), 2 )
Call scriptedNPC(index, 0)
End If
Case 2
'GIVE THE ITEMS AS REWARD, DONT UNLESS ENOUGH SPACE, IF GIVEN BECOME 3
'GET NUMBER OF FREE SLOTS
slot=1
count=0
Do While slot < 25
If Int(getplayerinvitemnum(index,slot))=0 Then
count=count+1
End If
slot=slot+1
Loop
'CHECK ENOUGH SPACE FOR ITEMS BEING GIVEN
give_count=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "give_count")
If Int(count)>=Int(give_count) Then
'GIVE ITEMS
count=1
Do While Int(count)<=Int(give_count)
number=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", count & "_num")
value=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", count & "_val")
durability=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", count & "_dur")
slot=1
Do While slot < 25
If Int(getplayerinvitemnum(index,slot))=0 Then
Call setplayerinvitemdur(index, Int(slot), Int(durability))
Call setplayerinvitemvalue(index, Int(slot), Int(value))
Call setplayerinvitemnum(index, Int(slot), Int(number))
Call sendinventoryupdate(index, slot)
slot=25
Call Battlemsg(index, name & " gives you an item.", 15, 0)
End If
slot=slot+1
Loop
count=count+1
Loop
'ADVANCE TO COMPLETELY FINISHED QUEST
Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", "QUEST", GetPlayerMap(index), 3)
experience=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "experience")
Call battlemsg(index, "Quest Completed! " & experience & " experience gained!", 14, 0)
experience=experience+GetPlayerExp(index)
Call SetPlayerExp(index, Int(experience))
Call sendplayerdata(index)
'MESSAGE FOR NO SPACE
Else
space_msg=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "space_msg")
Call playermsg(index, name & " : " & space_msg, 15)
End If
'MESSAGE FOR COMPLETED QUEST
Case 3
completed_msg=getvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "completed_msg")
Call playermsg(index, name & " : " & completed_msg, 15)
End Select
Else
'ADD REST OF VARIABLES NEEDED TO QUICK GENERATE INI'S AND CREDIT
Call playermsg(index, "No quest found, generating generic quest sript under server\mapextras\" & GetPlayerMap(index) & ".ini", 14)
Call playermsg(index, "This script was coded by Baron,
http://barony.deviantart.com", 14)
Call Playermsg(index, "This script is free to use on any server, but this credit must not be removed.", 14)
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "Start_Msg", "Bring me item X!")
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "Questing_Msg", "Have item X yet?")
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "End_Msg", "Have item X yet?")
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "Completed_Msg", "Thanks for item X!")
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "Space_Msg", "Ill hold this item for you until you have more room.")
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "Name", "The Quest Baron")
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "Experience", 200)
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "need_count", 2)
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "1_need_num", 1)
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "1_need_val", 4)
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "2_need_num", 1)
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "2_need_val", 2)
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "give_count", 2)
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "1_num", 1)
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "1_val", 3)
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "1_dur", 0)
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "2_num", 1)
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "2_val", 1)
Call putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "QUEST", "2_dur", 0)
End If
End Select
End Sub
'********************************
Sub quest_Take_Item(index, number, value)
'********************************
Dim slot
Dim initial
Dim final
Dim taken
slot=1
Do While Int(slot) < 25
If taken <> 1 Then
If Getplayerinvitemnum(index,Int(slot)) = Int(number) Then
If Int(getplayerinvitemvalue(index, Int(slot))) >= Int(value) Then
initial = Int(getplayerinvitemvalue(index, Int(slot) ) )
final = Int(initial) - Int(value)
If Int(final) <= 0 Then
Call setplayerinvitemnum(index, Int(slot), Int(0) )
Call setplayerinvitemvalue(index, Int(slot), Int(0) )
Call setplayerinvitemdur(index, Int(slot), Int(0) )
Call SendInventoryUpdate(index, Int(slot))
taken=1
Else
Call setplayerinvitemvalue(index, Int(slot), Int(final) )
Call SendInventoryUpdate(index, Int(slot) )
taken=1
End If
End If
End If
End If
slot = slot + 1
Loop
End Sub
'********************************
'| INSERT EXTRA SUBS ABOVE HERE |
'********************************
'********************************
Sub testmain(index)
'********************************
Call Playermsg(index, "All your scripts should be working if you recieved this message", 10)
End Sub
'********************************
'| END OF SUPER MAIN |
'|
http://www.barony.deviantart.com |
'********************************
I am just wondering if that is right, because it says all my scripts are working, but when I attack my NPC nothing happens.