Mutate Posted April 14, 2021 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 12 Reputation: 0 Joined: 04/12/21 Last Seen: November 19, 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 (.@i = 0; .@i < getarraysize(.mvp_id); .@i += 3 ) { if( killedrid == .mvp_id[.@i] && compare( strcharinfo(3), .maps$[.@i/3] ) ) { .@solopoints = .mvp_id[.@i+1]; .@partypoints = .mvp_id[.@i+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) { .@annouce = true; for (.@p = 0; .@p < getarraysize(.solo_reward); .@p+=2) getitem .solo_reward[.@p], .solo_reward[.@p+1]; } if(.Option&16) { #MVPPOINTS += .@solopoints; dispbottom "You got "+ .@solopoints +" MVP Points. Total: "+ #MVPPOINTS; } if ( .@annouce ) 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 ) .@chance = true; if ( .@chance ) 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 ( .@q = 0; .@q < $@partymembercount; ++.@q ) { if ( isloggedin( $@partymemberaid[.@q], $@partymembercid[.@q] ) ) { .@count_online++; if(.Option&16) { attachrid $@partymemberaid[.@q]; getmapxy ( @map$, @x, @y, BL_PC ); if ( distance(.@x, .@y, @x, @y) > 15 || @map$ != .@map$ ) { #MVPPOINTS += .@solopoints; dispbottom "You got "+ .@solopoints +" MVP Points. Total: "+ #MVPPOINTS; if ( .@annouce ) 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 += .@partypoints / $@partymembercount; dispbottom "--------------------------------------------"; dispbottom "You got "+ (.@partypoints / $@partymembercount) +" MVP Points. Total: "+ #MVPPOINTS; dispbottom "--------------------------------------------"; .@partymemberaid[.@c] = $@partymemberaid[.@q]; ++.@c; } } } if ( .Option&8 && .@chance ) { for (.@p = 0; .@p < getarraysize(.party_reward); .@p+=2) getitem .party_reward[.@p], .party_reward[.@p+1]; } } end; } } end; Quote Link to comment Share on other sites More sharing options...
0 Emistry Posted September 4, 2021 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted September 4, 2021 OnNPCKillEvent: getmapxy(.@map$, .@x, .@y, BL_PC); // <----- YOU MISSED OUT THIS LINE Quote Link to comment Share on other sites More sharing options...
0 buraquera Posted April 16, 2021 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 68 Reputation: 8 Joined: 05/12/20 Last Seen: April 6 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(.@x, .@y, @x, @y) > 15 || @map$ != .@map$ ) { 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 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 12 Reputation: 0 Joined: 04/12/21 Last Seen: November 19, 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(.@x, .@y, @x, @y) > 15 || @map$ != .@map$ ) { 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...
Question
Mutate
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 (.@i = 0; .@i < getarraysize(.mvp_id); .@i += 3 ) { if( killedrid == .mvp_id[.@i] && compare( strcharinfo(3), .maps$[.@i/3] ) ) { .@solopoints = .mvp_id[.@i+1]; .@partypoints = .mvp_id[.@i+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) { .@annouce = true; for (.@p = 0; .@p < getarraysize(.solo_reward); .@p+=2) getitem .solo_reward[.@p], .solo_reward[.@p+1]; } if(.Option&16) { #MVPPOINTS += .@solopoints; dispbottom "You got "+ .@solopoints +" MVP Points. Total: "+ #MVPPOINTS; } if ( .@annouce ) 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 ) .@chance = true; if ( .@chance ) 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 ( .@q = 0; .@q < $@partymembercount; ++.@q ) { if ( isloggedin( $@partymemberaid[.@q], $@partymembercid[.@q] ) ) { .@count_online++; if(.Option&16) { attachrid $@partymemberaid[.@q]; getmapxy ( @map$, @x, @y, BL_PC ); if ( distance(.@x, .@y, @x, @y) > 15 || @map$ != .@map$ ) { #MVPPOINTS += .@solopoints; dispbottom "You got "+ .@solopoints +" MVP Points. Total: "+ #MVPPOINTS; if ( .@annouce ) 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 += .@partypoints / $@partymembercount; dispbottom "--------------------------------------------"; dispbottom "You got "+ (.@partypoints / $@partymembercount) +" MVP Points. Total: "+ #MVPPOINTS; dispbottom "--------------------------------------------"; .@partymemberaid[.@c] = $@partymemberaid[.@q]; ++.@c; } } } if ( .Option&8 && .@chance ) { for (.@p = 0; .@p < getarraysize(.party_reward); .@p+=2) getitem .party_reward[.@p], .party_reward[.@p+1]; } } end; } } end;
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.