Jump to content
  • 0

Instance disable/enable npc


angelwarrior

Question


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  29
  • Reputation:   0
  • Joined:  02/21/16
  • Last Seen:  

Hi guys,

I can't enable an instance npc with those scripts. My idea is when you kill a mvp(1296) the warp become enabled and you can pass to next level. But when i kills him the warp not appear. I use 2 scripts:

To create instance:

prontera,150,150,0	script	Instanced Prontera#a	101,{

	set .@instance$, "Primer Jefe";

	if (instance_id()) {
		if (select("Enter Instance.:Cancel.") == 2) end;
		if (instance_enter(.@instance$) != 0) {
			mes "Instance entrance ^FF0000failed^000000.";
			close;
		}
	} else {
		if (select("Create Instance.:Cancel.") == 2) end;
		if (instance_create(.@instance$) < 0) {
			mes "Instance creation ^FF0000failed^000000.";
			close;
		}
		mes "Instance created.";
		close2;
		instance_enter(.@instance$);
		.@map$ = instance_mapname("pvp_n_1-3");
		.@label$ = instance_npcname(strnpcinfo(0))+"::OnMyMobDead";
        monster .@map$,0,0,"--ja--",1296,1,.@label$,2;
	}
	end;
OnMyMobDead:
    enablenpc instance_npcname("warpmvp1");
	end;
OnInstanceInit:
	disablenpc instance_npcname(strnpcinfo(0));
	disablenpc instance_npcname("#warpmvp1", instance_id());
	end;
}


to warp appear when i kill mvp (npc is in map):

pvp_n_1-3,83,116,5	script	PoringSpawner1	139,{
	end;
	
OnNPCKillEvent:
	if (killedrid == 1296) {
		/*
		- if player kill several monsters in few seconds, spam of enable/disable
			Set a variable when timer start then clear when end
		*/
		getmapxy(.@mapa$,.@x,.@y,0);
		if (.@mapa$ == "pvp_n_1-3") {
			enablenpc instance_npcname("warpmvp1");
			end;
		}
	}
end;// <- add end to stop the script here otherwise if players kill another monster than 1296 or 1296 on another map than pvp_n_1-3, the warp is disabled
.@map$ = instance_mapname("pvp_n_1-3");
		.@label$ = instance_npcname(strnpcinfo(0))+"::OnMyMobDead";
        monster .@map$,0,0,"--ja--",1296,1,.@label$,2;
	}
	end;
OnMyMobDead:
    enablenpc instance_npcname("warpmvp1");
	end;

//Disable the warp when the server starts.
OnNPCKillEvent:
    enablenpc instance_npcname("warpmvp1");
	end;
OnInstanceInit:
	disablenpc instance_npcname("warpmvp1");
	end;
}

//My Example

//Warp NPC
pvp_n_1-3,100,140,0	script	warpmvp1	45,2,2,{
warp "piso1",178,223;
end;
}

Thanks for help me!

Edited by angelwarrior
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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