Jump to content
  • 0

Instance/timer script help


Profile

Question


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  77
  • Reputation:   1
  • Joined:  04/15/17
  • Last Seen:  

Hey everyone, I am trying to add an instance to my bossnia NPC. But I haven't had experiences in creating instances yet.

Instead of just sending the players to the bossnia maps, the NPC will create an instance/timer and send the players to the map. When the time runs out (30 minutes) the party members will automatically get kicked out from the map. (I will be impossible to leave party and to enter without one).

I have been searching the forums for some ideas and came up with this

prontera,154,187,5	script	test5	100,{
mes "would you like to enter Room 1 ?";
next;
if ( select ( "Yes", "No" ) == 2 ) {
	mes "good bye then";
	close;
}
if ( getmapusers( "guild_vs2" ) ) {
	mes "sorry, a player is in the room";
	close;
	
}
warpparty "guild_vs2",0,0,getcharid(1);
deltimer strnpcinfo(0) +"::OnKick";
addtimer 10000, strnpcinfo(0) +"::OnKick"; // 10 seconds warp out
@timeused = gettimetick(2);
end;
OnKick:
if ( getmapusers( "guild_vs2" ) ) {
	warpparty "SavePoint",0,0,getcharid(1);

end; 

}
}

This method works, but I would like it to be more user friendly and give the players a real-time timer of how long they have left in the map.

Also, is there a way to announce for messages only for party members?

Any suggestions?

Thank you!

 

 

Edited by Profile
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 1

  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Untested

// instance_db.txt
// 100,Bossnia,1800,1800,guild_vs2,0,0


prontera,154,187,5	script	test5	100,{
	.@party_id = getcharid(1);
	.@p_name$ = getpartyname(.@party_id);
	.@md_name$ = "Bossnia";

	if (!instance_check_party(.@party_id)) {
		mes "Why don't you make a party with more than 1 person and talk to me again?";
		close;
	}
	if (getcharid(0) == getpartyleader(.@party_id,2))
		.@menu$ = "Generate Instance";
	switch( select( .@menu$, "Enter " + .@md_name$ + "", "Cancel" ) ) {
	case 1:
		switch( instance_create(.@md_name$) ) {
		case -3:
			dispbottom "Memorial Dungeon, '" + .@md_name$ + "' is already in progress.",0xFFFFFF;
			end;
		case -4:
		case -2:
		case -1:
			mes "Party Name: " + .@p_name$;
			mes "Party Leader: " + strcharinfo(0);
			mes "^0000ff" + .@md_name$ + "^000000 - time gap generation failed.";
			close;
		}
		end;
	case 2:
		switch( instance_enter(.@md_name$) ) {
		case IE_OTHER:
			mes "An unknown error has occurred.";
			close;
		case IE_NOINSTANCE:
			mes "The time gap is not yet open.";
			close;
		case IE_NOMEMBER:
			mes "Your body is not fit to enter the time gap. You won't be able to get in if you're not in a party.";
			close;
		case IE_OK:
			mapannounce strnpcinfo(4), .@p_name$ + " party member " + strcharinfo(0) + " enters " + .@md_name$ + "",bc_map,"0x00ff99";
			end;
		}
	case 3:
		end;
	}
}

The script create an instance attached to the party. All party member can enter.

Edited by Capuche
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  77
  • Reputation:   1
  • Joined:  04/15/17
  • Last Seen:  

Will check it out Capuche!

I have made some progress with my current code and it now looks like this:

prontera,154,187,5	script	bossniatest	100,{
	
	set .map$,"bossnia_01";
	
mes "would you like to enter bossnia?";
next;
if ( select ( "Yes", "No" ) == 2 ) {
	mes "See you...";
	close;
}
if ( getmapusers( "bossnia_01" ) ) {
	mes "Sorry, but there are people there already.";
	close;
	
}
warpparty "bossnia_01",0,0,getcharid(1);
deltimer strnpcinfo(0) +"::OnKick";
initnpctimer;
addtimer 2700000, strnpcinfo(0) +"::OnKick"; // time limit
@timeused = gettimetick(2);
end;

	OnTimer600000: // 10 minutes
	mapannounce .map$,"10 minutes have passed, you still have 35 minutes left!",0,0x1E90FF;
	sleep2 600000;
	mapannounce .map$,"20 minutes have passed, you still have 25 minutes left!",0,0x1E90FF;
	sleep2 600000;
	mapannounce .map$,"30 minutes have passed, you still have 15 minutes left!",0,0x1E90FF;
	sleep2 600000;
	mapannounce .map$,"40 minutes have passed, you only have 5 minutes left!",0,0x1E90FF;
	sleep2 120000;
	mapannounce .map$,"42 minutes have passed, you only have 3 minutes left!",0,0x1E90FF;
	sleep2 120000;
	mapannounce .map$,"You will be warped back in 1 minute!",0,0x1E90FF;
		
OnKick:
if ( getmapusers( "bossnia_01" ) ) {
	warpparty "SavePoint",0,0,getcharid(1);
	
stopnpctimer;
end; 

}
}

Could anything be improved?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  77
  • Reputation:   1
  • Joined:  04/15/17
  • Last Seen:  

15 minutes ago, Capuche said:

Untested


// instance_db.txt
// 100,Bossnia,1800,1800,guild_vs2,0,0


prontera,154,187,5	script	test5	100,{
	.@party_id = getcharid(1);
	.@p_name$ = getpartyname(.@party_id);
	.@md_name$ = "Bossnia";

	if (!instance_check_party(.@party_id)) {
		mes "Why don't you make a party with more than 1 person and talk to me again?";
		close;
	}
	if (getcharid(0) == getpartyleader(.@party_id,2))
		.@menu$ = "Generate Instance";
	switch( select( .@menu$, "Enter " + .@md_name$ + "", "Cancel" ) ) {
	case 1:
		switch( instance_create(.@md_name$) ) {
		case -3:
			dispbottom "Memorial Dungeon, '" + .@md_name$ + "' is already in progress.",0xFFFFFF;
			end;
		case -4:
		case -2:
		case -1:
			mes "Party Name: " + .@p_name$;
			mes "Party Leader: " + strcharinfo(0);
			mes "^0000ff" + .@md_name$ + "^000000 - time gap generation failed.";
			close;
		}
		end;
	case 2:
		switch( instance_enter(.@md_name$) ) {
		case IE_OTHER:
			mes "An unknown error has occurred.";
			close;
		case IE_NOINSTANCE:
			mes "The time gap is not yet open.";
			close;
		case IE_NOMEMBER:
			mes "Your body is not fit to enter the time gap. You won't be able to get in if you're not in a party.";
			close;
		case IE_OK:
			mapannounce strnpcinfo(4), .@p_name$ + " party member " + strcharinfo(0) + " enters " + .@md_name$ + "",bc_map,"0x00ff99";
			end;
		}
	case 3:
		end;
	}
}

The script create an instance attached to the party. All party member can enter.

Tested this script, but it doesn't seem to be working.

As I try to generate dungeon (As party leader and with members on party)

1.png.819f7d953e5ec14b1d90d9cf59d836de.png

As I try to enter the instance:

2.png.22f194769e829623d62d6d569904cfdd.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  77
  • Reputation:   1
  • Joined:  04/15/17
  • Last Seen:  

Ok, I didn't know that the instance had to be created in the instancedb.

After doing that, Capuche's script worked just fine!

I will now customize it and make it different. If anybody wants to use it, please PM me. I will be giving it away to anyone who wants it.

Thanks!

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