Mutate Posted April 14, 2021 Share Posted April 14, 2021 Hi Everyone, I'm trying to implement a condition - if the party member is not within 14 cell of the mvp killer ( that player will not receive a point ) Thank you in advance here is the part of my code OnNPCKillEvent: if( getgmlevel() >= 60 ) end; // if gm.. event wont trigger for ([email protected] = 0; [email protected] < getarraysize(.mvp_id); [email protected] += 3 ) { if( killedrid == .mvp_id[[email protected]] && compare( strcharinfo(3), .maps$[[email protected]/3] ) ) { [email protected] = .mvp_id[[email protected]+1]; [email protected] = .mvp_id[[email protected]+2]; if( .haltevent ) { // temporarily disable while giving away rewards to avoid bugs dispbottom "Event is still giving away rewards. This kill wont not recorded.", 0xff0000; end; } query_sql( "INSERT INTO `mvp_ladder_rank` SET `char_id`='"+ getcharid(0) +"', `name`='"+ strcharinfo(0) +"', `day_kills` = '1', `week_kills` = '1', `month_kills` = '1', `all_kills` = '1' ON DUPLICATE KEY UPDATE `day_kills` = `day_kills` + 1, `week_kills`=`week_kills` + 1, `month_kills` = `month_kills` + 1,`all_kills` = `all_kills` + 1" ); if( !getcharid(1) ) { if(.Option&8 && rand(100) < .chance) { [email protected] = true; for ([email protected] = 0; [email protected] < getarraysize(.solo_reward); [email protected]+=2) getitem .solo_reward[[email protected]], .solo_reward[[email protected]+1]; } if(.Option&16) { #MVPPOINTS += [email protected]; dispbottom "You got "+ [email protected] +" MVP Points. Total: "+ #MVPPOINTS; } if ( [email protected] ) announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and received an item.", bc_all; else announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3), bc_all; } else { if ( rand(100) < .chance ) [email protected] = true; if ( [email protected] ) announce "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and received an item.", bc_all; else announce "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), bc_all; getpartymember getcharid(1), 1; getpartymember getcharid(1), 2; for ( [email protected] = 0; [email protected] < [email protected]; [email protected] ) { if ( isloggedin( [email protected][[email protected]], [email protected][[email protected]] ) ) { [email protected]_online++; if(.Option&16) { attachrid [email protected][[email protected]]; getmapxy ( @map$, @x, @y, BL_PC ); if ( distance([email protected], [email protected], @x, @y) > 15 || @map$ != [email protected]$ ) { #MVPPOINTS += [email protected]; dispbottom "You got "+ [email protected] +" MVP Points. Total: "+ #MVPPOINTS; if ( [email protected] ) announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and received an item.", bc_all; else announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3), bc_all; } else #MVPPOINTS += [email protected] / [email protected]; dispbottom "--------------------------------------------"; dispbottom "You got "+ ([email protected] / [email protected]) +" MVP Points. Total: "+ #MVPPOINTS; dispbottom "--------------------------------------------"; [email protected][[email protected]] = [email protected][[email protected]]; [email protected]; } } } if ( .Option&8 && [email protected] ) { for ([email protected] = 0; [email protected] < getarraysize(.party_reward); [email protected]+=2) getitem .party_reward[[email protected]], .party_reward[[email protected]+1]; } } end; } } end; Quote Link to comment Share on other sites More sharing options...
0 buraquera Posted April 16, 2021 Share Posted April 16, 2021 This script is not complete... Post it full.... Anyway, for what i can see it is already set this way u want if ( distance([email protected], [email protected], @x, @y) > 15 || @map$ != [email protected]$ ) { I dunno where theses scope varibles came from but assuming its getmapxy from mvp killer, it means the party member shouuld be on 14 cells distance and also in the same map (obviously) Quote Link to comment Share on other sites More sharing options...
0 Mutate Posted April 16, 2021 Author Share Posted April 16, 2021 13 hours ago, buraquera said: This script is not complete... Post it full.... Anyway, for what i can see it is already set this way u want if ( distance([email protected], [email protected], @x, @y) > 15 || @map$ != [email protected]$ ) { I dunno where theses scope varibles came from but assuming its getmapxy from mvp killer, it means the party member shouuld be on 14 cells distance and also in the same map (obviously) Unfortunately i cannot share the whole script Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted September 4, 2021 Share Posted September 4, 2021 OnNPCKillEvent: getmapxy([email protected]$, [email protected], [email protected], BL_PC); // <----- YOU MISSED OUT THIS LINE Quote Link to comment Share on other sites More sharing options...
Hi Everyone,
I'm trying to implement a condition
- if the party member is not within 14 cell of the mvp killer ( that player will not receive a point )
Thank you in advance
here is the part of my code
OnNPCKillEvent: if( getgmlevel() >= 60 ) end; // if gm.. event wont trigger for ([email protected] = 0; [email protected] < getarraysize(.mvp_id); [email protected] += 3 ) { if( killedrid == .mvp_id[[email protected]] && compare( strcharinfo(3), .maps$[[email protected]/3] ) ) { [email protected] = .mvp_id[[email protected]+1]; [email protected] = .mvp_id[[email protected]+2]; if( .haltevent ) { // temporarily disable while giving away rewards to avoid bugs dispbottom "Event is still giving away rewards. This kill wont not recorded.", 0xff0000; end; } query_sql( "INSERT INTO `mvp_ladder_rank` SET `char_id`='"+ getcharid(0) +"', `name`='"+ strcharinfo(0) +"', `day_kills` = '1', `week_kills` = '1', `month_kills` = '1', `all_kills` = '1' ON DUPLICATE KEY UPDATE `day_kills` = `day_kills` + 1, `week_kills`=`week_kills` + 1, `month_kills` = `month_kills` + 1,`all_kills` = `all_kills` + 1" ); if( !getcharid(1) ) { if(.Option&8 && rand(100) < .chance) { [email protected] = true; for ([email protected] = 0; [email protected] < getarraysize(.solo_reward); [email protected]+=2) getitem .solo_reward[[email protected]], .solo_reward[[email protected]+1]; } if(.Option&16) { #MVPPOINTS += [email protected]; dispbottom "You got "+ [email protected] +" MVP Points. Total: "+ #MVPPOINTS; } if ( [email protected] ) announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and received an item.", bc_all; else announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3), bc_all; } else { if ( rand(100) < .chance ) [email protected] = true; if ( [email protected] ) announce "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and received an item.", bc_all; else announce "[ System ] : Player ["+ strcharinfo(0) +"] of party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), bc_all; getpartymember getcharid(1), 1; getpartymember getcharid(1), 2; for ( [email protected] = 0; [email protected] < [email protected]; [email protected] ) { if ( isloggedin( [email protected][[email protected]], [email protected][[email protected]] ) ) { [email protected]_online++; if(.Option&16) { attachrid [email protected][[email protected]]; getmapxy ( @map$, @x, @y, BL_PC ); if ( distance([email protected], [email protected], @x, @y) > 15 || @map$ != [email protected]$ ) { #MVPPOINTS += [email protected]; dispbottom "You got "+ [email protected] +" MVP Points. Total: "+ #MVPPOINTS; if ( [email protected] ) announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" and received an item.", bc_all; else announce "[ "+ strcharinfo(0) +" ] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" alone at "+ strcharinfo(3), bc_all; } else #MVPPOINTS += [email protected] / [email protected]; dispbottom "--------------------------------------------"; dispbottom "You got "+ ([email protected] / [email protected]) +" MVP Points. Total: "+ #MVPPOINTS; dispbottom "--------------------------------------------"; [email protected][[email protected]] = [email protected][[email protected]]; [email protected]; } } } if ( .Option&8 && [email protected] ) { for ([email protected] = 0; [email protected] < getarraysize(.party_reward); [email protected]+=2) getitem .party_reward[[email protected]], .party_reward[[email protected]+1]; } } end; } } end;Link to comment
Share on other sites