Nooblebob Posted June 17, 2009 Author Share Posted June 17, 2009 Hey I changed all the stuff the tutorial for it told me to change and it said to attack the NPC and it would give you the options or something.. I attack it and nothing happens… What did I do wrong?Here is my Main.txt the part that I changed.' Executes whenever a scripted NPC does an action.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 nameSelect 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 And this part too at the bottom of it.'********************************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 Link to comment Share on other sites More sharing options...
Soljah Posted June 17, 2009 Share Posted June 17, 2009 Are you setting the NPC to scripted? With the right Case… Link to comment Share on other sites More sharing options...
Nooblebob Posted June 17, 2009 Author Share Posted June 17, 2009 Yes its set to scripted and the tutorial said case 0 so I set it to Scripted and then script 0 Link to comment Share on other sites More sharing options...
Soljah Posted June 17, 2009 Share Posted June 17, 2009 Can you post a link to your entire Main.txt, I can't seam to see anything wrong with it from what you have posted… Link to comment Share on other sites More sharing options...
Nooblebob Posted June 17, 2009 Author Share Posted June 17, 2009 Yeah hold on Link to comment Share on other sites More sharing options...
Nooblebob Posted June 17, 2009 Author Share Posted June 17, 2009 Here is the whole thinghttp://www.mediafire.com/?sharekey=b7d07b7be526b5f08d78a0e555291609e04e75f6e8ebb871 Link to comment Share on other sites More sharing options...
Soljah Posted June 17, 2009 Share Posted June 17, 2009 Have you edited the quests in the .ini files?"Edit the info in the file scripts/mapextras/ MAPNUMBER .iniOnly one quest per map."Also, make sure you've added the necessary files to your server, as mentioned in the OP of Barons Quest topic. Link to comment Share on other sites More sharing options...
Nooblebob Posted June 17, 2009 Author Share Posted June 17, 2009 I need to edit this part? Im sorry…. :sad: I can't really get a grasp on what to edit.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 Link to comment Share on other sites More sharing options...
Admiral Refuge Posted June 17, 2009 Share Posted June 17, 2009 Did you make a new folder in the \Scripts\ directory called "mapextras"? Link to comment Share on other sites More sharing options...
Nooblebob Posted June 17, 2009 Author Share Posted June 17, 2009 No does it just have to be called that? and is it a folder? or a certain type of file? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted June 17, 2009 Share Posted June 17, 2009 @[GrimTech:> Apple link=topic=46543.msg473409#msg473409 date=1245254187]> No does it just have to be called that? and is it a folder? or a certain type of file?You make a folder, called "mapextras" in the Server\Scripts\ directory.How else is it suppose to generate the ini information in the Server\Scripts\mapextras directory, if that directory isn't there XD Link to comment Share on other sites More sharing options...
Nooblebob Posted June 17, 2009 Author Share Posted June 17, 2009 is it just a plain folder named mapextras? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted June 17, 2009 Share Posted June 17, 2009 @[GrimTech:> Apple link=topic=46543.msg473413#msg473413 date=1245254433]> is it just a plain folder named mapextras?Yes!Just make a folder called "mapextras" in the Server\Scripts\ directory! Link to comment Share on other sites More sharing options...
Nooblebob Posted June 17, 2009 Author Share Posted June 17, 2009 Ok sorry I made that and charextras… But its still not working =[Can you find anything else that im doing wrong? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted June 17, 2009 Share Posted June 17, 2009 @[GrimTech:> Apple link=topic=46543.msg473422#msg473422 date=1245255293]> Ok sorry I made that and charextras… But its still not working =[> Can you find anything else that im doing wrong?Have you added any other scripts besides this one, to your Main.txt? Link to comment Share on other sites More sharing options...
Nooblebob Posted June 17, 2009 Author Share Posted June 17, 2009 No I haven't I made a backup of the main.txt though.. :P Link to comment Share on other sites More sharing options...
Admiral Refuge Posted June 17, 2009 Share Posted June 17, 2009 @[GrimTech:> Apple link=topic=46543.msg473431#msg473431 date=1245255767]> No I haven't I made a backup of the main.txt though.. :PReplace your Main.txt with this one:```' Eclipse Evolution 2.7 Scripting File' Global VariablesPublic GameNamePublic MAX_MAPSPublic MOTD' Color ConstantsPublic Const BLACK = 0Public Const BLUE = 1Public Const GREEN = 2Public Const CYAN = 3Public Const RED = 4Public Const MAGENTA = 5Public Const BROWN = 6Public Const GREY = 7Public Const DARKGREY = 8Public Const BRIGHTBLUE = 9Public Const BRIGHTGREEN = 10Public Const BRIGHTCYAN = 11Public Const BRIGHTRED = 12Public Const PINK = 13Public Const YELLOW = 14Public Const WHITE = 15' Admin ConstantsPublic Const ADMIN_MONITER = 1Public Const ADMIN_MAPPER = 2Public Const ADMIN_DEVELOPER = 3Public Const ADMIN_CREATOR = 4' Executes when the server initially loads.Sub OnServerLoad() GameName = GetVar("Data.ini", "CONFIG", "GameName") MAX_MAPS = GetVar("Data.ini", "MAX", "MAX_MAPS") MOTD = GetVar("MOTD.ini", "MOTD", "Msg")End Sub' Executes when the scripts are reloaded.Sub OnScriptReload() GameName = GetVar("Data.ini", "CONFIG", "GameName") MAX_MAPS = GetVar("Data.ini", "MAX", "MAX_MAPS") MOTD = GetVar("MOTD.ini", "MOTD", "Msg")End Sub' Executes the MOTD is changed by the client.Sub ChangeMOTD() MOTD = GetVar("MOTD.ini", "MOTD", "Msg")End Sub' Executes when a new character is created.Sub OnNewChar(Index, CharNum)End Sub' Executes every second, based on the server time.Sub TimedEvent(Hours, Minutes, Seconds) If Minutes = 0 Then If Seconds = 0 Then Call AdminMsg("Don't forget to vote for Eclipse.", YELLOW) End If End IfEnd Sub' Executes when a player presses the CONTROL key.Sub OnAttack(Index, Damage) Dim Target If Int(Damage) > 0 Then If Int(GetPlayerTarget(Index)) > 0 Then Target = GetPlayerTarget(Index) Call DamagePlayer(Index, Target, Damage) Else Target = GetPlayerTargetNpc(Index) Call DamageNPC(Index, Target, Damage) End If End IfEnd SubSub OnArrowHit(Index, Damage) Dim Target If Int(Damage) > 0 Then If Int(GetPlayerTarget(Index)) > 0 Then Target = GetPlayerTarget(Index) Call DamagePlayer(Index, Target, Damage) Else Target = GetPlayerTargetNpc(Index) Call DamageNPC(Index, Target, Damage) End If End IfEnd SubSub PlayerHit(Index, NPCNum, Damage) If Damage > 0 Then Call NPCAttack(NPCNum, Index, Damage) End IfEnd Sub' Executes when a hotkey is pressed client-side.Sub HotScript(Index, KeyID) Select Case KeyID ' Executes when any player presses the PageUp key. Case 1 ' Executes when any player presses the Delete key. Case 2 ' Executes when players press the End key. Case 3 ' Executes when players press the PageDown key. Case 4 End SelectEnd Sub' Executes when something on a custom menu is clicked.Sub MenuScripts(Index, Clicked_Index, Menu_Type) Dim MenuTitle Dim FieldMessage MenuTitle = GetPlayerMenuClickTitle(Index) FieldMessage = GetPlayerMenuClickMsg(Index) Select Case Menu_Type Case 1 Call PlayerMsg(Index, "Clicked picture number " & Clicked_Index & " on the menu named " & MenuTitle, YELLOW) Case 2 Call PlayerMsg(Index, "Clicked field number " & Clicked_Index & " on the menu named " & MenuTitle & ". The field text was " & FieldMessage, YELLOW) Case 3 Call PlayerMsg(Index, "Clicked label number " & Clicked_Index & " on the menu named " & MenuTitle, YELLOW) End SelectEnd Sub' Executes when a player logs into the game.Sub JoinGame(Index) If GetPlayerAccess(Index) = 0 Then Call GlobalMsg(GetPlayerName(Index) & " has joined " & GameName & "!", GREY) Else Call GlobalMsg("Administrator " & GetPlayerName(Index) & " has joined " & GameName & "!", YELLOW) End If Call PlayerMsg(Index, "Welcome to " & GameName & "!", WHITE) If LenB(MOTD) <> 0 Then Call PlayerMsg(Index, "MOTD: " & MOTD, BRIGHTCYAN) End If Call SendWhosOnline(Index)End Sub' Executes when a player logs out of the game.Sub LeftGame(Index) If GetPlayerAccess(Index) = 0 Then Call GlobalMsg(GetPlayerName(Index) & " has left " & GameName & "!", GREY) Else Call GlobalMsg("Administrator " & GetPlayerName(Index) & " has left " & GameName & "!", YELLOW) End IfEnd Sub' Executes when a players experience exceeds the next level requirement.Sub PlayerLevelUp(Index) Dim TotalExp Do While GetPlayerExp(Index) >= GetPlayerNextLevel(Index) TotalExp = GetPlayerExp(Index) - GetPlayerNextLevel(Index) Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 1) Call SetPlayerExp(Index, TotalExp) Loop Call BattleMsg(Index, "You have " & GetPlayerPOINTS(Index) & " stat points.", BRIGHTBLUE, 0)End Sub' Executes when a player uses one of the points given on an attribute to level up.Sub UsingStatPoints(Index, PointType) Select Case PointType Case 0 If GetPlayerSTR(Index) + 1 > 1000 Then Call BattleMsg(Index, "You have maxed your strength!", BRIGHTRED, 0) Exit Sub End If Call SetPlayerSTR(Index, GetPlayerSTR(Index) + 1) Call BattleMsg(Index, "You have gained more strength!", WHITE, 0) Case 1 If GetPlayerDEF(Index) + 1 > 1000 Then Call BattleMsg(Index, "You have maxed your defence!", BRIGHTRED, 0) Exit Sub End If Call SetPlayerDEF(Index, GetPlayerDEF(Index) + 1) Call BattleMsg(Index, "You have gained more defense!", WHITE, 0) Case 2 If GetPlayerMAGI(Index) + 1 > 1000 Then Call BattleMsg(Index, "You have maxed your magic!", BRIGHTRED, 0) Exit Sub End If Call SetPlayerMAGI(Index, GetPlayerMAGI(Index) + 1) Call BattleMsg(Index, "You have gained more magic!", WHITE, 0) Case 3 If GetPlayerSPEED(Index) + 1 > 1000 Then Call BattleMsg(Index, "You have maxed your speed!", BRIGHTRED, 0) Exit Sub End If Call SetPlayerSPEED(Index, GetPlayerSPEED(Index) + 1) Call BattleMsg(Index, "You have gained more speed!", WHITE, 0) End Select ' Remove one point after the sub in question is done Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) - 1)End Sub' Executes when a player steps onto a scripted tile.Sub ScriptedTile(Index, Script) Select Case Script Case 0 Call PlayerMsg(Index, "This scripted tile has no apparent use.", WHITE) Exit Sub Case Else Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub' Executes when a player clicks on an OnClick tile.Sub OnClick(Index, Script) Select Case Script Case 0 Call PlayerMsg(Index, "This scripted tile has no apparent use.", WHITE) Exit Sub Case Else Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub' Out-dated: Executes when a player chooses yes or no on a player prompt.Sub PlayerPrompt(Index, Prompt, Value) If Prompt = 6 Then Select Case Value Case 0 Call GlobalMsg("Hi This is a Yes answer!", CYAN) Case 1 Call GlobalMsg("This is case 1?", CYAN) End Select Else Select Case Value Case 0 Call GlobalMsg("Hi This is a No answer!", RED) Case 1 Call GlobalMsg("This is no case 1?", RED) End Select End IfEnd Sub' Out-dated: Executes query box responses.Sub QueryBox(Index, Prompt) Value = GetVar("responses.ini", "Responses", CStr(Index))End Sub' Executes every time a player drops an item.Sub OnItemDrop(Index, Map, ItemNum, ItemVal, ItemDur, ItemIndex, InvSlot)End Sub' Executes each time a player changes map.Sub OnMapLoad(Index, OldMap, NewMap)End Sub' Executes whenever an NPC is killed.' Note: Death occurs as normal externally to this script.Sub OnNPCDeath(Index, Map, NPCNum, NPCIndex) Call BattleMsg(Index, "You killed a " & GetNpcName(NPCNum) & ".", BRIGHTRED, 0)End Sub' Executes when a player is killed by another.' Note: Death occurs as normal externally to this script.Sub OnPVPDeath(Attacker, Victim) Call GlobalMsg(GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker), BRIGHTRED)End Sub' Executes when a player dies in an arena by another player.Sub OnArenaDeath(Attacker, Victim) Dim Map Dim X Dim Y Dim Data1 Dim Data2 Dim Data3 Map = GetPlayerMap(Victim) X = GetPlayerX(Victim) Y = GetPlayerY(Victim) Call GlobalMsg(GetPlayerName(Victim) & " has been defeated in the arena by " & GetPlayerName(Attacker), BRIGHTRED) Call SetPlayerHP(Victim, GetPlayerMaxHP(Victim)) Call SetPlayerMP(Victim, GetPlayerMaxMP(Victim)) Call SendHP(Victim) Call SendMP(Victim) Data1 = GetTileData1(Map, X, Y) Data2 = GetTileData2(Map, X, Y) Data3 = GetTileData3(Map, X, Y) Call PlayerWarp(Victim, Data1, Data2, Data3)End Sub' Executes whenever a player casts a scripted spell.Sub ScriptedSpell(Index, Script) Select Case Script Case 0 Call PlayerMsg(Index, "This scripted spell has no apparent use.", WHITE) Exit Sub Case Else Call PlayerMsg(Index, "No spell script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub' Executes whenever a scripted NPC does an action.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 nameSelect 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' Executed whenever a slash command is sent to the server.Sub Commands(Index) Dim TextSay Dim PlayerID Dim MapNum ' Get the command and arguments from the cache. TextSay = Trim(GetVar("Scripts\Command.ini", "TEMP", "Text" & Index)) ' Split the command into an array. All arguments are seperated by spaces. TextSay = Split(TextSay) Select Case TextSay(0) Case "/testscripts" Call TestMain(Index) Exit Sub Case "/help" Call PlayerMsg(Index, "Social Commands:", WHITE) Call PlayerMsg(Index, "'msghere = Broadcast Message", WHITE) Call PlayerMsg(Index, "-msghere = Emote Message", WHITE) Call PlayerMsg(Index, "!namehere msghere = Player Message", WHITE) Call PlayerMsg(Index, "Available Commands: /help, /info, /who, /fps, /inv, /stats, /train, /party, /join, /leave, /refresh", WHITE) Exit Sub Case "/calladmins" If GetPlayerAccess(Index) = 0 Then Call AdminMsg(GetPlayerName(Index) & " needs your help!", BRIGHTGREEN) Else Call PlayerMsg(Index, "You are an admin! You cannot call for help!", BRIGHTGREEN) End If Exit Sub Case "/admin" If GetPlayerAccess(Index) > 0 Then Call PlayerMsg(Index, "Social Commands:", WHITE) Call PlayerMsg(Index, """msghere = Global Admin Message", WHITE) Call PlayerMsg(Index, "=msghere = Private Admin Message", WHITE) Call PlayerMsg(Index, "Available Commands: /admin, /loc, /mapeditor, /warpmeto, /warptome, /warpto, /setsprite, /mapreport, /kick, /ban, /edititem, /respawn, /editnpc, /motd, /editshop, /ban, /editspell", WHITE) End If Exit Sub Case "/warpmeto" If GetPlayerAccess(Index) > 0 Then PlayerID = FindPlayer(TextSay(1)) If PlayerID > 0 Then Call PlayerWarp(Index, GetPlayerMap(PlayerID), GetPlayerX(PlayerID), GetPlayerY(PlayerID)) Call PlayerMsg(Index, "You have been warped to " & GetPlayerName(PlayerID) & ".", BROWN) Else Call PlayerMsg(Index, "Player is not online.", WHITE) End If End If Exit Sub Case "/warptome" If GetPlayerAccess(Index) > 0 Then PlayerID = FindPlayer(TextSay(1)) If PlayerID > 0 Then Call PlayerWarp(PlayerID, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index)) Call PlayerMsg(PlayerID, "You have been warped to " & GetPlayerName(Index) & ".", BROWN) Else Call PlayerMsg(Index, "Player is not online.", WHITE) End If End If Exit Sub Case "/warpto" If GetPlayerAccess(Index) > 0 Then MapNum = TextSay(1) If MapNum > 0 And MapNum <= MAX_MAPS Then Call PlayerWarp(Index, MapNum, GetPlayerX(Index), GetPlayerY(Index)) Call PlayerMsg(Index, "You have been warped to map #" & MapNum & ".", BRIGHTBLUE) Else Call PlayerMsg(Index, "Invalid map number.", BRIGHTRED) End If End If Exit Sub End Select Call PlayerMsg(Index, "That is not a valid command.", BRIGHTRED)End Sub' Executes on death, dropping all of the players items.Sub DropItems(Index) ' Remove this to enable. Exit Sub If GetPlayerWeaponSlot(Index) > 0 Then Call PlayerMapDropItem(Index, GetPlayerWeaponSlot(Index), 0) End If If GetPlayerArmorSlot(Index) > 0 Then Call PlayerMapDropItem(Index, GetPlayerArmorSlot(Index), 0) End If If GetPlayerHelmetSlot(Index) > 0 Then Call PlayerMapDropItem(Index, GetPlayerHelmetSlot(Index), 0) End If If GetPlayerShieldSlot(Index) > 0 Then Call PlayerMapDropItem(Index, GetPlayerShieldSlot(Index), 0) End If If GetPlayerLegsSlot(Index) > 0 Then Call PlayerMapDropItem(Index, GetPlayerLegsSlot(Index), 0) End If If GetPlayerRingSlot(Index) > 0 Then Call PlayerMapDropItem(Index, GetPlayerRingSlot(Index), 0) End If If GetPlayerNecklaceSlot(Index) > 0 Then Call PlayerMapDropItem(Index, GetPlayerNecklaceSlot(Index), 0) End IfEnd Sub' Executes whenever somebody dies outside of an arena.Sub OnDeath(Index) Dim MapNum Dim ClassID Dim X Dim Y If GetMapBootMap(Index) > 0 Then Call PlayerWarp(Index, GetMapBootMap(Index), GetMapBootX(Index), GetMapBootY(Index)) Else ClassID = GetPlayerClass(Index) MapNum = GetVar("Classes\Class" & ClassID & ".ini", "CLASS", "Map") X = GetVar("Classes\Class" & ClassID & ".ini", "CLASS", "x") Y = GetVar("Classes\Class" & ClassID & ".ini", "CLASS", "y") Call PlayerWarp(Index, MapNum, X, Y) End IfEnd Sub' Executes whenever a scripted item is used or double clicked.Sub ScriptedItem(Index, Script) Select Case Script Case 0 Call PlayerMsg(Index, "This scripted item has no apparent use.", WHITE) Exit Sub Case Else Call PlayerMsg(Index, "No item script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub' Map AttributesSub SetBlank(Map, X, Y) Call SetAttribute(Map, X, Y, 0, 0, 0, 0, "", "", "")End SubSub SetBlock(Map, X, Y) Call SetAttribute(Map, X, Y, 1, 0, 0, 0, "", "", "")End SubSub SetWarp(Map, X, Y, WarpMap, WarpX, WarpY) Call SetAttribute(Map, X, Y, 2, WarpMap, WarpX, WarpY, "", "", "")End SubSub SetItem(Map, X, Y, ItemID, ItemValue) Call SetAttribute(Map, X, Y, 3, ItemID, ItemValue, 0, "", "", "")End SubSub SetNPCAvoid(Map, X, Y) Call SetAttribute(Map, X, Y, 4, 0, 0, 0, "", "", "")End SubSub SetKeY(Map, X, Y, KeyID, KeyTake) Call SetAttribute(Map, X, Y, 5, KeyID, KeyTake, 0, "", "", "")End SubSub SetKeYOpen(Map, X, Y, KeyX, KeyY, Message) Call SetAttribute(Map, X, Y, 6, KeyX, KeyY, 0, Message, "", "")End SubSub SetHeal(Map, X, Y) Call SetAttribute(Map, X, Y, 7, 0, 0, 0, "", "", "")End SubSub SetKill(Map, X, Y) Call SetAttribute(Map, X, Y, 8, 0, 0, 0, "", "", "")End SubSub SetShop(Map, X, Y, ShopID) Call SetAttribute(Map, X, Y, 9, ShopID, 0, 0, "", "", "")End SubSub SetClassBlock(Map, X, Y, Allow1, Allow2, Allow3) Call SetAttribute(Map, X, Y, 10, Allow, Allow2, Allow3, "", "", "")End SubSub SetArena(Map, X, Y, MapID, NewX, NewY) Call SetAttribute(Map, X, Y, 11, MapID, NewX, NewY, "", "", "")End SubSub SetSound(Map, X, Y, FileName) Call SetAttribute(Map, X, Y, 12, 0, 0, 0, FileName, "", "")End SubSub SetSpriteChange(Map, X, Y, SpriteID, ItemID, Cost) Call SetAttribute(Map, X, Y, 13, SpriteID, ItemID, Cost, "", "", "")End SubSub SetSign(Map, X, Y, Line1, Line2, Line3) Call SetAttribute(Map, X, Y, 14, 0, 0, 0, Line1, Line2, Line3)End SubSub SetDoor(Map, X, Y) Call SetAttribute(Map, X, Y, 15, 0, 0, 0, "", "", "")End SubSub SetNotice(Map, X, Y, Title, Text, FileName) Call SetAttribute(Map, X, Y, 16, 0, 0, 0, Title, Text, FileName)End SubSub SetScripted(Map, X, Y, Script) Call SetAttribute(Map, X, Y, 18, Script, 0, 0, "", "", "")End SubSub SetBank(Map, X, Y) Call SetAttribute(Map, X, Y, 23, 0, 0, 0, "", "", "")End 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' Tests scripts up to the location of Sub TestMain(Index).' Leave this sub at the bottom to test the entire script file.Sub TestMain(Index) Call PlayerMsg(Index, "Scripts are working properly.", BRIGHTGREEN)End Sub```Go into your Server Control Panel tab, and make sure it says "Scripts: ON".Hit "Reload Scripts" (make sure you save the main.txt first).After that, follow the instructions in Baron's topic for using it (with that scripted npc, etc). Link to comment Share on other sites More sharing options...
Nooblebob Posted June 17, 2009 Author Share Posted June 17, 2009 Ok I did but still nothing is happening… Link to comment Share on other sites More sharing options...
Admiral Refuge Posted June 17, 2009 Share Posted June 17, 2009 @[GrimTech:> Apple link=topic=46543.msg473443#msg473443 date=1245257085]> Ok I did but still nothing is happening…Hmm… Did you give your Scripted NPC atleast 1 of every stat? Link to comment Share on other sites More sharing options...
Nooblebob Posted June 17, 2009 Author Share Posted June 17, 2009 No should I give him like 1 strength speed range hp and mp? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted June 17, 2009 Share Posted June 17, 2009 @[GrimTech:> Apple link=topic=46543.msg473457#msg473457 date=1245258284]> No should I give him like 1 strength speed range hp and mp?Yea. Link to comment Share on other sites More sharing options...
Nooblebob Posted June 17, 2009 Author Share Posted June 17, 2009 Ok I gave him a little bit of everything including EXP but it wont let me give him speed and magic.. Link to comment Share on other sites More sharing options...
Nooblebob Posted June 17, 2009 Author Share Posted June 17, 2009 0/\/\ G I GOT IT TO WORK! Thank you so much!!!! Admiral you are a legend!!! ;) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now