Takumirai 1 Posted November 26, 2014 - can anyone help me - script spawn -1,{ OnWhisperGlobal: if (getgroupid() < 2) end; if (@whispervar0$ == "mvp") { mes "Select one:"; next; set .@m, select(.smenu$) - 1; } else { close2; atcommand "@spawn " + .mobid[.@m] + " " + .mobam[.@m]; end; } OnInit: // Spawn ID setarray .mobid[0],1511,1647,1785,1630,1039,1874,1272,1719,1046,1389,1112,1115,1418,1871,1252,1768,1086,1885,1649,1651,1832,1492,1734,1251,1779,1688,1646,1373,1147,1059,1150,1087,1190,1038,1157,1159,1623,1650,1583,1708,1312,1751,1648,1658; // Spawn amount setarray .mobam[0],1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1; set .smenu$,""; for(set .@s,0; .@s < getarraysize(.mobid); set .@s,.@s + 1) { // Skips an Monster if it does not exist in the db if (getmonsterinfo(.mobid[.@s],0) == "" || getmonsterinfo(.mobid[.@s],0) == "null") { debugmes .n$ + ": Mob ID " + .mobid[.@s] + " is not a valid ID."; deletearray .mobid[.@s],1; deletearray .mobam[.@s],1; deletearray .mobze[.@s],1; continue; } // else adding it to the menu set .smenu$,.smenu$ + "- "+getmonsterinfo(.mobid[.@s],0) + ( (.mobid[.@s+1] == 0)?"":":"); } end; } - the script dont state what's the error in the script - when i pm mvp nothing happens - thanks in advance Quote Share this post Link to post Share on other sites
0 GmOcean 92 Posted November 26, 2014 if (@whispervar0$ == "mvp") { mes "Select one:"; next; set .@m, select(.smenu$) - 1; } else { close2; atcommand "@spawn " + .mobid[.@m] + " " + .mobam[.@m]; end;} You're telling the script to check if you typed mvp. If you did, it's going to make you choose a menu option. After that, because you have the " else " statement, it's going to skip that and go straight to OnInit: label and and do everything else all over again. Just change the bit of code I copied from there, and change to this: if (@whispervar0$ == "mvp") { mes "Select one:"; next; .@m = select(.smenu$) - 1; close2; atcommand "@spawn "+ .mobid[.@m] +" "+ .mobam[.@m];}end; Quote Share this post Link to post Share on other sites
0 Takumirai 1 Posted November 26, 2014 (edited) Still can't whisper .. can you make it if I whisper spawn: "mvp" I can spawn mvp in the list and group 3 and above can only whisper it Edited November 28, 2014 by Takumirai Quote Share this post Link to post Share on other sites
0 Takumirai 1 Posted November 28, 2014 Please help thanks Quote Share this post Link to post Share on other sites
0 GmOcean 92 Posted November 28, 2014 Well, you can try this: - script spawn -1,{OnWhisperGlobal: if (getgroupid() < 2) end; if (@whispervar0$ == "mvp") { mes "Select one:"; next; .@m = select(.smenu$) - 1; close2; atcommand "@spawn "+ .mobid[.@m] +" "+ .mobam[.@m]; }end;OnInit:// Spawn IDsetarray .mobid[0],1511,1647,1785,1630,1039,1874,1272,1719,1046,1389,1112,1115,1418,1871,1252,1768,1086,1885,1649,1651,1832,1492,1734,1251,1779,1688,1646,1373,1147,1059,1150,1087,1190,1038,1157,1159,1623,1650,1583,1708,1312,1751,1648,1658;// Spawn amountsetarray .mobam[0],1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1;set .smenu$,"";for(set .@s,0; .@s < getarraysize(.mobid); set .@s,.@s + 1) { // Skips an Monster if it does not exist in the db if (getmonsterinfo(.mobid[.@s],0) == "" || getmonsterinfo(.mobid[.@s],0) == "null") { debugmes .n$ + ": Mob ID " + .mobid[.@s] + " is not a valid ID."; deletearray .mobid[.@s],1; deletearray .mobam[.@s],1; deletearray .mobze[.@s],1; continue; } // else adding it to the menu set .smenu$,.smenu$ + "- "+getmonsterinfo(.mobid[.@s],0) + ( (.mobid[.@s+1] == 0)?"":":");}end;} But honestly, I don't think Hercules has that anymore. Quote Share this post Link to post Share on other sites
0 Takumirai 1 Posted November 28, 2014 I see.. so this wont work on hercules?. I just want to limit my gm staff on spawning mobs on events.. is there an alternative thanks gmocean Quote Share this post Link to post Share on other sites
0 GmOcean 92 Posted November 28, 2014 (edited) You could use bindatcmd to do this: bindatcmd "command","<NPC object name>::<event label>"{,<group level>,<group level char>,<log>}; Here's a version that does what you want for the original @spawn command. It limits it's use for GMs who's groupid() is 3 -> 98. However, if you're GM lvl 99, then you can use @spawn freely like normal. Additionally, if you're groupid() 0->2, then you can't use it at all. - script spawn -1,{OnInit:// Spawn IDssetarray .mobid[0],1511,1647,1785,1630,1039,1874,1272,1719,1046,1389,1112,1115, 1418,1871,1252,1768,1086,1885,1649,1651,1832,1492,1734,1251, 1779,1688,1646,1373,1147,1059,1150,1087,1190,1038,1157,1159, 1623,1650,1583,1708,1312,1751,1648,1658;for (.@i = 0; .@i < getarraysize(.mobid); .@s++) { if (getmonsterinfo(.mobid[.@i],0) == "" || getmonsterinfo(.mobid[.@i],0) == "null") { debugmes strnpcinfo(3) +": Mob ID ["+ .mobid[.@i] +"] is not a valid ID."; deletearray .mobid[.@i],1; } else { .spawn_menu$ = .spawn_menu$ +"- "+ getmonsterinfo(.mobid[.@i],0) + ((.mobid[.@i+1] == 0)?"":":"); }}bindatcmd "spawn", strnpcinfo(3)+"::OnSpawn";end;OnSpawn:if (getgroupid() < 2) { end; }if (getgroupid() >= 3 && getgroupid() < 99) { mes "Select one monster to spawn."; next; .@select = select(.spawn_menu$) - 1; close2; atcommand "@spawn "+ .mobid[.@select] +" 1";} else { atcommand "@spawn "+ .@atcmd_parameters$[0] +" "+ .@atcmd_parameters$[1];}end; Since, you were making them only able to spawn 1 of those monsters, I got rid of that array, and just made it spawn 1 through the command itself. Edited November 28, 2014 by GmOcean Quote Share this post Link to post Share on other sites
- can anyone help me
- the script dont state what's the error in the script
- when i pm mvp nothing happens
- thanks in advance
Share this post
Link to post
Share on other sites