| Mirage Source http://web.miragesource.net/forums/ |
|
| Advanced quest system problem... http://web.miragesource.net/forums/viewtopic.php?f=201&t=1219 |
Page 1 of 29 |
| Author: | lordgivemick [ Tue Jan 23, 2007 3:41 pm ] |
| Post subject: | Advanced quest system problem... |
sorry william i couldn't find where to put this hopes this is the right area...well for know its on elysium side and im nto the maker but i fixed it all to work exept this part.... the code is here but thats the unfixed one lol http://splamm.com/elysium/forums/viewtopic.php?t=2760&postdays=0&postorder=asc&start=0 Code: Function DoQuest(ByVal questnum As Long, ByVal index As Long, ByVal npcnum As Long) If ReadINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & Npc(npcnum).Quest, App.Path + "\qflag.ini") = 2 Then Call PlayerMsg(index, "A " & Trim(Npc(npcnum).Name) & " says, '" & Trim(Quest(Npc(npcnum).Quest).After) & "'", SayColor) ElseIf ReadINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & Npc(npcnum).Quest, App.Path + "\qflag.ini") = 1 Then Call SendDataTo(index, "questprompt" & SEP_CHAR & questnum & SEP_CHAR & npcnum & SEP_CHAR & END_CHAR) Else Debug.Print "NOT COMPLETED Quest" Call StartQuest(questnum, index, npcnum) End If End Function Code: Sub SaveLine(File As Integer, Header As String, Var As String, Value As String) Print #File, Var & "=" & Value End Sub Code: Function StartQuest(questnum As Long, index As Long, npcnum As Long) If MeetReq(questnum, index) Then If Quest(questnum).StartOn = 0 Then Call WriteINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & Npc(npcnum).Quest, "1", App.Path + "\qflag.ini") Call PlayerMsg(index, "A " & Trim(Npc(npcnum).Name) & " says, '" & Trim(Quest(Npc(npcnum).Quest).Start) & "'", SayColor) ElseIf Quest(questnum).StartOn = 1 Then Call GiveQuestItem(index, Quest(questnum).StartItem, Quest(questnum).Startval, npcnum) End If Else Call PlayerMsg(index, "A " & Trim(Npc(npcnum).Name) & " says, '" & Trim(Quest(Npc(npcnum).Quest).Before) & "'", SayColor) End If End Function Code: Function MeetReq(questnum As Long, index As Long) As Boolean If Quest(questnum).ClassIsReq = 0 And Quest(questnum).LevelIsReq = 0 Then MeetReq = True Exit Function ElseIf Quest(questnum).ClassIsReq = 1 And Quest(questnum).LevelIsReq = 0 Then If Player(index).Char(Player(index).CharNum).Class = Quest(questnum).ClassReq Then MeetReq = True Exit Function Else MeetReq = False Exit Function End If ElseIf Quest(questnum).ClassIsReq = 0 And Quest(questnum).LevelIsReq = 1 Then If Player(index).Char(Player(index).CharNum).Level >= Quest(questnum).LevelReq Then MeetReq = True Exit Function Else MeetReq = False Exit Function End If ElseIf Quest(questnum).ClassIsReq = 1 And Quest(questnum).LevelIsReq = 1 Then If Player(index).Char(Player(index).CharNum).Class = Quest(questnum).ClassReq And Player(index).Char(Player(index).CharNum).Level >= Quest(questnum).LevelReq Then MeetReq = True Exit Function Else MeetReq = False Exit Function End If End If End Function Code: Sub GiveQuestItem(ByVal index As Long, ByVal ItemNum As Long, ByVal ItemVal As Long, ByVal npcnum As Long) Dim I As Long Dim Curr As Boolean Dim Has As Boolean ' Check for subscript out of range If IsPlaying(index) = False Or ItemNum <= 0 Or ItemNum > MAX_ITEMS Then Exit Sub End If If Item(ItemNum).Type = 12 Then Curr = True Else Curr = False For I = 1 To MAX_INV If Curr = True Then If GetPlayerInvItemNum(index, I) = ItemNum Then Call SetPlayerInvItemValue(index, I, GetPlayerInvItemValue(index, I) + ItemVal) Call SendInventoryUpdate(index, I) Has = True Exit For End If Else If GetPlayerInvItemNum(index, I) = 0 Then Call SetPlayerInvItemNum(index, I, ItemNum) Call SetPlayerInvItemValue(index, I, 1) If (Item(ItemNum).Type = ITEM_TYPE_ARMOR) Or (Item(ItemNum).Type = ITEM_TYPE_WEAPON) Or (Item(ItemNum).Type = ITEM_TYPE_HELMET) Or (Item(ItemNum).Type = ITEM_TYPE_SHIELD) Then Call SetPlayerInvItemDur(index, I, Item(ItemNum).Data1) End If Call SendInventoryUpdate(index, I) Has = True Exit For End If End If Next I If Has = False Then Call PlayerMsg(index, "Your inventory is full. Please come back when it is not", BrightRed) Exit Sub Else Call WriteINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & Npc(npcnum).Quest, "1", App.Path + "\qflag.ini") Call PlayerMsg(index, "A " & Trim(Npc(npcnum).Name) & " says, '" & Trim(Quest(Npc(npcnum).Quest).Start) & "'", SayColor) End If End Sub Code: Sub GiveRewardItem(ByVal index As Long, ByVal ItemNum As Long, ByVal ItemVal As Long, ByVal npcnum As Long)
Dim I As Long Dim Curr As Boolean Dim Has As Boolean ' Check for subscript out of range If IsPlaying(index) = False Or ItemNum <= 0 Or ItemNum > MAX_ITEMS Then Exit Sub End If If Item(ItemNum).Type = 12 Then Curr = True Else Curr = False For I = 1 To MAX_INV If Curr = True Then If GetPlayerInvItemNum(index, I) = ItemNum Then Call SetPlayerInvItemValue(index, I, GetPlayerInvItemValue(index, I) + ItemVal) Call SendInventoryUpdate(index, I) Has = True Exit For End If Else If GetPlayerInvItemNum(index, I) = 0 Then Call SetPlayerInvItemNum(index, I, ItemNum) Call SetPlayerInvItemValue(index, I, 1) If (Item(ItemNum).Type = ITEM_TYPE_ARMOR) Or (Item(ItemNum).Type = ITEM_TYPE_WEAPON) Or (Item(ItemNum).Type = ITEM_TYPE_HELMET) Or (Item(ItemNum).Type = ITEM_TYPE_SHIELD) Then Call SetPlayerInvItemDur(index, I, Item(ItemNum).Data1) End If Call SendInventoryUpdate(index, I) Has = True Exit For End If End If Next I If Has = False Then Call PlayerMsg(index, "Your inventory is full. Please come back when it is not", BrightRed) Exit Sub Else Call PlayerMsg(index, "A " & Trim(Npc(npcnum).Name) & " says, '" & Trim(Quest(Npc(npcnum).Quest).End) & "'", SayColor) Call WriteINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & Npc(npcnum).Quest, "2", App.Path + "/qflag.ini") If Item(Quest(Npc(npcnum).Quest).RewardNum).Type = 12 Then Call TakeItem(index, Quest(Npc(npcnum).Quest).ItemReq, Quest(Npc(npcnum).Quest).ItemVal) Else Call TakeItem(index, Quest(Npc(npcnum).Quest).ItemReq, 1) End If Call SendInventoryUpdate(index, I) End If End Sub |
|
| Author: | William [ Tue Jan 23, 2007 4:02 pm ] |
| Post subject: | |
What does the error say? Hint: use code tags for each sub, easier to read it then. |
|
| Author: | lordgivemick [ Tue Jan 23, 2007 11:56 pm ] |
| Post subject: | |
well its type 13 mismatch error the problem is in the orange Function DoQuest(ByVal questnum As Long, ByVal index As Long, ByVal npcnum As Long) If ReadINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & Npc(npcnum).Quest, App.Path + "\qflag.ini") = 2 Then Call PlayerMsg(index, "A " & Trim(Npc(npcnum).Name) & " says, '" & Trim(Quest(Npc(npcnum).Quest).After) & "'", SayColor) ElseIf ReadINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & Npc(npcnum).Quest, App.Path + "\qflag.ini") = 1 Then Call SendDataTo(index, "questprompt" & SEP_CHAR & questnum & SEP_CHAR & npcnum & SEP_CHAR & END_CHAR) Else Debug.Print "NOT COMPLETED Quest" Call StartQuest(questnum, index, npcnum) End If End Function if thats a problem then the rest like it might be to dont know couldnt figure it out. |
|
| Author: | Matt [ Wed Jan 24, 2007 1:29 am ] |
| Post subject: | |
Okay, then either it's a certain part of that line and you didn't specify, or that value isn't even found, or something along those lines. Why are you using readini anyway? GetVar is much better. |
|
| Author: | lordgivemick [ Wed Jan 24, 2007 1:31 am ] |
| Post subject: | |
becuase i still counldnt figure out how to convert it to get var and put var... its kind of sad lol |
|
| Author: | Matt [ Wed Jan 24, 2007 1:33 am ] |
| Post subject: | |
It's not hard. Just compare a readini call to a getvar call and you'll understand it easily. Trust me, I was the same way at first. I didn't even know get/putvar did the same thing as read/writeini. Lol. |
|
| Author: | lordgivemick [ Wed Jan 24, 2007 3:56 pm ] |
| Post subject: | |
yes that would be nice if it was exactly the same thign but from what ive seen you have to change it a bit and i dont know what to do with it for that part well yes i can change the ini part like readini to getvar. thats easy part hard part is i have no true example to change it with. if you could plz use that first line and change it for me so i have an example to go by. oh and for the stuff you might need to help me wfix the rest is here in this zip. http://www.givemicks.flyserver.biz/spireastuff.zip |
|
| Author: | Tosuxo [ Wed Jan 24, 2007 4:05 pm ] |
| Post subject: | |
Code: Function DoQuest(ByVal questnum As Long, ByVal index As Long, ByVal npcnum As Long)
if getvar(app.path & "\gflag.ini", trim(player(index).char(player(index).charnum).name), "QUEST" & trim(npc(npcnum).quest)) = 2 then Call PlayerMsg(index, "A " & Trim(Npc(npcnum).Name) & " says, '" & Trim(Quest(Npc(npcnum).Quest).After) & "'", SayColor) ElseIf getvar(app.path & "\gflag.ini", trim(player(index).char(player(index).charnum).name), "QUEST" & trim(npc(npcnum).quest)) = 1 then Call SendDataTo(index, "questprompt" & SEP_CHAR & questnum & SEP_CHAR & npcnum & SEP_CHAR & END_CHAR) Else Debug.Print "NOT COMPLETED Quest" Call StartQuest(questnum, index, npcnum) End If End Function i THINK i've changed that to getvar for you... may have made a mistake sorry... i'm doing my accouting essay for uni right now so a lil confused haha, hope it helps |
|
| Author: | lordgivemick [ Thu Jan 25, 2007 12:51 am ] |
| Post subject: | |
thanx that is kind of helpful but it looks liek you only changed the first part lol............. well if its that easy then its done i just change the beginnings with that part lol. well the other problem is hwo can i fix the mixmatch error. |
|
| Author: | Tony [ Thu Jan 25, 2007 12:53 am ] |
| Post subject: | |
Getvar sucks ass :], You know that advo. Lord, learn binary files. Its like 10x faster. Less code also. |
|
| Author: | lordgivemick [ Thu Jan 25, 2007 12:59 am ] |
| Post subject: | |
ahaha...... figured out my problem well trully i found out it was all correct.... <<<<<< and that ini is the fastest thing for what it is going thou since it changes to getvar but uses ini to read it. the problem is i need a qflag.ini which i dont have.... meanign i need help making one. maybe somthign liek this would work... Code: ' ******************** ' * QUEST SYSTEM 1.1 * ' * By Unknown_Raven * ' ******************** Function GetFlagHeight(index, flagnum) Dim X X = GetVar("FLAGS.ini", GetPlayerName(index), "Flag"&flagnum) GetFlagHeight = X End Function Sub RaiseFlag(index, flagnum, height) Call PutVar("FLAGS.ini", GetPlayerName(index), "Flag"&flagnum, GetVar("FLAGS.ini", GetPlayerName(index), "Flag"&flagnum)+height) End Sub Sub LowerFlag(index, flagnum, height) Call PutVar("FLAGS.ini", GetPlayerName(index), "Flag"&flagnum, GetVar("FLAGS.ini", GetPlayerName(index), "Flag"&flagnum)-height) End Sub Sub SetFlag(index, flagnum, height) Call PutVar("FLAGS.ini", GetPlayerName(index), "Flag"&flagnum, 0) Call PutVar("FLAGS.ini", GetPlayerName(index), "Flag"&flagnum, GetVar("FLAGS.ini", GetPlayerName(index), "Flag"&flagnum)+height) 'Call PutVar("FLAGS.ini", GetPlayerName(index), "Flag"&flagnum, height) End Sub 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, GetPlayerInvItemValue(index, SLOT)+value) Call SendInventoryUpdate(index, SLOT) SLOT = 24 End If SLOT = SLOT+1 Loop End Sub Sub TakeItem(index, item) 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 Sub TakeCurrency(index, item, value) SLOT = 1 Do While SLOT < 24 If GetPlayerInvItemNum(index, SLOT) = item Then AMOUNT = GetPlayerInvItemValue(index, SLOT) TAKE = Int(AMOUNT-value) If TAKE <= 0 Then Call SetPlayerInvItemNum(index, SLOT, 0) Call SetPlayerInvItemValue(index, SLOT, 0) Call SendInventoryUpdate(index, SLOT) End If If TAKE > 0 Then Call SetPlayerInvItemNum(index, SLOT, 0) Call SetPlayerInvItemValue(index, SLOT, 0) Call SetPlayerInvItemNum(index, SLOT, item) Call SetPlayerInvItemValue(index, SLOT, TAKE) Call SendInventoryUpdate(index, SLOT) End If SLOT = 24 End If SLOT = SLOT+1 Loop End Sub Function FindItemSlot(index, item) slot = 1 Do While slot <= 24 If GetPlayerInvItemNum(index, Slot) = item Then FindItemSlot = slot slot = 24 Else FindItemSlot = 0 End If slot = slot + 1 Loop End Function Code: Case 0
If GetFlagHeight(index, 1) = 0 Then Call PlayerMsg(index, "quest message", 10) Call RaiseFlag(index, 1, 1) End If If GetFlagHeight(index, 1) = 1 Then Call PlayerMsg(index, "not done message", 10) End If If GetFlagHeight(index, 1) = 2 Then Call PlayerMsg(index, "reward message", 10) If FindItemSlot(index, 0) = 0 Then Call PlayerMsg(index, "inventory full message", 12) Else Call GiveItem(index, 1, 1) Call PlayerMsg(index, "recieve messege", 14) Call RaiseFlag(index, 1, 1) End If End If Case 1 If GetFlagHeight(index, 1) = 1 Then Call PlayerMsg(index, "quest trigger message", 10) Call RaiseFlag(index, 1, 1) End If just an example. i havent the clue if there is one made or if there is somthign that can have its name changed well..help plz. |
|
| Author: | wanai [ Fri May 13, 2022 3:55 am ] |
| Post subject: | Re: Advanced quest system problem... |
Houn |
|
| Author: | wanai [ Fri May 13, 2022 3:56 am ] |
| Post subject: | Re: Advanced quest system problem... |
279.8 |
|
| Author: | wanai [ Fri May 13, 2022 3:58 am ] |
| Post subject: | Re: Advanced quest system problem... |
Duke |
|
| Author: | wanai [ Fri May 13, 2022 3:59 am ] |
| Post subject: | Re: Advanced quest system problem... |
Repr |
|
| Author: | wanai [ Fri May 13, 2022 4:00 am ] |
| Post subject: | Re: Advanced quest system problem... |
Deep |
|
| Author: | wanai [ Fri May 13, 2022 4:01 am ] |
| Post subject: | Re: Advanced quest system problem... |
Wind |
|
| Author: | wanai [ Fri May 13, 2022 4:02 am ] |
| Post subject: | Re: Advanced quest system problem... |
VIII |
|
| Author: | wanai [ Fri May 13, 2022 4:03 am ] |
| Post subject: | Re: Advanced quest system problem... |
Hobs |
|
| Author: | wanai [ Fri May 13, 2022 4:04 am ] |
| Post subject: | Re: Advanced quest system problem... |
Rajn |
|
| Author: | wanai [ Fri May 13, 2022 4:05 am ] |
| Post subject: | Re: Advanced quest system problem... |
Robe |
|
| Author: | wanai [ Fri May 13, 2022 4:06 am ] |
| Post subject: | Re: Advanced quest system problem... |
Harr |
|
| Page 1 of 29 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|