Jump to content
  • 0

How to make a NPC like MvP Tomb?


Erebos

Question


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  65
  • Reputation:   4
  • Joined:  10/25/18
  • Last Seen:  

I want to make a NPC that spawns whenever a player kills a mob from an array list.
I dont know how to make it spawnable multiple times at the same time from different maps and players, like Tombs from MvP.
Also, i dont know how to make it so it doesn't work with instanced mobs.

Could this be done without source modifications? if not, could you guys give me some advice?
Thanks as always for the help.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

yep, you are right the script crashed my test server, because the duplicate tomb is floating type npc, tested and worked...

not entirely like tomb per see, because when the scenario 2 player killing same mob id from the list mob, the npc will move to the last killed mob

ex: player a killed poring (1002) on prontera 150 150, then npc will spawned there, then after 10 seconds, player B kill poring (1002) too on prontera 180 180, the npc that spwaned after player A killed poring will move to player B killed poring

you need many duplicate npc, to match exact number of your amount spawned mobs, or with src mod will be more easier

btw here the tested script

-	script	Main NPC	-1,{
	end;

OnNPCKillEvent:
	if (.state != 1)
		end;
	.@inlist = inarray(.moblist[0], killedrid);
	if (.@inlist == -1)
		end;
	.@npcid = getelementofarray(getvariableofnpc(.tombid, "TheTomb"), .@inlist);
	debugmes "npcid: "+.@npcid;
	getunitdata(killedgid, .@md);
	setunitdata(.@npcid, UNPC_MAPID, .@md[UMOB_MAPID]);
	setunitdata(.@npcid, UNPC_X, .@md[UMOB_X]);
	setunitdata(.@npcid, UNPC_Y, .@md[UMOB_Y]);
	setunitdata(.@npcid, UNPC_LOOKDIR, 0);
	end;

OnInit:
	setarray .moblist[0], 1002, 1003, 1004, 1005;
	
	.@moblistsize = getarraysize(.moblist);
	.@tombcount = getvariableofnpc(.tombcount, "TheTomb");
	if (.@moblistsize < .@tombcount) {
		debugmes "The Tomb count isn't match with the mob count in list";
		debugmes "Size of Mob List: "+.@moblistsize+", NPC Tomb Count: "+.@tombcount;
		end;
	}
	.state = 1;
	end;
}

-	script	TheTomb	-1,{
	end;
	
OnInit:
	if (strnpcinfo(2) == "")
		end;
	.tombcount++;
	.tombid[.tombcount-1] = getnpcid(0);
	end;

}

prontera,0,0,0	duplicate(TheTomb)	Tomb#1	112
prontera,0,0,0	duplicate(TheTomb)	Tomb#2	112
prontera,0,0,0	duplicate(TheTomb)	Tomb#3	112
prontera,0,0,0	duplicate(TheTomb)	Tomb#4	112

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  398
  • Reputation:   246
  • Joined:  07/04/19
  • Last Seen:  

8 hours ago, Brizyous said:

I want to make a NPC that spawns whenever a player kills a mob from an array list.
I dont know how to make it spawnable multiple times at the same time from different maps and players, like Tombs from MvP.
Also, i dont know how to make it so it doesn't work with instanced mobs.

Could this be done without source modifications? if not, could you guys give me some advice?
Thanks as always for the help.

make a custom mob that same on npc looks and then on your script

OnInit:
monster "MAP_NAME",X,Y,"--ja--",mob_id,mob_quantity,"NpcName::OnMobDead1";

OnMobDead1:
monster "MAP_NAME",X,Y,"--ja--",mob_id,mob_quantity,"NpcName::NpcSpawn"; //this will act as mvp tomb

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  65
  • Reputation:   4
  • Joined:  10/25/18
  • Last Seen:  

6 hours ago, BeWan said:

make a custom mob that same on npc looks and then on your script

OnInit:
monster "MAP_NAME",X,Y,"--ja--",mob_id,mob_quantity,"NpcName::OnMobDead1";

OnMobDead1:
monster "MAP_NAME",X,Y,"--ja--",mob_id,mob_quantity,"NpcName::NpcSpawn"; //this will act as mvp tomb

Thanks but i need this to be an actual script. My idea is to make a chest (sprite id 10005) that gives the MvP killer's party some items when click.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

untested script... you can try it and if you encounter error i will help as i can and want.

