Jump to content

  •  

Bug Tracker Migration

June 3rd
Good news everyone! The staff has decided that it is time to slowly kill off this Bug Tracker. We will begin the process of slowly migrating from this Bug Tracker over to our Github Issues which can be found here: https://github.com/HerculesWS/Hercules/issues

Over the next couple of days, I will be closing off any opportunity to create new reports. However, I still will keep the opportunity to reply to existing Bug Reports. Doing this will allow us to slowly fix any bug reports we have listed here so that we can easily migrate over to our Issue Tracker.

Update - June 7th 2015: Creating new bug posts has been disabled. Please use our https://github.com/HerculesWS/Hercules/issues tracker to post bugs. Users are still able to reply to existing bug posts.

- Administration

Issue Information

  • #008275

  • 0 - None Assigned

  • Confirmed

Issue Confirmations

  • Yes (1)No (0)
Photo

Hugel Dual Monster Race Bugs

Posted by Fluorite on 23 July 2014 - 01:11 AM

1)  The Dual Monster Races never end.  Whenever monsters reach the finish line, they aren't killed off and there's no announcement that they've finished the race.

Example:  This Deviruchi clearly crossed the finish line, but nothing happens.
http://img.photobuck...zps083f3673.jpg

I'm not sure how to fix this, or if it's specific only to the server I'm playing.



2)  Old bug that got carried over from a previous emulator.  To win a Dual Monster Race, you have to pick the two monsters who will cross the finish line first, where order does NOT matter.  However, in monster_race.txt:
if (monster_race_2_1 == $@mon_race_2_1 && monster_race_2_2 == $@mon_race_2_2) {
This code enforces that order DOES matter; The monster you pick first MUST be first place, and the monster you pick second MUST be second place.

The fix is simple though!  Replace the previous line with:
if (monster_race_2_1 == $@mon_race_2_1 && monster_race_2_2 == $@mon_race_2_2) || (monster_race_2_1 == $@mon_race_2_2 && monster_race_2_2 == $@mon_race_2_1) {
A simple inclusion for both possibilities.

1) Confirms that the race won't end...(doubt that it happens on single race too)



changed status to: Confirmed

Found the problem, and it only strikes when monsters are activating the npc. All players have RID, but so do monsters. When they triggered the OnTouchNPC, and then function, first thing first it'd slide down on first command that would check for player's rid, and since it won't find any PLAYER with such rid, it'd stop script.

Long story short:
Add in script detachrid; after OnTouchNPC:
OnTouchNPC:
	detachrid;
	set .@i, MN;
	if ( ! $@mon_race_2_1 ) {
		emotion e_lv;
		specialeffect EF_MVP;
		mapannounce "p_track02","Monster "+.@i+" has reached the Finish Line!",bc_map,"0x66FFCC";
		set $@mon_race_2_1,.@i;
		donpcevent strnpcinfo(0)+"::OnDisable";
	} else {
		emotion e_lv;
		specialeffect EF_MVP;
		mapannounce "p_track02","The race is over! Monster "+.@i+" has reached the Finish Line!",bc_map,"0x66FFCC";
		set $@mon_race_2_2,.@i;
		donpcevent "#poring1::OnDisable";
		donpcevent "#lunatic1::OnDisable";
		donpcevent "#savagebebe1::OnDisable";
		donpcevent "#desertwolf1::OnDisable";
		donpcevent "#deviruchi1::OnDisable";
		donpcevent "#baphomet1::OnDisable";
		donpcevent "TrapGlobal#race02::OnDisable";
		enablenpc "Medal Distributor#medal";
		donpcevent "#race_timer2-3::OnEnable";
	}
	end;

Better to get it fixed in the source, but I couldn't figure out how to with my limited knowledge.

OnTouch: -> Triggers when player comes near
OnTouchNPC: -> Triggers when monsters come near.

and that works fine(atleast when I tested)

I will try to optimize the script.

It's not about triggering. Trigger it does, but when OnTouchNPC triggered with monster, script gets rid attached, which is of monster (monsters have rid too), so it TAKES COMMANDS LIKE THEY ARE TRIGGERED BY SOMEONE WITH RID, aka player. So with first check that will check for rid and use script->rid2sd, it will FAIL. Like getarraysize.
BUILDIN(getarraysize)
{
	struct script_data* data;

	data = script_getdata(st, 2);
	if( !data_isreference(data) )
	{
		ShowError("script:getarraysize: not a variable\n");
		script->reportdata(data);
		script_pushnil(st);
		st->state = END;
		return false;// not a variable
	}

	script_pushint(st, script->array_highest_key(st,st->rid ? script->rid2sd(st) : NULL,reference_getname(data),reference_getref(data)));
	return true;
}