Skip to content

Instantly share code, notes, and snippets.

@dancodan
Last active March 19, 2018 20:36
Show Gist options
  • Save dancodan/675f6fd93bf4598bb77ace0fb7e80544 to your computer and use it in GitHub Desktop.
Save dancodan/675f6fd93bf4598bb77ace0fb7e80544 to your computer and use it in GitHub Desktop.
NPC random attack
on('ready',function(){
"use strict";
on('chat:message',function(msg){
var cmd;
if('api' !== msg.type || !playerIsGM(msg.playerid) ){
return;
}
cmd = msg.content.split(/\s+/)[0];
switch(cmd){
case '!obr':
switch(randomInteger(3)){
case 1: sendChat('','!ob 4'); break;
case 2: sendChat('','!ob 3'); break;
case 3: sendChat('','!ob 5'); break;
}
break;
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment