Page 1 of 1

Seasonal spawns (was: I need your help, devs)

Posted: 10 Aug 2011, 19:37
by Flenix
Hello the mana world, Image
  • I'm posting here for a little problem in teAthena script.
As you already know I was wanted to do an script that will spawn fluffy in nivalis only the summer (see thermin's topic).


I tried:

Code: Select all

019-1.gat,0,0,0	script	#Fluffyspawn	-1,{

OnInit:
	if (gettime(6) >= 6 && gettime(6) <= 9) 
			monster 019-1, 0, 0, "this", 1020, 100,"#Fluffyspawn::On1020";
end;
On1020:
		if (gettime(6) >= 6 && gettime(6) <= 9) monster "this", 0, 0, "Fluffy", 1020, 1,"#Fluffyspawn::On1020";
	set @mobID, 1020;
	callfunc "MobPoints";
end;
}
but it didn't work Image
if someone as a dev can help me to understand where the problem comes.
(the terminal said anything's wrong)

if only it could work ... Image

Re: I need your help, devs

Posted: 10 Aug 2011, 19:46
by Dark_Mag
Flenix wrote:Hello the mana world, Image
  • I'm posting here for a little problem in teAthena script.
As you already know I was wanted to do an script that will spawn fluffy in nivalis only the summer (see thermin's topic).


I tried:

Code: Select all

019-1.gat,0,0,0	script	#Fluffyspawn	-1,{

OnInit:
	if (gettime(6) >= 6 && gettime(6) <= 9) 
			monster 019-1, 0, 0, "this", 1020, 100,"#Fluffyspawn::On1020";
end;
On1020:
		if (gettime(6) >= 6 && gettime(6) <= 9) monster "this", 0, 0, "Fluffy", 1020, 1,"#Fluffyspawn::On1020";
	set @mobID, 1020;
	callfunc "MobPoints";
end;
}
but it didn't work Image
if someone as a dev can help me to understand where the problem comes.
(the terminal said anything's wrong)

if only it could work ... Image
Flenix,

Hm, at first you should create a timer, and only then check its time. Also you're using it (spawn and timer) a bit strange, I would advice you to read about timers in the commands tutorial.

Cheers, dark

Re: I need your help, devs

Posted: 10 Aug 2011, 21:49
by o11c
That looks mostly right, but e.g. the map name needs to be in quotes. Otherwise it gets interpreted as the integer result of (019 - 1), which is an error if the parser does octal and 18 otherwise. Either way, when stringified, it is not a valid map name.

There is no need for a timer in this case, and timers should generally be avoided when feasible.

Note however that this might cause problems if the monsters are killed using GM commands.

Re: Seasonal spawns (was: I need your help, devs)

Posted: 11 Aug 2011, 12:05
by alastrim
I could not think of a way to do this without using a timer and a "OnMonsterDeath" label.
As I was thinking, It would check the current month every minute and spawn the monsters in the right date. But if a gm kills them using "@killmonster2" it would mess with the respawn control.

But it would be interesting to see it work without a timer too.

Re: Seasonal spawns (was: I need your help, devs)

Posted: 12 Aug 2011, 10:12
by Flenix
thanks for your answers Image


@Dark_Mag: thanks for the link, I was using the Eathena commands http://wiki.themanaworld.org/images/9/97/Scripthelp.txt

@o11c: I tried (before posting) "this" for the map name instead of 19-1, but both don't work.

about the @killmonster command, why gm will want to kill fluffies Image, anyway we should add a debug in a NPC in the map (snow man as example)
something like that

Code: Select all

if (getgmlevel() >= 60) 
     menu 
"I did @killmonter", L_fluffy,
"nothing", -;
close;
L_fluffy:
      if (gettime(6) >= 6 && gettime(6) <= 9) monster "this", 0, 0, "Fluffy", 1020, 100,"#Fluffyspawn::On1020";
      if (gettime(6) >= 6 && gettime(6) <= 9) mes "Monster spawn";
      if (!(gettime(6) >= 6 && gettime(6) <= 9)) mes "Fail, you're not in the right season.";
close;

Re: Seasonal spawns (was: I need your help, devs)

Posted: 12 Aug 2011, 10:12
by Flenix
I'll try to do the script right