summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2016-05-02 16:17:50 -0400
committermekolat <mekolat@users.noreply.github.com>2016-05-02 16:17:50 -0400
commitf8924867ee3e1020cb9fc73df98c22218a52ad2f (patch)
tree22bde1b4723e9a653722afd898354c3ef422e034
parent2f97a15b49bf8c43ff9761e058b1a19a13856067 (diff)
parent3ad45c53e32f0700f68c429fd818372d9892c6d8 (diff)
downloadserverdata-f8924867ee3e1020cb9fc73df98c22218a52ad2f.tar.gz
serverdata-f8924867ee3e1020cb9fc73df98c22218a52ad2f.tar.bz2
serverdata-f8924867ee3e1020cb9fc73df98c22218a52ad2f.tar.xz
serverdata-f8924867ee3e1020cb9fc73df98c22218a52ad2f.zip
Merge pull request #492 from mekolat/puppet-checks
Puppet checks
-rw-r--r--world/map/npc/001-2/wizards.txt21
-rw-r--r--world/map/npc/008-1/annualeaster.txt8
-rw-r--r--world/map/npc/029-2/alchemy.txt2
-rw-r--r--world/map/npc/055-1/pumpkins.txt7
-rw-r--r--world/map/npc/commands/numa.txt2
-rw-r--r--world/map/npc/magic/level1-summon-maggots.txt1
-rw-r--r--world/map/npc/magic/level2-arrow-hail.txt1
-rw-r--r--world/map/npc/magic/level2-rain.txt1
-rw-r--r--world/map/npc/magic/level2-summon-fluffies.txt3
-rw-r--r--world/map/npc/magic/level2-summon-mouboo.txt3
-rw-r--r--world/map/npc/magic/level2-summon-pinkie.txt3
-rw-r--r--world/map/npc/magic/level2-summon-snakes.txt3
-rw-r--r--world/map/npc/magic/level2-summon-spiky-mushroom.txt3
-rw-r--r--world/map/npc/magic/level2-summon-wickedmushroom.txt3
14 files changed, 37 insertions, 24 deletions
diff --git a/world/map/npc/001-2/wizards.txt b/world/map/npc/001-2/wizards.txt
index 3c7d6ecf..e51e7a66 100644
--- a/world/map/npc/001-2/wizards.txt
+++ b/world/map/npc/001-2/wizards.txt
@@ -11,16 +11,15 @@
close;
OnInit:
- void
- puppet("001-2", 104, 19, "Desert Mana Seed#_M", 166),
- puppet("001-2", 99, 22, "Wizard#1", 355),
- puppet("001-2", 92, 24, "Wizard#2", 356),
- puppet("001-2", 92, 30, "Wizard#3", 357),
- puppet("001-2", 99, 32, "Wizard#4", 358),
- puppet("001-2", 110, 22, "Wizard#5", 359),
- puppet("001-2", 117, 24, "Wizard#6", 360),
- puppet("001-2", 117, 30, "Wizard#7", 361),
- puppet("001-2", 110, 32, "Wizard#8", 362),
- puppet("001-2", 104, 27, "Arch-Wizard#9", 354);
+ if (puppet("001-2", 104, 19, "Desert Mana Seed#_M", 166) < 1) mapexit;
+ if (puppet("001-2", 99, 22, "Wizard#1", 355) < 1) mapexit;
+ if (puppet("001-2", 92, 24, "Wizard#2", 356) < 1) mapexit;
+ if (puppet("001-2", 92, 30, "Wizard#3", 357) < 1) mapexit;
+ if (puppet("001-2", 99, 32, "Wizard#4", 358) < 1) mapexit;
+ if (puppet("001-2", 110, 22, "Wizard#5", 359) < 1) mapexit;
+ if (puppet("001-2", 117, 24, "Wizard#6", 360) < 1) mapexit;
+ if (puppet("001-2", 117, 30, "Wizard#7", 361) < 1) mapexit;
+ if (puppet("001-2", 110, 32, "Wizard#8", 362) < 1) mapexit;
+ if (puppet("001-2", 104, 27, "Arch-Wizard#9", 354) < 1) mapexit;
end;
}
diff --git a/world/map/npc/008-1/annualeaster.txt b/world/map/npc/008-1/annualeaster.txt
index 1ec95cbe..23d7611a 100644
--- a/world/map/npc/008-1/annualeaster.txt
+++ b/world/map/npc/008-1/annualeaster.txt
@@ -129,10 +129,14 @@ OnSpawn:
set .@y, .loc[(.@e-1)+.loc[1]];
set .eID, .eID + 1; // give the egg an id
set .@name$, "#--Ee"+chr(3)+.eID;
- void puppet(strnpcinfo(3), .@x, .@y, .@name$, 375); // spawn the egg
- initnpctimer .@name$; // init puppeteer check timer
if (.eID == 2147483647)
set .eID, 0; // start over if id = 0x7FFFFFFF
+ if (puppet(strnpcinfo(3), .@x, .@y, .@name$, 375) < 1) goto L_RetrySpawn; // spawn the egg
+ initnpctimer .@name$; // init puppeteer check timer
+ end;
+
+L_RetrySpawn:
+ addnpctimer 0, strnpcinfo(0) + "::OnSpawn"; // schedule a spawn
end;
S_Spawn:
diff --git a/world/map/npc/029-2/alchemy.txt b/world/map/npc/029-2/alchemy.txt
index b5e4732c..98ca845b 100644
--- a/world/map/npc/029-2/alchemy.txt
+++ b/world/map/npc/029-2/alchemy.txt
@@ -74,7 +74,7 @@ S_Spawn:
if (.spawned >= .@s)
goto S_Return;
set .@n$, "#_Al-lab"+chr(3)+.spawned;
- void puppet(.m$[.spawned], .x1[.spawned], .y1[.spawned], .@n$, 400); // TODO: make a npc like npc 400 but with hoverCursor="action" => looks better for things like crafting
+ if (puppet(.m$[.spawned], .x1[.spawned], .y1[.spawned], .@n$, 400) < 1) mapexit; // TODO: make a npc like npc 400 but with hoverCursor="action" => looks better for things like crafting
set .spawned, .spawned + 1;
if (.spawned < .@s)
goto S_Spawn;
diff --git a/world/map/npc/055-1/pumpkins.txt b/world/map/npc/055-1/pumpkins.txt
index 1c2535f7..87dfca4c 100644
--- a/world/map/npc/055-1/pumpkins.txt
+++ b/world/map/npc/055-1/pumpkins.txt
@@ -83,6 +83,8 @@ OnReallyDestroy:
S_MakeNode:
set .nID, .nID + 1; // give the node an id
set .@name$, "#_Pkin" + chr(3) + .nID;
+ if (.nID == 2147483647)
+ set .nID, 0; // start over if id = 0x7FFFFFFF
goto S_FindXY;
S_FindXY:
@@ -94,13 +96,13 @@ S_FindXY:
S_ReallySpawn:
set .@p, puppet(.m$[.i], .@x, .@y, .@name$, 32767); // spawn the node (but not on map, because 32767)
+ if (.@p < 1) goto S_MakeNode; // silently retry
disablenpc .@name$; // make sure it can't be clicked by guessing the being id
set .i, .i, .@p; // tell the puppet what object contains it
set .death_t, rand(.death_t/2, .death_t), .@p; // tell the puppet when to die
set .@timer, if_then_else(.done_initial[.i], rand(.appear_t/2, .appear_t), 0); // timer depends on if first spawn or if respawned after death
addnpctimer .@timer, .@name$+"::OnAppear"; // we spawn the node instantly but it only appears after the timer
- if (.nID == 2147483647)
- set .nID, 0; // start over if id = 0x7FFFFFFF
+ set .nodes[.i], .nodes[.i] + 1;
return;
S_IterateObjects:
@@ -112,7 +114,6 @@ S_IterateObjects:
if (.nodes[.i] >= .max_nodes[.i])
goto S_NextObject;
- set .nodes[.i], .nodes[.i] + 1;
callsub S_MakeNode;
if (.nodes[.i] < if_then_else(.done_initial[.i], .min_nodes[.i], .max_nodes[.i]))
goto S_IterateObjects;
diff --git a/world/map/npc/commands/numa.txt b/world/map/npc/commands/numa.txt
index e8e8cabd..78746a26 100644
--- a/world/map/npc/commands/numa.txt
+++ b/world/map/npc/commands/numa.txt
@@ -90,7 +90,7 @@ L_Close:
OnInit:
registercmd chr(ATCMD_SYMBOL) + "numa", strnpcinfo(0);
registercmd chr(ATCMD_SYMBOL) + "superdebug", strnpcinfo(0);
- void puppet("017-9", 30, 28, "Numa", 393);
+ if (puppet("017-9", 30, 28, "Numa", 393) < 1) mapexit;
end;
}
diff --git a/world/map/npc/magic/level1-summon-maggots.txt b/world/map/npc/magic/level1-summon-maggots.txt
index aa4e646f..49022635 100644
--- a/world/map/npc/magic/level1-summon-maggots.txt
+++ b/world/map/npc/magic/level1-summon-maggots.txt
@@ -18,6 +18,7 @@ OnCast:
callfunc "magic_exp";
set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
+ if (.@puppet < 1) end;
set .count, ((sqrt(@spellpower)+(@spellpower/15))/5)+1, .@puppet;
set .master, BL_ID, .@puppet;
set .lifetime, (@spellpower*50)+10000, .@puppet;
diff --git a/world/map/npc/magic/level2-arrow-hail.txt b/world/map/npc/magic/level2-arrow-hail.txt
index c7deb852..35cd584e 100644
--- a/world/map/npc/magic/level2-arrow-hail.txt
+++ b/world/map/npc/magic/level2-arrow-hail.txt
@@ -32,6 +32,7 @@ OnCast:
callfunc "magic_exp";
misceffect FX_MAGIC_BLACK, strcharinfo(0);
set @spell_npc, puppet(getmap(), POS_X, POS_Y, @new_npc_name$, 127); // clone npc => get puppet id
+ if (@spell_npc < 1) end;
set .max_hit, (@spellpower / 8), @spell_npc; // set .max_hit in the puppet
set .caster, getcharid(3), @spell_npc; // tell the puppet who controls it
set .damage, 125, @spell_npc;
diff --git a/world/map/npc/magic/level2-rain.txt b/world/map/npc/magic/level2-rain.txt
index 9a498c08..9e62782d 100644
--- a/world/map/npc/magic/level2-rain.txt
+++ b/world/map/npc/magic/level2-rain.txt
@@ -29,6 +29,7 @@ OnCast:
callfunc "magic_exp";
misceffect FX_MAGIC_GREEN, strcharinfo(0);
set @spell_npc, puppet(getmap(), POS_X, POS_Y, @new_npc_name$, 127); // clone npc => get puppet id
+ if (@spell_npc < 1) end;
set .caster, getcharid(3), @spell_npc; // tell the puppet who controls it
set .radius, @krad, @spell_npc; // this is also used by ingrav, don't rename
set .initial_x, POS_X, @spell_npc;
diff --git a/world/map/npc/magic/level2-summon-fluffies.txt b/world/map/npc/magic/level2-summon-fluffies.txt
index cd754e33..2ca630ed 100644
--- a/world/map/npc/magic/level2-summon-fluffies.txt
+++ b/world/map/npc/magic/level2-summon-fluffies.txt
@@ -3,7 +3,7 @@
end;
OnCast:
- if(call("magic_checks")) end;
+ if(call("magic_checks")) end;
if (Sp < 39) end;
if (getskilllv(SKILL_MAGIC) < .level) end;
if (getskilllv(.school) < .level) end;
@@ -19,6 +19,7 @@ OnCast:
callfunc "magic_exp";
set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
+ if (.@puppet < 1) end;
set .count, (@spellpower/170)+1+(@spellpower/430), .@puppet;
set .master, BL_ID, .@puppet;
set .lifetime, @spellpower*350, .@puppet;
diff --git a/world/map/npc/magic/level2-summon-mouboo.txt b/world/map/npc/magic/level2-summon-mouboo.txt
index 8eb074c6..f6a68fcf 100644
--- a/world/map/npc/magic/level2-summon-mouboo.txt
+++ b/world/map/npc/magic/level2-summon-mouboo.txt
@@ -3,7 +3,7 @@
end;
OnCast:
- if(call("magic_checks")) end;
+ if(call("magic_checks")) end;
if (Sp < 35) end;
if (getskilllv(SKILL_MAGIC) < .level) end;
if (getskilllv(.school) < .level) end;
@@ -19,6 +19,7 @@ OnCast:
callfunc "magic_exp";
set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
+ if (.@puppet < 1) end;
set .count, (@spellpower/270)+1, .@puppet;
set .master, BL_ID, .@puppet;
set .lifetime, @spellpower*100, .@puppet;
diff --git a/world/map/npc/magic/level2-summon-pinkie.txt b/world/map/npc/magic/level2-summon-pinkie.txt
index b91ec1d9..785c8364 100644
--- a/world/map/npc/magic/level2-summon-pinkie.txt
+++ b/world/map/npc/magic/level2-summon-pinkie.txt
@@ -3,7 +3,7 @@
end;
OnCast:
- if(call("magic_checks")) end;
+ if(call("magic_checks")) end;
if (Sp < 35) end;
if (getskilllv(SKILL_MAGIC) < .level) end;
if (getskilllv(.school) < .level) end;
@@ -19,6 +19,7 @@ OnCast:
callfunc "magic_exp";
set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
+ if (.@puppet < 1) end;
set .count, (@spellpower/120)+1, .@puppet;
set .master, BL_ID, .@puppet;
set .lifetime, @spellpower*150, .@puppet;
diff --git a/world/map/npc/magic/level2-summon-snakes.txt b/world/map/npc/magic/level2-summon-snakes.txt
index 7490c506..2c46f28b 100644
--- a/world/map/npc/magic/level2-summon-snakes.txt
+++ b/world/map/npc/magic/level2-summon-snakes.txt
@@ -3,7 +3,7 @@
end;
OnCast:
- if(call("magic_checks")) end;
+ if(call("magic_checks")) end;
if (Sp < 40) end;
if (getskilllv(SKILL_MAGIC) < .level) end;
if (getskilllv(.school) < .level) end;
@@ -20,6 +20,7 @@ OnCast:
callfunc "magic_exp";
set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
+ if (.@puppet < 1) end;
set .count, (@spellpower/300)+1, .@puppet;
set .master, BL_ID, .@puppet;
set .lifetime, @spellpower*80, .@puppet;
diff --git a/world/map/npc/magic/level2-summon-spiky-mushroom.txt b/world/map/npc/magic/level2-summon-spiky-mushroom.txt
index 39ad9ecd..5659fc32 100644
--- a/world/map/npc/magic/level2-summon-spiky-mushroom.txt
+++ b/world/map/npc/magic/level2-summon-spiky-mushroom.txt
@@ -3,7 +3,7 @@
end;
OnCast:
- if(call("magic_checks")) end;
+ if(call("magic_checks")) end;
if (Sp < 33) end;
if (getskilllv(SKILL_MAGIC) < .level) end;
if (getskilllv(.school) < .level) end;
@@ -19,6 +19,7 @@ OnCast:
callfunc "magic_exp";
set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
+ if (.@puppet < 1) end;
set .count, (@spellpower/120)+1, .@puppet;
set .master, BL_ID, .@puppet;
set .lifetime, @spellpower*400, .@puppet;
diff --git a/world/map/npc/magic/level2-summon-wickedmushroom.txt b/world/map/npc/magic/level2-summon-wickedmushroom.txt
index df17742f..02442c6b 100644
--- a/world/map/npc/magic/level2-summon-wickedmushroom.txt
+++ b/world/map/npc/magic/level2-summon-wickedmushroom.txt
@@ -3,7 +3,7 @@
end;
OnCast:
- if(call("magic_checks")) end;
+ if(call("magic_checks")) end;
if (Sp < 35) end;
if (getskilllv(SKILL_MAGIC) < .level) end;
if (getskilllv(.school) < .level) end;
@@ -20,6 +20,7 @@ OnCast:
callfunc "magic_exp";
set .@puppet$, "#"+strnpcinfo(0)+"#"+BL_ID;
set .@puppet, puppet(getmap(), POS_X, POS_Y, .@puppet$, 127);
+ if (.@puppet < 1) end;
set .count, (@spellpower/250)+1, .@puppet;
set .master, BL_ID, .@puppet;
set .lifetime, @spellpower*80, .@puppet;