Repeatable Quest [Update]

Moderator: Moderators

Message
Author
rebirth01
Noob
Noob
Posts: 1
Joined: 24 Jul 2010, 11:37
Noob?: No

Repeatable Quest [Update]

#1 Post by rebirth01 »

Note: I do not have any coding experience. I just learn from what I read (which takes so long). I spent a day reading and trying out my macro for errors--found tons of it--and I got too tired to continue. Can I ask for help? =)

Another note: Following quests example used is the Hode Quest


So, I stumbled upon this http://forums.openkore.com/viewtopic.ph ... 676#p30676, it doesn't work though
and I needed a working macro so badly so I tried coding it myself.

I think the problem with that one is that it doesn't display the correct number of killed monster.
But I found a way on how to get the current number of current quest killed monster.
It is by re-logging your character. So after re-logging, try not to kill anything, and manually enter the macro below (make sure you
add this to your macros.txt:

Code: Select all

 macro checkHodeKilled {
   log Hode=@eval($::questList->{60106}->{missions}->{1127}->{count}) } 
and it displays the number of Hodes killed. But another problem will arise if you kill another hode, the counter will immediately
display 150.

My obstacle now is how to trigger character re-logging and turn-in quest if hode=150 or else continue killing.
I want to try running the automacro in 1 hour intervals, but that will have many flaws, and I can't find a hook for it to trigger.

I am currently writing my code in this flow:
1) check if hode quest is active if yes goto A if no goto B
2) A = checkKillCount ##insert macro re-log character## if < 150 goto C if = 150 goto D
B = getHodeQuest talk to @npc (208 346) then kill hodes return to A ##I still don't know when should this trigger##
3) C = kill some more then return to A ##I still don't know when should this trigger##
4) D = turninHode talk to @npc (208 346) and get another Hode quest

So my main problem is when to trigger certain events (especially determining the kill count).

Please if you have better ideas please help. =)

PS: I wrote a little macro where you can turn-in those Earthworm Peelings in loop until you got less than 25. I don't know if this
already exist, but, here you go. Please, if you can make it better, just go ahead.

Code: Select all

macro turninEP {
   set exclusive 1 # overrides the automacro findslave/master if you have it #
   
   $x = @random ("210","211","212","213","214")
   $y = @random ("341","340","342","344","345")
   
   do move moc_fild17 $x $y
   pause 1  
   
   while (@invamount (Earthworm Peeling) >= 25) as loop
   
   do talk @npc (208 346)
   pause 2
   do talk resp 0
   pause 2
   do talk resp 0
   pause 2
   do talk resp 0
   end loop
}
Edit: I think the problem arises from servertype0.pm sub quest_update_mission_hunt. I have no idea how to debug it.
I'll try contacting the person who updated it.

Edit: Hello again, I found the solution!!

So in my server [iRO Classic] the quest command
  • in console doesn't display the monsters killed correctly.
    I found this thread: http://forums.openkore.com/viewtopic.php?f=55&t=16436 and tried their solution, and it worked!

    I pasted this into my servertype which is 0 [in iRO]. It can be found in \src\Network\receive\ in your openkore trunk.

    Code: Select all

    *parse_quest_update_mission_hunt = *Network::Receive::ServerType0::parse_quest_update_mission_hunt_v2;
    *reconstruct_quest_update_mission_hunt = *Network::Receive::ServerType0::reconstruct_quest_update_mission_hunt_v2;
    
    The console now displays and updates the correct number of monster killed.
    Here is my automacro for repeatable quest, credit to http://forums.openkore.com/viewtopic.ph ... 676#p30676:

    Code: Select all

    automacro checkQuest {
    #   hook packet/quest_update_mission_hunt
       hook target_died
       exclusive 1
       call {
          if (@config(alligatorQuest) != 1 || $.lvl > 80) goto next
          $temp1 = @eval($::questList->{60121}->{missions}->{1271}->{count})
          if ($temp1 == 150) call questAlig
          :end
       }
    }
    macro questAlig {
       set exclusive 1
       do move cmd_fild01 358 254
       pause 1
       do talk @npc (362 256)
       pause 1
       do talk @npc (362 256)
       pause 2
       do talk resp 0
       pause 2
       do talk resp 1
       pause 2
       do talk resp 2
       :end
    }
    Now, my bots are turning-in the quest once they hit the required monsters to kill.
    I hope this helps.

    Note: It may not work to all servers as I read from the thread, but just try it. And just don't forget to configure the code to your corresponding
    repeatable quest.

