Jump to content
  • 0

Monster spawn when stepped on a cell


Question

Posted

When a player steps on an area cell, it will summon a monster.

  • It will not summon another one while the current monster is alive.
  • delay for 30mins before it can summon again. (to prevent accident summoning)

- you can use a Crystal monster (1952)

- you can do any area/coordinate, but please try and explain how it works so I can edit it

If possible:

monster will die if not killed/attacked in 10 minutes.

3 answers to this question

Recommended Posts

Posted (edited)

The area is based on where the npc is located.

prontera,100,150,0    script    Summoner    -1,2,2,{

OnTouch:

the "2,2" after -1 script means that you're gonna trigger the OnTouch even label when a player walks into a 5x5 square centred at prontera 100 150.

So basically, X: 98~102, Y: 148~152. Changing the "2,2", will increase/decrease the area.

1,1 -> 3x3 area around where the npc is located.

2,2 -> 5x5

3,3 -> 7x7

And so on.

OnTouch:

   //Prevent to summon if a monster is already summoned or before 30 minutes
   if( .isSummoned )
       end;

   .isSummoned = 1;
   getmapxy .map$, .@x, .@y, 0;
   monster .map$, .@x, .@y, "Summoned Monster", 1952, 1, strnpcinfo(0) + "::OnMonsterDead";
   initnpctimer;
   end;

//10 minutes...
OnTimer600000:
   killmonster .map$, strnpcinfo(0) + "::OnMonsterDead";
   end;

//Reopening the event after 30 minutes
OnTimer1800000:
   stopnpctimer;
   .isSummoned = 0;
   end;

Note that the part of not being able to summon in 30 minutes can be easily done with gettimetick() as well, but as I started a timer for killing it, I prefered to keep using that timer.

Edited by Ryokem
Posted
prontera,155,177,5	script	kjdhfksdjf	100,2,2,{
if ( .summon_timetick + 10 > gettimetick(2) // 10 seconds delay to summon again
	|| mobcount( "this", strnpcinfo(0)+"::Onaa" ) ) end;
monster "this", -1,-1, "--ja--", 1952,1, strnpcinfo(0)+"::Onaa";
.summon_timetick = gettimetick(2);
sleep 5000; // 5 seconds auto-kill this mob
killmonster .map$, strnpcinfo(0) +"::Onaa";
end;
OnInit:
getmapxy .map$, .@x, .@y, 1; // wtf ... killmonster script command doesn't allow "this" variable
Onaa: // prevent server spam error
end;
}

Posted (edited)

The area is based on where the npc is located.

prontera,100,150,0	script	Summoner	-1,2,2,{

OnTouch:

the "2,2" after -1 script means that you're gonna trigger the OnTouch even label when a player walks into a 5x5 square centred at prontera 100 150.

So basically, X: 98~102, Y: 148~152. Changing the "2,2", will increase/decrease the area.

1,1 -> 3x3 area around where the npc is located.

2,2 -> 5x5

3,3 -> 7x7

And so on.

I know about the "2,2,{"

I just thought you're going to use something like

if( (.@map$ == "prontera") && (.@x < 135) && (.@x > 129) && (.@y < 40) && (.@y > 34) )

which is a little confusing, but I know now how it works.

prontera,155,177,5	script	kjdhfksdjf	100,2,2,{
if ( .summon_timetick + 10 > gettimetick(2) // 10 seconds delay to summon again
	|| mobcount( "this", strnpcinfo(0)+"::Onaa" ) ) end;
monster "this", -1,-1, "--ja--", 1952,1, strnpcinfo(0)+"::Onaa";
.summon_timetick = gettimetick(2);
sleep 5000; // 5 seconds auto-kill this mob
killmonster .map$, strnpcinfo(0) +"::Onaa";
end;
OnInit:
getmapxy .map$, .@x, .@y, 1; // wtf ... killmonster script command doesn't allow "this" variable
Onaa: // prevent server spam error
end;
}

More easier to configure! I just added OnTouch: Since I want the NPC hiding :o

*Thanks! I learned from both script*

Edited by Seiro

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...