Issue information

Issue ID
#8275
Status
Confirmed
Severity
None
Started
Fluorite
Jul 23, 2014 1:11
Last Post
Garr
Oct 25, 2014 15:03
Confirmation
Yes (1)
No (0)

Fluorite - Jul 23, 2014 1:11

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.
[url="http://img.photobucket.com/albums/v316/Fluorite/screenValkyrie013_zps083f3673.jpg"]http://img.photobucket.com/albums/v316/Fluorite/screenValkyrie013_zps083f3673.jpg[/url]

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:
[code=auto:0] if (monster_race_2_1 == $@mon_race_2_1 && monster_race_2_2 == $@mon_race_2_2) { [/code]
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:
[code=auto:0] 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) { [/code]
A simple inclusion for both possibilities.

Dastgir - Oct 6, 2014 14:11

[indent=1]1) Confirms that the race won't end...(doubt that it happens on single race too)[/indent]

This post has been edited by Dastgir on Oct 6, 2014 14:12

Garr - Oct 24, 2014 20:43

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:[code=auto:1812] 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; [/code]

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

Dastgir - Oct 25, 2014 13:36

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.

This post has been edited by Dastgir on Oct 25, 2014 13:38

Garr - Oct 25, 2014 15:03

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.[code=auto:0] 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; } [/code]