Jump to content
  • 0

Count the mobs then do event..


Currently

Question


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  313
  • Reputation:   1
  • Joined:  01/22/12
  • Last Seen:  

Not sure how I will start it thats why :(

I'm just requesting for a little script that will do a mobcount check. and if it reaches 0. OnPCEvent will happen next.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

if( !mobcount( "mapname","event label" ) ){
//do what you want here.. OnPCEvent....
}

refer mobcount

Edited by Emistry
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  313
  • Reputation:   1
  • Joined:  01/22/12
  • Last Seen:  

^ Okay so uhm. Will that triffer if the mob count is 0? I tried to read the mobcount from script_commands.txt but I dont really just get it..

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,154,174,4	script	kdfksdjfs	100,{
monster "this", -1,-1, "--ja--", 1002, 3, strnpcinfo(0)+"::OnPCEvent";
end;
OnPCEvent:
if ( mobcount( "this", strnpcinfo(0)+"::OnPCEvent" ) ) end;
dispbottom "will happen next";
end;
}

though I usually using a variable to save the mobcount instead of using this script command though, more resource friendly

prontera,154,174,4	script	kdfksdjfs	100,{
monster "this", -1,-1, "--ja--", 1002, 3, strnpcinfo(0)+"::OnPCEvent";
.count += 3;
end;
OnPCEvent:
.count--;
if ( .count ) end;
dispbottom "will happen next";
end;
}

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

though I usually using a variable to save the mobcount instead of using this script command though, more resource friendly

Maybe this is a stupid question or I shouldn't ask here... if that's it please forgive me ! (lol)

How could I know if a script is optimized ? How estimate the resource the script is using ? or like you said, how estimate the resource when I used a variable or a script command ?

Just curiosity.

Edited by Capuche
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:  

read the source

script.c file

mobcount script command

script_pushint(st,map_foreachinmap(buildin_mobcount_sub, m, BL_MOB, event));

in this script, every time a monster is kill, in the source will run this function

this function search EVERY monsters in the map,

so let's say if there are more than 300 monsters with 5 different event labels

it will loop through every monsters in this map with 300 loops, and only count++ out only this event label that you have specify

of course, using variables will be more resource friendly

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Thanks you AnnieRuru.

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...