Mirage Source http://web.miragesource.net/forums/ |
|
Quest help (from m:rpge) http://web.miragesource.net/forums/viewtopic.php?f=201&t=3841 |
Page 1 of 1 |
Author: | Forte [ Mon Jun 16, 2008 11:10 pm ] |
Post subject: | Quest help (from m:rpge) |
Attempted to rip quests out of m:rpge, all started working nice. Quests saved/loaded, quest data attached to Npcs saved/loaded aswell. 'Cept one thing, i can't seem to trigger any quests. So.. heres what I got basically, Code: ' Check for an npc For i = 1 To MAX_MAP_NPCS If MapNpc(GetPlayerMap(index), i).Num > 0 Then If MapNpc(GetPlayerMap(index), i).X = X And MapNpc(GetPlayerMap(index), i).y = y Then If Npc(MapNpc(GetPlayerMap(index), i).Num).QuestID > 0 Then Call StartQuest(index, Npc(MapNpc(GetPlayerMap(index), i).Num).QuestID) End If Code: Sub StartQuest(ByVal index As Long, ByVal QuestID As Long) If Player(index).Char(Player(index).CharNum).CurrentQuest = QuestID And Player(index).Char(Player(index).CharNum).QuestStatus = 2 Then FinishQuest (index) Exit Sub End If If (SetCurrentQuest(index, QuestID, Player(index).Char(Player(index).CharNum)) = True) Then Call SendQuestMessage(index, Quests(QuestID).StartQuestMsg) End If End Sub Anyone wanna help me out here whats wrong or why they arent being trigged would be appreciated |
Author: | Rian [ Mon Jun 16, 2008 11:30 pm ] |
Post subject: | Re: Quest help (from m:rpge) |
Code: If Npc(MapNpc(GetPlayerMap(index), i).Num).QuestID > 0 Then Call StartQuest(index, Npc(MapNpc(GetPlayerMap(index), i).Num).QuestID) End If Put that in your attacknpc sub. I think it works fine if you put it around the part that sends the npcs "say" message |
Author: | Forte [ Mon Jun 16, 2008 11:43 pm ] |
Post subject: | Re: Quest help (from m:rpge) |
blech no luck, any more ideas |
Author: | Ambientiger [ Tue Jun 17, 2008 10:05 am ] |
Post subject: | Re: Quest help (from m:rpge) |
Can't really see anything wrong with it. I take it that you can start/finish a quest just by clicking on an NPC? Code: If MapNpc(GetPlayerMap(index), i).X = X And MapNpc(GetPlayerMap(index), i).y = y Then Are the X's supposed to be upper case, this might cause a problem, but most likely you would have been told about that by the compiler. Code: If (SetCurrentQuest(index, QuestID, Player(index).Char(Player(index).CharNum)) = True) Then Am I right in thinking that SetCurrentQuest should be a Function, and is it in your code? Could you post SetCurrentQuest as well please. |
Author: | Forte [ Tue Jun 17, 2008 2:36 pm ] |
Post subject: | Re: Quest help (from m:rpge) |
yeah the x's are fine like that, just defined as caps. Here's SetCurrentQuest; Code: Function SetCurrentQuest(ByVal index As Long, ByVal QuestID As Long, ByRef Qplayer As PlayerRec) As Boolean
If QuestID > 0 And QuestID < MAX_QUESTS Then If Qplayer.Level >= Quests(QuestID).requiredLevel Then If Qplayer.CurrentQuest = 0 Then Qplayer.CurrentQuest = QuestID Call SetCurrentQuestStatus(index, 1, Qplayer) SetCurrentQuest = True Exit Function Else Call PlayerMsg(index, "You currently have a quest.", Green) End If Else Call PlayerMsg(index, "You are of too low level to start this quest.", Red) End If End If SetCurrentQuest = False End Function Sub SetCurrentQ |
Author: | Ambientiger [ Tue Jun 17, 2008 9:20 pm ] |
Post subject: | Re: Quest help (from m:rpge) |
No answer just yet I'm afraid, just a couple more questions. Is the ByRef passing neccesary further on in the code? surely just using Player(index).Char(Player(index).CharNum).Level etc would work okay, I'm not really familiar with m:RPGe code. And, not so much a question, more of a suggestion on how to find out why it isn't working. You probably already know how to debug, but please, humour me and just check through the following. Without all the code to follow I need to pinpoint the exact area in the code that isn't working; Open the server in the VB IDE and set a Breakpoint on the Call StartQuest(index, Npc(MapNpc(GetPlayerMap(index), i).Num).QuestID) line of code from your first post and run the server in debug mode. Now start up the client and click on an npc that you know has a quest linked to it, the server should now break and pause on the Call to StartQuest. (If the server doesn't break the problem is somewhere else in the code.) Using F8 step through the code and find out at which point in StartQuest or SetCurrentQuest the code fails. Get back to me with the results and we'll take it from there, thnxs. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |