Jump to content

Question

Posted

how can I create an NPC with an option to register 10 players, this option registers the player to participate in the draw.
the draw will choose a random dual among those 10 players, and will teleport to separated maps.
each dual will go to a different map where the event will start.

4 answers to this question

Recommended Posts

  • 0
Posted (edited)
On 3/14/2018 at 11:43 PM, ZelosAvalon said:

how can I create an NPC with an option to register 10 players, this option registers the player to participate in the draw.
the draw will choose a random dual among those 10 players, and will teleport to separated maps.
each dual will go to a different map where the event will start.

I don't really have a lot of time to code it all out or whatever... Or even test but this is a quick example I came up with.
 

prontera,163,187,6	script	dual warp	100,{
	.@len = getarraysize(.waiting_list$);
	if( !.init && !compare("|"+implode(.waiting_list$,"|")+"|", "|"+getcharid(0)+"|") ) {
		.waiting_list$[.@len] = ""+getcharid(0);
		.@len++;
		npctalk .@len + "";
		if( .@len == 10 ) {
			.init = 1;
		
			.@map_len = getarraysize(.maps$);
			copyarray .@maps$,.maps$,.@map_len;
			copyarray .@cordx,.cordx,.@map_len;
			copyarray .@cordy,.cordy,.@map_len;
			
			while( .@len ) {
				.@rng = rand(.@len);
				.@map_rng = .@rng % .@map_len;
				.@map$ = .@maps$[ .@map_rng ];
				.@x = .@cordx[ .@map_rng ];
				.@y = .@cordy[ .@map_rng ];
				
				warp .@map$,.@x,.@y,atoi(.waiting_list$[.@rng]);
				deletearray .waiting_list$[.@rng], 1;
				
				.@len--;
				.@rng = rand(.@len);
				warp .@map$,.@x,.@y,atoi(.waiting_list$[.@rng]);
				deletearray .waiting_list$[.@rng], 1;
				
				deletearray .@maps$[ .@map_rng ], 1;
				deletearray .@cordx[ .@map_rng ], 1;
				deletearray .@cordy[ .@map_rng ], 1;
				
				.@map_len--;
				.@len--;
			}
			.init = 0;
		}
	}
	end;
	
	OnInit:
		setarray .maps$, "prontera", "izlude", "geffen", "comodo", "amatsu";
		setarray .cordx, 10, 100, 50, 20, 40;
		setarray .cordy, 10, 100, 50, 20, 40;
}

 

Edited by Skorm
  • Upvote 1
  • 0
Posted (edited)
19 hours ago, Skorm said:

I don't really have a lot of time to code it all out or whatever... Or even test but this is a quick example I came up with.
 


-	script	Example	100,{
	.@len = getarraysize(.waiting_list$);
	if( !.init && !compare("|"+implode(.waiting_list$,"|")+"|", "|"+getcharid(0)+"|") ) {
		.waiting_list$[.@len] = ""+getcharid(0);
		npctalk ++.@len + "";
		if( .@len == 10 ) {
			.init = 1;
		
			.@map_len = getarraysize(.maps$);
			copyarray .@maps$,.maps$,.@map_len;
			copyarray .@cordx,.cordx,.@map_len;
			copyarray .@cordy,.cordy,.@map_len;
			
			while( .@len ) {
				.@rng = rand(.@len);
				.@map_rng = .@rng % .@map_len;
				.@map$ = .@maps$[ .@map_rng ];
				.@x = .@cordx[ .@map_rng ];
				.@y = .@cordy[ .@map_rng ];
				
				warp .@map$,.@x,.@y,atoi(.waiting_list$[.@rng]);
				deletearray .waiting_list$[.@rng], 1;
				
				.@rng = rand(--.@len);
				warp .@map$,.@x,.@y,atoi(.waiting_list$[.@rng]);
				deletearray .waiting_list$[.@rng], 1;
				
				deletearray .@maps$[ .@map_rng ], 1;
				deletearray .@cordx[ .@map_rng ], 1;
				deletearray .@cordy[ .@map_rng ], 1;
				
				.@map_len--;
				.@len--;
			}
			.init = 0;
		}
	}
	end;
	
	OnInit:
		setarray .maps$, "prontera", "izlude", "geffen", "comodo", "amatsu";
		setarray .cordx, 10, 100, 50, 20, 40;
		setarray .cordy, 10, 100, 50, 20, 40;
}

 

I know you are a busy man, but if have any time could you check this error for me ? image.png.56b9af87207a94edf2b312e88f7c1c0c.png

thanks anyway,

best regards ZelosAvalon

Edited by ZelosAvalon
  • 0
Posted

@ZelosAvalon I updated my previous post. This isn't the entire event though. It's just a way of collecting 10 different players in a list and then warping them in groups of two to different maps. You'll have to figure out the rest unless someone else wants to spend the time building you an event.

  • Upvote 1
  • 0
Posted
On 21/03/2018 at 2:55 PM, Skorm said:

@ZelosAvalon I updated my previous post. This isn't the entire event though. It's just a way of collecting 10 different players in a list and then warping them in groups of two to different maps. You'll have to figure out the rest unless someone else wants to spend the time building you an event.

tyvm <3

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...