Sub ScriptedNPC(index, Script)On Error Resume nextDim statusDim start_msgDim questing_msgDim end_msgDim completed_msgDim has_neededDim need_countDim give_countDim slotDim countDim foundDim numberDim durabilityDim valueDim experienceDim 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 SelectEnd Sub
'********************************Sub quest_Take_Item(index, number, value)'********************************Dim slotDim initialDim finalDim takenslot=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 LoopEnd Sub
[QUEST]Start_Msg=Bring me a silver key!Questing_Msg=Have you got a silver key yet!?End_Msg=Have you got a silver key ye!?Completed_Msg=You are a brave soul you desrve this...Space_Msg=Looks like you got your hands full... come back laterName=Dungon MasterExperience=200need_count=11_need_num=51_need_val=1give_count=11_num=11_val=301_dur=0
baronCall playermsg(index, "No quest found, generating generic quest sript under server\mapextras\" & GetPlayerMap(index) & ".ini", 14) whats a sript?besides that good script and for the scripted npc...the npc needs to have an attack and hp and stuuf like that to work?(just checking)
at modrob try using the 1st NPC to set it that what I did then it worked for the othersive tryed every thing and it still repeats the question!