summaryrefslogtreecommitdiff
path: root/npc/custom/Lance
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-07-31 05:37:40 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-07-31 05:37:40 +0000
commit51680d33aa582128f94a6091fba2e203ebba8faa (patch)
treee4e3ac63e0cf1b77468f9d593fcc8cc51638cb17 /npc/custom/Lance
parentb0931e719ce6db2f887e752b1cf55424857a9a1f (diff)
downloadhercules-51680d33aa582128f94a6091fba2e203ebba8faa.tar.gz
hercules-51680d33aa582128f94a6091fba2e203ebba8faa.tar.bz2
hercules-51680d33aa582128f94a6091fba2e203ebba8faa.tar.xz
hercules-51680d33aa582128f94a6091fba2e203ebba8faa.zip
Removed the mob controller system, now a customization (see topic:194375).
The system consists of * script command to spawn a controlled mob * script commands to attach npcs to such mobs and manipulate their AI * a page of documentation for these commands * callbacks at various source code locations that invoke the attached npcs * two npc examples git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13021 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'npc/custom/Lance')
-rw-r--r--npc/custom/Lance/Sentry.cpp135
1 files changed, 0 insertions, 135 deletions
diff --git a/npc/custom/Lance/Sentry.cpp b/npc/custom/Lance/Sentry.cpp
deleted file mode 100644
index 9e6eeb4dd..000000000
--- a/npc/custom/Lance/Sentry.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-//(=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=)
-//( (c)2006 eAthena Development Team presents )
-//( ______ __ __ )
-//( /\ _ \/\ \__/\ \ v 1.00.00 )
-//( __\ \ \_\ \ \ ,_\ \ \___ __ ___ __ )
-//( /'__`\ \ __ \ \ \/\ \ _ `\ /'__`\/' _ `\ /'__`\ )
-//( /\ __/\ \ \/\ \ \ \_\ \ \ \ \/\ __//\ \/\ \/\ \_\.\_ )
-//( \ \____\\ \_\ \_\ \__\\ \_\ \_\ \____\ \_\ \_\ \__/.\_\ )
-//( \/____/ \/_/\/_/\/__/ \/_/\/_/\/____/\/_/\/_/\/__/\/_/ )
-//( _ _ _ _ _ _ _ _ _ _ _ _ _ )
-//( / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ )
-//( ( e | A | t | h | e | n | a ) ( S | c | r | i | p | t ) )
-//( \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ )
-//( )
-//(=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=)
-// Programmed by [Lance] ver. 1.1
-// ---------------------------------------------------------
-// [ Sentry System ]
-// - Guards main towns against aggresive monsters and bad
-// players.
-// [ Customization ]
-// - See OnInit:
-// =========================================================
-
-- script sentry_system -1,{
- function spawn_guardian {
- set .mob_id[getarg(0)], mobspawn("Guardian Sentry",1904,.mob_map$[getarg(0)],.mob_x[getarg(0)],.mob_y[getarg(0)]);
- mobattach .mob_id[getarg(0)]; // Attach events to this script.
- setmobdata .mob_id[getarg(0)], 24, 1; // Enable killer mode.
- setmobdata .mob_id[getarg(0)], 25,
- AI_ACTION_TYPE_DETECT|
- AI_ACTION_TYPE_KILL|
- AI_ACTION_TYPE_UNLOCK|
- AI_ACTION_TYPE_DEAD|
- AI_ACTION_TYPE_ATTACK; // Define engine callback routines.
- setmobdata .mob_id[getarg(0)], 26, 1; // Prevents random walking.
- setmobdata .mob_id[getarg(0)], 10, 1; // Enable AI mode 1.
- getmobdata .mob_id[getarg(0)], .@temp;
- set .@temp[9], .@temp[9]^(0x400&.@temp[9]); // Check and remove MD_CHANGECHASE mode flag.
- setmobdata .mob_id[getarg(0)], 9, .@temp[9];
- return;
- }
-
- function search_entry {
- set .@tmp, getarraysize(getarg(0));
- for(set .@i, 0; .@i < .@tmp; set .@i, .@i + 1){
- if(getelementofarray(getarg(0),.@i) == getarg(1))
- break;
- }
- if(.@i == .@tmp)
- return -1;
- else
- return .@i;
- }
-
- // Script Entry Point - When an event from the script engine is received.
- if(getarraysize(.ai_action) == 4){ // Checks if the data is formatted correctly.
- set .@tmp, search_entry(.mob_id, .ai_action[AI_ACTION_SRC]);
- switch(.ai_action[AI_ACTION_TYPE]){
- case AI_ACTION_TYPE_DETECT: // We see something...
- if(.ai_busy[.@tmp] == 0){ // Not busy
- switch(.ai_action[AI_ACTION_TAR_TYPE]){ // Check what have we here.
- case AI_ACTION_TAR_TYPE_PC: // It's a player
- if(Karma > .karma){ // pkarma is higher?
- unittalk .ai_action[AI_ACTION_SRC], "Who goes there!";
- unitemote .ai_action[AI_ACTION_SRC], e_gasp; // !
- unitattack .ai_action[AI_ACTION_SRC],.ai_action[AI_ACTION_TAR];
- // We're currently busy.
- set .ai_busy[.@tmp], .ai_action[AI_ACTION_TAR];
- }
- break;
- case AI_ACTION_TAR_TYPE_MOB: // It's a monster
- if(.ai_action[AI_ACTION_TAR] != .ai_action[AI_ACTION_SRC]){
- getmobdata .ai_action[AI_ACTION_TAR], .@temp;
- if(.@temp[9]&0x804){ // In Aggressive mode?
- unittalk .ai_action[AI_ACTION_SRC], "Protect the villagers we must!";
- unitemote .ai_action[AI_ACTION_SRC], e_gasp; // !
- unitattack .ai_action[AI_ACTION_SRC],.ai_action[AI_ACTION_TAR];
- // We're currently busy.
- set .ai_busy[.@tmp], .ai_action[AI_ACTION_TAR];
- }
- }
- break;
- }
- }
- break;
- case AI_ACTION_TYPE_KILL: // We eliminated the criminal
- if(.ai_action[AI_ACTION_TAR_TYPE] == AI_ACTION_TAR_TYPE_PC)
- set Karma, 0;
- case AI_ACTION_TYPE_UNLOCK: // Target lost :(
- if(.@tmp != -1){
- set .ai_busy[.@tmp], 0; // Remove him, we're free.
- }
- // Walk back to where we came from.
- unitwalk .ai_action[AI_ACTION_SRC],.mob_x[.@tmp],.mob_y[.@tmp];
- break;
- case AI_ACTION_TYPE_DEAD: // We got killed :(
- if(.ai_action[AI_ACTION_TAR_TYPE] == AI_ACTION_TAR_TYPE_PC){ // Attacker is a player?
- if(Karma < 250)
- set Karma, Karma + 5;
- else
- set Karma, 255;
- }
- sleep 10000; // 10 seconds until reinforcements arrive
- spawn_guardian .@tmp;
- break;
- case AI_ACTION_TYPE_ATTACK: // Someone attacked us
- if(.ai_action[AI_ACTION_TAR_TYPE] == AI_ACTION_TAR_TYPE_PC){ // Attacker is a player?
- if(Karma < 250)
- set Karma, Karma + 1;
- else
- set Karma, 255;
- }
- // The system's AI will auto attack any attackers. So we leave it here.
- break;
- }
- }
- deletearray .ai_action, getarraysize(.ai_action); // Cleans up and frees up memory
- end;
-
-OnInit:
- // Customization ---------------------------------------------------------------------
- setarray .mob_map$, "prt_fild08", "prt_fild05", "prt_fild06", "prt_gld";
- setarray .mob_x,176,369,29,165;
- setarray .mob_y,372,201,187,37;
- set .karma, 5;
- // -----------------------------------------------------------------------------------
- set .@tmp, getarraysize(.mob_map$);
- for(set .@i, 0; .@i < .@tmp; set .@i, .@i + 1){
- spawn_guardian .@i;
- }
- debugmes "[Sentry System] Spawned " + .@i + " guardians.";
- end;
-
-} \ No newline at end of file