summaryrefslogtreecommitdiff
path: root/npc/sample/monster_controller.cpp
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-25 13:21:06 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-25 13:21:06 +0000
commit2ba090bd962aed05b059fb64df900fe6004de340 (patch)
treea7b627f77eb2fae2378c46696d8e1905425e60da /npc/sample/monster_controller.cpp
parent952432e5f073fa9d840ff4acdb3abfc53335a5d3 (diff)
downloadhercules-2ba090bd962aed05b059fb64df900fe6004de340.tar.gz
hercules-2ba090bd962aed05b059fb64df900fe6004de340.tar.bz2
hercules-2ba090bd962aed05b059fb64df900fe6004de340.tar.xz
hercules-2ba090bd962aed05b059fb64df900fe6004de340.zip
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6750 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'npc/sample/monster_controller.cpp')
-rw-r--r--npc/sample/monster_controller.cpp126
1 files changed, 126 insertions, 0 deletions
diff --git a/npc/sample/monster_controller.cpp b/npc/sample/monster_controller.cpp
new file mode 100644
index 000000000..7e68d7f7f
--- /dev/null
+++ b/npc/sample/monster_controller.cpp
@@ -0,0 +1,126 @@
+// Variables Logging:
+// 'mc_moblist[] - ID list of mobs
+prontera.gat,180,200,4 script Monster Controller 123,{
+ function display_info {
+ getmobdata getarg(0), '@mob_data;
+ set '@array_size, getarraysize('@mob_data);
+ for(set '@i, 0; '@i < '@array_size; set '@i, '@i + 1){
+ mes '@i + " - " + '@mob_data['@i];
+ }
+ return;
+ }
+
+ function remove_mob {
+ removemob getarg(0);
+ set '@mob_size, getarraysize('mc_moblist);
+ for(set '@i, 0; '@i < '@mob_size; set '@i, '@i + 1){
+ if('mc_moblist['@i] == getarg(0))
+ deletearray 'mc_moblist['@i], 1;
+ }
+ }
+
+ function make_menu {
+ set '@array_size, getarraysize(getarg(0));
+ set '@tmp_str$, "";
+ for(set '@i, 0; '@i < '@array_size; set '@i, '@i + 1){
+ set '@tmp_str$, '@tmp_str$ + 'mc_moblist['@i] + ":";
+ }
+ select '@tmp_str$;
+ return getelementofarray(getarg(0),@menu-1);
+ }
+
+ function summon_mob {
+ set '@mob_size, getarraysize('mc_moblist);
+ set 'mc_moblist['@mob_size], spawnmob("Slave - " + '@mob_size, getarg(0), "prontera.gat", 180, 200);
+ mobattach 'mc_moblist['@mob_size];
+ return;
+ }
+
+ function list_mobs {
+ set '@mob_size, getarraysize('mc_moblist);
+ for(set '@i, 0; '@i < '@mob_size; set '@i, '@i + 1){
+ mes "- " + 'mc_moblist['@i];
+ }
+ return;
+ }
+
+L_MainMenu:
+ mes "[Monster Controller]";
+ mes "Current active monsters:";
+ list_mobs;
+ switch(select("Summon","Remove","Information","Actions")){
+ case 1: // Summon
+ next;
+ mes "[Monster Controller]";
+ mes "Monster ID -";
+ input @mob_id;
+ next;
+ summon_mob @mob_id;
+ goto L_MainMenu;
+ break;
+ case 2: // Remove
+ remove_mob make_menu('mc_moblist);
+ next;
+ goto L_MainMenu;
+ break;
+ case 3: // Information
+ set '@tmp, make_menu('mc_moblist);
+ next;
+ mes "[Monster Info]";
+ display_info '@tmp;
+ next;
+ goto L_MainMenu;
+ break;
+ case 4: // Actions
+ goto L_AttackMenu;
+ break;
+ }
+
+L_AttackMenu:
+ switch(select("Walk","Follow","Attack","Stop","Defend","Talk","Emote","Random Walk","Back")){
+ case 1: // Walk
+ set '@src, make_menu('mc_moblist);
+ input '@x;
+ input '@y;
+ mobwalk '@src,'@x,'@y; // Mode 1: Walk to location.
+ break;
+ case 2: // Follow
+ set '@src, make_menu('mc_moblist);
+ input '@tar;
+ mobwalk '@src, '@tar; // Mode 2: Walk to target.
+ break;
+ case 3: // Attack
+ set '@src, make_menu('mc_moblist);
+ input '@tar;
+ mobattack '@src, '@tar;
+ break;
+ case 4: // Stop
+ set '@src, make_menu('mc_moblist);
+ mobstop '@src;
+ break;
+ case 5: // Defend/Assist
+ set '@src, make_menu('mc_moblist);
+ input '@tar;
+ mobassist '@src, '@tar;
+ break;
+ case 6: // Talk
+ set '@src, make_menu('mc_moblist);
+ input '@text$;
+ mobtalk '@src, '@text$;
+ break;
+ case 7: // Emote
+ set '@src, make_menu('mc_moblist);
+ input '@emote;
+ mobemote '@src, '@emote;
+ break;
+ case 8:
+ set '@src, make_menu('mc_moblist);
+ input '@flag;
+ mobrandomwalk '@src, '@flag;
+ break;
+ case 9:
+ next;
+ goto L_MainMenu;
+ }
+ goto L_AttackMenu;
+} \ No newline at end of file