Jump to content
  • 0

Spawn Mob [ Dynamic ]


Question

Posted

I want to spawn different kind of mobs that saved on the array. 5 Levels.

Can't make it work.

 

 

Here's my code:


set .@count,0;
setarray .@namelevel$[0], ".@level0", ".@level1", ".@level2", ".@level3", ".@level4";
setarray .@level0[0], 1002, 1002, 1002;
setarray .@count0[0], 1, 1, 1;
setarray .@level1[0], 1002, 1002, 1002;
setarray .@count1[0], 1, 1, 1;
setarray .@level2[0], 1002, 1002, 1002;
setarray .@count2[0], 1, 1, 1;
setarray .@level3[0], 1002, 1002, 1002;
setarray .@count3[0], 1, 1, 1;
setarray .@level4[0], 1002, 1002, 1002;
setarray .@count4[0], 1, 1, 1;

for( set .@i, 0; .@i < getarraysize(.@namelevel$[.@count]); set .@i, .@i +1 ) {
 // spawn monster here and call the :monsterKilled label and count mobs on the map
 // if mob count is 0 set .@count, .@count+1
 // and do the for loop again
 // so it will be .@level1
 // until .@level4 finishes
}

Any work around?

Thank you in advance.

1 answer to this question

Recommended Posts

Posted
-    script    npcname    -1,{
OnInit:
//Mob ID, Amt, Mob ID2, Amt2, etc...
set .level0[0],1002,1,1002,1,1002,1;
set .level1[0],1003,1,1003,1,1003,1;
set .level2[0],1004,1,1004,1,1004,1;
set .level3[0],1005,1,1005,1,1005,1;
set .level4[0],1006,1,1006,1,1006,1;
//Add more Levels as needed.
end;

OnPCLoginEvent:
iSummon:
for(set .@i,0; .@i< getarraysize( getd(".level"+ @count +"") ); set .@i,.@i+2)
    {monster strcharinfo(3),-1,-1,getmonsterinfo( getd(".level"+ @count +"["+ .@i +"]"),0), getd(".level"+ @count +"["+.@i+"]"), getd(".level"+ @count +"["+ (.@i + 1)+"]"),strnpcinfo(3)+"::OnThisMobDead";}
end;

OnThisMobDead:
set @mkill,@mkill + 1;
if( @mkill >= ( getarraysize( getd(".level"+ @count +"") ) / 2 ) ){set @count, @count +1;}
if( getd(".level"+ @count +"[0]") == 0 ){end;} //Completed all rounds.
goto iSummon;
end;

That should do what you ask assuming I understood your request. Right now it should start a soon as a player logs in. Additionally, it'll allow for support past 5 levels, as well as alot of monsters.

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