Jump to content
  • 0

Count the mobs then do event..


Question

6 answers to this question

Recommended Posts

Posted (edited)

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
Posted (edited)

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
Posted (edited)

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

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