Notorius Posted March 27, 2023 Posted March 27, 2023 how do i make this work? I want to add a drop to mvp custom that gives it a rateof 1% - script satan -1,{ OnNPCKillEvent: if ( !getmonsterinfo( killedgid, MOROCK ) ) end; if ( getcharid(1) ) { getpartymember getcharid(1), 1; getpartymember getcharid(1), 2; for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/ .@partymemberaid[.@c] = $@partymemberaid[.@i]; .@c++; } } getitem 45018, 1, .@partymemberaid[ rand( .@c ) ]; announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedgid, MOROCK ) +" at "+ strcharinfo(3), 0; } else { getitem 45018, 1; announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedgid, MOROCK ) +" at "+ strcharinfo(3), 0; } end; } Quote
0 Racaae Posted March 31, 2023 Posted March 31, 2023 (edited) 18 minutes ago, Notorius said: - script satan -1,{ OnNPCKillEvent: if ( getmonsterinfo( killedrid, MOB_ID) != 31001 ) end; if ( getcharid(1) ) { getpartymember getcharid(1), 1; getpartymember getcharid(1), 2; for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/ .@partymemberaid[.@c] = $@partymemberaid[.@i]; .@c++; } } getitem 45018, 1, .@partymemberaid[ rand( .@c ) ]; announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } else { getitem 45018, 1; announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } end; } Hi, the script is working fine here. Try changing that line to: if ( killedrid != 31001 ) end; - script satan -1,{ OnNPCKillEvent: if ( killedrid != 1002 ) end; if ( getcharid(1) ) { getpartymember getcharid(1), 1; getpartymember getcharid(1), 2; for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/ .@partymemberaid[.@c] = $@partymemberaid[.@i]; .@c++; } } getitem 45018, 1, .@partymemberaid[ rand( .@c ) ]; announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } else { getitem 45018, 1; announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } end; } Edited March 31, 2023 by Racaae missing info Quote
0 Notorius Posted March 28, 2023 Author Posted March 28, 2023 i made it almost work now the problem is that the slaves that invoke the mvp also give the reward what can i do to fix it? - script satan -1,{ OnNPCKillEvent: if ( !getmonsterinfo( killedgid, 31001 ) ) end; if ( getcharid(1) ) { getpartymember getcharid(1), 1; getpartymember getcharid(1), 2; for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/ .@partymemberaid[.@c] = $@partymemberaid[.@i]; .@c++; } } getitem 45018, 1, .@partymemberaid[ rand( .@c ) ]; announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } else { getitem 45018, 1; announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } end; } Quote
0 Racaae Posted March 28, 2023 Posted March 28, 2023 Hi, You need to fix your getmonsterinfo. If you want this to trigger only for a specific mvp, you have two options: if ( getmonsterinfo( killedrid, MOB_NAME ) != "Wounded Morocc" ) end; or if ( getmonsterinfo( killedrid, MOB_ID) != 31001 ) end; If you want this to trigger for ANY mvp: if ( !getmonsterinfo( killedrid, MOB_MVPEXP ) ) end; Quote
0 Notorius Posted March 29, 2023 Author Posted March 29, 2023 7 hours ago, Racaae said: Hi, You need to fix your getmonsterinfo. If you want this to trigger only for a specific mvp, you have two options: if ( getmonsterinfo( killedrid, MOB_NAME ) != "Wounded Morocc" ) end; or if ( getmonsterinfo( killedrid, MOB_ID) != 31001 ) end; If you want this to trigger for ANY mvp: if ( !getmonsterinfo( killedrid, MOB_MVPEXP ) ) end; https://prnt.sc/yRgj90bqgX1F now i get this error Quote
0 Racaae Posted March 31, 2023 Posted March 31, 2023 On 3/29/2023 at 3:57 AM, Notorius said: https://prnt.sc/yRgj90bqgX1F now i get this error Share your script here please Quote
0 Notorius Posted March 31, 2023 Author Posted March 31, 2023 On 3/31/2023 at 9:09 AM, Racaae said: Share your script here please - script satan -1,{ OnNPCKillEvent: if ( getmonsterinfo( killedrid, MOB_ID) != 31001 ) end; if ( getcharid(1) ) { getpartymember getcharid(1), 1; getpartymember getcharid(1), 2; for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/ .@partymemberaid[.@c] = $@partymemberaid[.@i]; .@c++; } } getitem 45018, 1, .@partymemberaid[ rand( .@c ) ]; announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } else { getitem 45018, 1; announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } end; } On 3/31/2023 at 9:43 AM, Racaae said: Hi, the script is working fine here. Try changing that line to: if ( killedrid != 31001 ) end; - script satan -1,{ OnNPCKillEvent: if ( killedrid != 1002 ) end; if ( getcharid(1) ) { getpartymember getcharid(1), 1; getpartymember getcharid(1), 2; for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/ .@partymemberaid[.@c] = $@partymemberaid[.@i]; .@c++; } } getitem 45018, 1, .@partymemberaid[ rand( .@c ) ]; announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } else { getitem 45018, 1; announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } end; } It is working thanks now how do I make the item give it with a rate of 10% or 15% Quote
0 Racaae Posted March 31, 2023 Posted March 31, 2023 16 minutes ago, Notorius said: It is working thanks now how do I make the item give it with a rate of 10% or 15% Use rand command before giving the item. Example: - script satan -1,{ OnNPCKillEvent: if ( killedrid != 31001 ) end; if ( getcharid(1) ) { getpartymember getcharid(1), 1; getpartymember getcharid(1), 2; for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/ .@partymemberaid[.@c] = $@partymemberaid[.@i]; .@c++; } } //Party has 10% chance to get the item 45018 if (rand(100) < 10) getitem 45018, 1, .@partymemberaid[ rand( .@c ) ]; announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } else { //Players without party has 15% chance to get the item 45018 if (rand(100) < 15) getitem 45018, 1; announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } end; } 1 Quote
0 Notorius Posted March 31, 2023 Author Posted March 31, 2023 2 hours ago, Racaae said: Use el comando rand antes de dar el artículo. Ejemplo: What should I do so that the item leaves it on the ground and does not fall into the inventory? Quote
0 Racaae Posted March 31, 2023 Posted March 31, 2023 18 minutes ago, Notorius said: What should I do so that the item leaves it on the ground and does not fall into the inventory? Use makeitem instead of getitem. Example: if (rand(100) < 10) { getunitdata killedgid, .@data; makeitem 45018,1, mapid2name(.@data[UMOB_MAPID]),.@data[UMOB_X],.@data[UMOB_Y], true; } Quote
0 hendra814 Posted April 24, 2023 Posted April 24, 2023 (edited) On 3/31/2023 at 12:31 PM, Racaae said: Use makeitem instead of getitem. Example: if (rand(100) < 10) { getunitdata killedgid, .@data; makeitem 45018,1, mapid2name(.@data[UMOB_MAPID]),.@data[UMOB_X],.@data[UMOB_Y], true; } already tried it but it doesn't drop the item. Could you show how to put in the script. Edit: sorry already working, forget to change item reward. Edited April 24, 2023 by hendra814 Quote
Question
Notorius
how do i make this work? I want to add a drop to mvp custom that gives it a rateof 1%
10 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.