Jump to content
  • 0

Monster spawn when stepped on a cell


Seiro

Question


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  42
  • Reputation:   0
  • Joined:  10/24/12
  • Last Seen:  

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.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

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;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  20
  • Topics Per Day:  0.00
  • Content Count:  42
  • Reputation:   0
  • Joined:  10/24/12
  • Last Seen:  

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
Link to comment
Share on other sites

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.

×
×
  • Create New...