• 0
Brizyous

How to make a NPC like MvP Tomb?

Question

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.

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

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;
	[email protected] = inarray(.moblist[0], killedrid);
	if ([email protected] == -1)
		end;
	[email protected] = getelementofarray(getvariableofnpc(.tombid, "TheTomb"), [email protected]);
	debugmes "npcid: "[email protected];
	getunitdata(killedgid, [email protected]);
	setunitdata([email protected], UNPC_MAPID, [email protected][UMOB_MAPID]);
	setunitdata([email protected], UNPC_X, [email protected][UMOB_X]);
	setunitdata([email protected], UNPC_Y, [email protected][UMOB_Y]);
	setunitdata([email protected], UNPC_LOOKDIR, 0);
	end;

OnInit:
	setarray .moblist[0], 1002, 1003, 1004, 1005;
	
	[email protected] = getarraysize(.moblist);
	[email protected] = getvariableofnpc(.tombcount, "TheTomb");
	if ([email protected] < [email protected]) {
		debugmes "The Tomb count isn't match with the mob count in list";
		debugmes "Size of Mob List: "[email protected]+", NPC Tomb Count: "[email protected];
		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

Share this post


Link to post
Share on other sites
  • 0
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

Share this post


Link to post
Share on other sites
  • 0
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.

Share this post


Link to post
Share on other sites
  • 0

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;
	[email protected] = inarray(.moblist[0], killedrid);
	if ([email protected] == -1)
		end;
	[email protected] = getelementofarray(getvariableofnpc(.tombid, "TheTomb"), [email protected]);
	getunitdata(killedgid, [email protected]);
	setunitdata([email protected], UNPC_MAPID, [email protected][UMOB_MAPID]);
	setunitdata([email protected], UNPC_X, [email protected][UMOB_X]);
	setunitdata([email protected], UNPC_Y, [email protected][UMOB_Y]);
	setunitdata([email protected], UNPC_LOOKDIR, 0);
	end;

OnInit:
	setarray .moblist[0], 1002, 1003, 1004, 1005;
	
	[email protected] = getarraysize(.moblist);
	[email protected] = getvariableofnpc(.tombcount, "TheTomb");
	if ([email protected] < [email protected]) {
		debugmes "The Tomb count isn't match with the mob count in list";
		debugmes "Size of Mob List: "[email protected]+", NPC Tomb Count: "[email protected];
		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

Share this post


Link to post
Share on other sites
  • 0
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;
	[email protected] = inarray(.moblist[0], killedrid);
	if ([email protected] == -1)
		end;
	[email protected] = getelementofarray(getvariableofnpc(.tombid, "TheTomb"), [email protected]);
	getunitdata(killedgid, [email protected]);
	setunitdata([email protected], UNPC_MAPID, [email protected][UMOB_MAPID]);
	setunitdata([email protected], UNPC_X, [email protected][UMOB_X]);
	setunitdata([email protected], UNPC_Y, [email protected][UMOB_Y]);
	setunitdata([email protected], UNPC_LOOKDIR, 0);
	end;

OnInit:
	setarray .moblist[0], 1002, 1003, 1004, 1005;
	
	[email protected] = getarraysize(.moblist);
	[email protected] = getvariableofnpc(.tombcount, "TheTomb");
	if (.[email protected] < [email protected]) {
		debugmes "The Tomb count isn't match with the mob count in list";
		debugmes "Size of Mob List: "[email protected]+", NPC Tomb Count: "[email protected];
		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.

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
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.