randomguy
Human
Human
Posts: 24
Joined: 02 Jan 2014, 09:10
Noob?: No

Re: Repeatable Quest [Update]

#2 Post by randomguy »

i just have to say excellent post man!!!

everything people could need to get their turn in quests working, helped me out a bunch. the part were openkore finally gives the kill count correctly is like a BOOM mind blowing :lol:

OppaStyle
Noob
Noob
Posts: 1
Joined: 22 Jan 2015, 09:47
Noob?: Yes

Re: Repeatable Quest [Update]

#3 Post by OppaStyle »

checkQuest.call error: error in 0:
@eval($::questList->{62680}->{missions}->{1372}->{count}) fail

how to fix it

my macro
automacro checkQuest {
hook packet/quest_update_mission_hunt
exclusive 1
call {
$temp1 = @eval($::questList->{62680}->{missions}->{1372}->{count})
if ($temp1 == 150) call questAlig
}
}

macro questAlig {
set exclusive 1
do move geffen 71 79
pause 1
do talk @npc (74 79) c c r1 c r0 c r5 c n
pause 2
do talk @npc (74 79) c c r0 c r5 c r0 c n
:end
}

Historm
Human
Human
Posts: 27
Joined: 01 Jun 2011, 01:59
Noob?: No

Re: Repeatable Quest [Update]

#4 Post by Historm »

sub quest_update_mission_hunt {
my ($self, $args) = @_;

my ($questID, $mobID, $goal, $count) = unpack('V2 v2', substr($args->{RAW_MSG}, 6));
my $quest = \%{$questList->{$questID}};
my $mission = \%{$quest->{missions}->{$mobID}};
$mission->{goal} = $goal;
$mission->{count} = $count;
debug "- $questID $mobID $count / $goal\n", "info";
Plugins::callHook('quest_update_mission_hunt', {
quest => $quest,
questID => $questID,
mobID => $mobID,
goal => $goal,
count => $count
});
}

Recka
Noob
Noob
Posts: 7
Joined: 02 May 2015, 16:22
Noob?: No

Re: Repeatable Quest [Update]

#5 Post by Recka »

I am planning to post in a new thread, but it seems like I can post here instead.

I need a little help guys. My macro is working thanks for the guide here. I've tried everything so far, but I'm little stuck with the second turn ins.

The macro works great on the first try. It executes everything until it submit the quest. Then, on the 2nd time, whenever my character kills a monster it automatically submit the turn ins! Even I only kill 1 monster! I tried initializing the value of $temp1 and temp2, but no it's still the same.

Here's my macro:

Code: Select all

automacro checkQuest {
   hook packet/quest_update_mission_hunt
#   hook target_died
   exclusive 1
   call {
      if (@config(NovusQuest) != 1 || $.lvl > 80) goto YellowNovus
      $temp1 = @eval($::questList->{62790}->{missions}->{1718}->{count})
      $temp2 = @eval($::questList->{62789}->{missions}->{1715}->{count})

:YellowNovus
      if ($temp1 == 150) goto RedNovus
:RedNovus
      if ($temp2 == 150) goto QuestNovusDone
:QuestNovusDone
   do is Butterfly Wing
   pause 3
   do move hugel 76 148
   pause 1
   do talknpc 67 153 c c r1 r1 n
   pause 2
   call gettingQuest
   stop
}
}

