summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-02 21:26:53 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-02 21:26:53 +0000
commit68503609ec28be3fa2c4eb0d66b0ce0ea8815cee (patch)
tree9f8c79c6424a9030baf7b6afce60bdbe2dfb1176 /src/map/script.c
parentcba97f4deb4a9bb62da4ab7748926fd5319090d0 (diff)
downloadhercules-68503609ec28be3fa2c4eb0d66b0ce0ea8815cee.tar.gz
hercules-68503609ec28be3fa2c4eb0d66b0ce0ea8815cee.tar.bz2
hercules-68503609ec28be3fa2c4eb0d66b0ce0ea8815cee.tar.xz
hercules-68503609ec28be3fa2c4eb0d66b0ce0ea8815cee.zip
- Improved the NPC timer system to enable to have multiple timers going on at a time with different players attached to each. Now npc event timers are of two types: attached or global. The global timers don't have a player attached and can be started/halted by anyone. The character timers have a player attached, and they can only be stopped by a script that has the same player attached.
- Now player attached scripts will auto-abort when the atteched player quits the map server. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5167 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/map/script.c b/src/map/script.c
index e7f5996da..76d40d504 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5639,6 +5639,7 @@ int buildin_stopnpctimer(struct script_state *st)
int buildin_getnpctimer(struct script_state *st)
{
struct npc_data *nd;
+ struct map_session_data *sd;
int type=conv_num(st,& (st->stack->stack_data[st->start+2]));
int val=0;
if( st->end > st->start+3 )
@@ -5648,7 +5649,18 @@ int buildin_getnpctimer(struct script_state *st)
switch(type){
case 0: val=npc_gettimerevent_tick(nd); break;
- case 1: val= (nd->u.scr.nexttimer>=0); break;
+ case 1:
+ if (nd->u.scr.rid) {
+ sd = map_id2sd(nd->u.scr.rid);
+ if (!sd) {
+ if(battle_config.error_log)
+ ShowError("buildin_getnpctimer: Attached player not found!\n");
+ break;
+ }
+ val = (sd->npc_timer_id != -1);
+ } else
+ val= (nd->u.scr.timerid !=-1);
+ break;
case 2: val= nd->u.scr.timeramount; break;
}
push_val(st->stack,C_INT,val);