set your list of mob that you want to trigger tomb alike npc in array variable ".moblist" and make duplicate of TheTomb npc as much as ".moblist" count.

-	script	Main NPC	-1,{
	end;

OnNPCKillEvent:
	if (.state != 1)
		end;
	.@inlist = inarray(.moblist[0], killedrid);
	if (.@inlist == -1)
		end;
	.@npcid = getelementofarray(getvariableofnpc(.tombid, "TheTomb"), .@inlist);
	getunitdata(killedgid, .@md);
	setunitdata(.@npcid, UNPC_MAPID, .@md[UMOB_MAPID]);
	setunitdata(.@npcid, UNPC_X, .@md[UMOB_X]);
	setunitdata(.@npcid, UNPC_Y, .@md[UMOB_Y]);
	setunitdata(.@npcid, UNPC_LOOKDIR, 0);
	end;

OnInit:
	setarray .moblist[0], 1002, 1003, 1004, 1005;
	
	.@moblistsize = getarraysize(.moblist);
	.@tombcount = getvariableofnpc(.tombcount, "TheTomb");
	if (.@moblistsize < .@tombcount) {
		debugmes "The Tomb count isn't match with the mob count in list";
		debugmes "Size of Mob List: "+.@moblistsize+", NPC Tomb Count: "+.@tombcount;
		end;
	}
	.state = 1;
	end;
}

-	script	TheTomb	-1,{
	end;
	
OnInit:
	if (strnpcinfo(2) == "")
		end;
	.tombcount++;
	.tombid[.tombcount-1] = getnpcid();
	end;

}

-	duplicate(TheTomb)	Tomb#1	112
-	duplicate(TheTomb)	Tomb#2	112
-	duplicate(TheTomb)	Tomb#3	112
-	duplicate(TheTomb)	Tomb#4	112

 

Edited by Litro Endemic
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  65
  • Reputation:   4
  • Joined:  10/25/18
  • Last Seen:  

17 minutes ago, Litro Endemic said:

untested script... you can try it and if you encounter error i will help as i can and want.

set your list of mob that you want to trigger tomb alike npc in array variable ".moblist" and make duplicate of TheTomb npc as much as ".moblist" count.


-	script	Main NPC	-1,{
	end;

OnNPCKillEvent:
	if (.state != 1)
		end;
	.@inlist = inarray(.moblist[0], killedrid);
	if (.@inlist == -1)
		end;
	.@npcid = getelementofarray(getvariableofnpc(.tombid, "TheTomb"), .@inlist);
	getunitdata(killedgid, .@md);
	setunitdata(.@npcid, UNPC_MAPID, .@md[UMOB_MAPID]);
	setunitdata(.@npcid, UNPC_X, .@md[UMOB_X]);
	setunitdata(.@npcid, UNPC_Y, .@md[UMOB_Y]);
	setunitdata(.@npcid, UNPC_LOOKDIR, 0);
	end;

OnInit:
	setarray .moblist[0], 1002, 1003, 1004, 1005;
	
	.@moblistsize = getarraysize(.moblist);
	.@tombcount = getvariableofnpc(.tombcount, "TheTomb");
	if (.@moblistsize < .@tombcount) {
		debugmes "The Tomb count isn't match with the mob count in list";
		debugmes "Size of Mob List: "+.@moblistsize+", NPC Tomb Count: "+.@tombcount;
		end;
	}
	.state = 1;
	end;
}

-	script	TheTomb	-1,{
	end;
	
OnInit:
	if (strnpcinfo(2) == "")
		end;
	.tombcount++;
	.tombid[.tombcount-1] = getnpcid();
	end;

}

-	duplicate(TheTomb)	Tomb#1	112
-	duplicate(TheTomb)	Tomb#2	112
-	duplicate(TheTomb)	Tomb#3	112
-	duplicate(TheTomb)	Tomb#4	112

 

Thanks! i get an error:
buildin_getvariableofnpc: can't find the npc TheTomb

idk why, maybe it needs to be in a map.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

did you change the npc name?, you need to adjust it then.. 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  65
  • Reputation:   4
  • Joined:  10/25/18
  • Last Seen:  

nope, i didn't change it, just copy pasted for testing, then i changed it and still got error.
edit: i fixed it, now it crashes xD

i changed:
 

.tombid[.tombcount-1] = getnpcid();

for:
 

.tombid[.tombcount-1] = getnpcid(0,"TheTomb");

i hope u can help me orz

Edited by Brizyous
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...