macro gettingQuest {
   set exclusive 1
   do move hugel 76 148
   pause 1
   do talknpc 67 153 c c r0 r2 n
   pause 2
}
My goal on that is to kill the Novus Dragons, then return to the bounty board after both has 150 kills etc.

Here's what I have tried so far with the troubleshooting:
Relogging and take the quest again
Initializing the value of $temp1 and $temp1 (I know this is ridiculous)
Adding the extra line of comments in ServerType0 (mentioned in this thread)

Anything else I forgot? Thanks in advance!

Update:

I also encounter this error whenever I teleport back to the town and submit the turn-ins, then autobuy - autostorage - autosell. It then do this command 'do talknpc 67 153 c c r0 r2 n' and got the error. I dunno why it executes that in the first place. I am sure that the automacro and macro just run perfectly before doing the auto-buy. In short, it just executes that talk npc line after auto-sell. I wonder why? :shock:

Code: Select all

OpenKore version what-will-become-2.1
@ai_seq = NPC macro
Network state = 5
Network handler = Network::DirectConnection
SVN revision: unknown
Loaded plugins:
  plugins/alertsound.pl (alertsound; description: plays sounds on certain events)
  plugins/macro.pl (macro; description: allows usage of macros)

Error message:
Can't call method "name" on an undefined value at src/Task/TalkNPC.pm line 170.

Stack trace:
Can't call method "name" on an undefined value at src/Task/TalkNPC.pm line 170.
 at src/Interface/Wx.pm line 162
	Interface::Wx::mainLoop('Interface::Wx=HASH(0x5dd0c0c)') called at openkore.pl line 97
	main::__start() called at start.pl line 136

Died at this line:
  		$self->setDone();
* 		message TF("Done talking with %s.\n", $self->{target}->name), "ai_npcTalk";
  

pacman
Noob
Noob
Posts: 15
Joined: 19 Aug 2016, 01:39
Noob?: Yes

Re: Repeatable Quest [Update]

#6 Post by pacman »

Recka wrote:I am planning to post in a new thread, but it seems like I can post here instead.

I need a little help guys. My macro is working thanks for the guide here. I've tried everything so far, but I'm little stuck with the second turn ins.

The macro works great on the first try. It executes everything until it submit the quest. Then, on the 2nd time, whenever my character kills a monster it automatically submit the turn ins! Even I only kill 1 monster! I tried initializing the value of $temp1 and temp2, but no it's still the same.

Here's my macro:

Code: Select all

automacro checkQuest {
   hook packet/quest_update_mission_hunt
#   hook target_died
   exclusive 1
   call {
      if (@config(NovusQuest) != 1 || $.lvl > 80) goto YellowNovus
      $temp1 = @eval($::questList->{62790}->{missions}->{1718}->{count})
      $temp2 = @eval($::questList->{62789}->{missions}->{1715}->{count})

:YellowNovus
      if ($temp1 == 150) goto RedNovus
:RedNovus
      if ($temp2 == 150) goto QuestNovusDone
:QuestNovusDone
   do is Butterfly Wing
   pause 3
   do move hugel 76 148
   pause 1
   do talknpc 67 153 c c r1 r1 n
   pause 2
   call gettingQuest
   stop
}
}

macro gettingQuest {
   set exclusive 1
   do move hugel 76 148
   pause 1
   do talknpc 67 153 c c r0 r2 n
   pause 2
}
My goal on that is to kill the Novus Dragons, then return to the bounty board after both has 150 kills etc.

Here's what I have tried so far with the troubleshooting:
Relogging and take the quest again
Initializing the value of $temp1 and $temp1 (I know this is ridiculous)
Adding the extra line of comments in ServerType0 (mentioned in this thread)

Anything else I forgot? Thanks in advance!

Hello I tried your Macro at hugel but the problem is it teleport back to town after 1 kill and redo the quest. How to fix this and must kill both 150 first before it turn back to town? Thanks

Post Reply