Jump to content
  • 0

How to summon monster on all maps


celeron0134

Question


  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.02
  • Content Count:  194
  • Reputation:   1
  • Joined:  12/13/16
  • Last Seen:  

Quote

-	script	ANY_MAP_SPAWNER	-1,{
OnInit:
	.mobId = 1002;
	setarray .maps$,"prontera","izlude";
	donpcevent "ANY_MAP_SPAWNER::OnAddMob";
	end;
OnAddMob:
	monster .maps$[rand(0,getarraysize(.maps$) - 1)],0,0,"--ja--",.mobId,1,"ANY_MAP_SPAWNER::OnMyMobDead";
	announce "A new mob has spawned!",0;
	end;
OnMyMobDead:
	initnpctimer;
	announce "The mob has been killed by "+strcharinfo(0)+", wait a hour for the respawn.",0;
	end;
OnTimer3600000:
	stopnpctimer;
	donpcevent "ANY_MAP_SPAWNER::OnAddMob";
	end;
}

How can i make this to summon .mobID on all maps in .maps$ , not randomly.. but it will summon on every map all at once

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.02
  • Content Count:  194
  • Reputation:   1
  • Joined:  12/13/16
  • Last Seen:  

sorry. i tried 

monster .maps$,0,0,"--ja--",.mobId,1,"ANY_MAP_SPAWNER::OnMyMobDead";

it still summons at random

Edited by celeron0134
Link to comment
Share on other sites

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   703
  • Joined:  12/21/14
  • Last Seen:  


-	script	ANY_MAP_SPAWNER	-1,{

	function	F_SpawnMob	{
		monster getarg(0),0,0,"--ja--",.mobId,1,"ANY_MAP_SPAWNER::OnMyMobDead";
		announce "A new mob has spawned!",0;
		return;
	}

OnInit:
	.mobId = 1002;
	setarray .maps$,"prontera","izlude";
	for(.@i=0;.@i<getarraysize(.maps$);.@i++){
		F_SpawnMob(.maps$[.@i]);
	}
end;

OnMyMobDead:
	.@m$ = strcharinfo(3);
	announce "The mob has been killed by "+strcharinfo(0)+", wait a hour for the respawn.",0;
	sleep 3600000;
	F_SpawnMob(.@m$);
end;
}

You need to use for loop

also after that your timer wont work the way you expect it to, so you replace it with something else

the script above work the way you want.

Edited by sader1992
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  66
  • Topics Per Day:  0.02
  • Content Count:  194
  • Reputation:   1
  • Joined:  12/13/16
  • Last Seen:  

8 hours ago, sader1992 said:


-	script	ANY_MAP_SPAWNER	-1,{

	function	F_SpawnMob	{
		monster getarg(0),0,0,"--ja--",.mobId,1,"ANY_MAP_SPAWNER::OnMyMobDead";
		announce "A new mob has spawned!",0;
		return;
	}

OnInit:
	.mobId = 1002;
	setarray .maps$,"prontera","izlude";
	for(.@i=0;.@i<getarraysize(.maps$);.@i++){
		F_SpawnMob(.maps$[.@i]);
	}
end;

OnMyMobDead:
	.@m$ = strcharinfo(3);
	announce "The mob has been killed by "+strcharinfo(0)+", wait a hour for the respawn.",0;
	sleep 3600000;
	F_SpawnMob(.@m$);
end;
}

You need to use for loop

also after that your timer wont work the way you expect it to, so you replace it with something else

the script above work the way you want.

finally !!! one of the best scripters replied.. thankyou so much.. ill try this out

 

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