Jump to content
  • 0
DR4LUC0N

Please help me on this script that'll connect arrays in 1 block of script.

Question

Okay let me try and re-explain this... with this script how do I make this happen? I've been trying to edit it so please excuse my comments.

prontera,157,176,5	script	guide	650,1,1,{
setarray [email protected],156,156,156,153;
setarray [email protected],170,161,153,150;
setarray [email protected],0,0,1,0;
.1a = ++
OnTouch:
	if(.guide == 0) {
		unitwalk getcharid(3),[email protected][.guide[.1a]],[email protected][.guide[.1a]];
		set .guide,.1a;
	}
	if(.guide >= 1 && [email protected][.guide] == 0) {
		unitwalk getcharid(3),[email protected][.guide[.1a]],[email protected][.guide[.1a]];
		set .guide, .guide++;
	}
//	if(.guide >= 1 && [email protected] >= 0 && [email protected][.guide] == 1) {
//		.guide++;
//		mes "Test complete";
//		close;
//		unitwalk getcharid(3),[email protected][.guide],[email protected][.guide];
//		end;
//	}
//	else if([email protected] >= 1) {
//		set .guide,0;
//		end;
//	}
}

prontera,157,170,6	duplicate(guide)	guide#1	650,1,1
prontera,157,162,6	duplicate(guide)	guide#2	650,1,1
prontera,157,153,6	duplicate(guide)	guide#3	650,1,1
prontera,152,150,6	duplicate(guide)	guide#4	650,1,1

I want to basically run this script OnTouch and boost the player to the next NPC on .guidetype0, except on the guidetype 1, I want to stray away from that and move onto another block and have it talk to the player but then go back to the original OnTouch basically like this...

screenrAthena014.thumb.jpg.f5ebe6438a4c3c532fb91e4e39793750.jpg

Except #3 it speaks to player and then moves back to the script to keep going until there's no more NPCs to move to.

Edited by DR4LUC0N
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 1
21 hours ago, DR4LUC0N said:

Okay let me try and re-explain this... with this script how do I make this happen? I've been trying to edit it so please excuse my comments.

prontera,157,176,5	script	guide	650,1,1,{
setarray [email protected],156,156,156,153;
setarray [email protected],170,161,153,150;
setarray [email protected],0,0,1,0;
.1a = ++
OnTouch:
	if(.guide == 0) {
		unitwalk getcharid(3),[email protected][.guide[.1a]],[email protected][.guide[.1a]];
		set .guide,.1a;
	}
	if(.guide >= 1 && [email protected][.guide] == 0) {
		unitwalk getcharid(3),[email protected][.guide[.1a]],[email protected][.guide[.1a]];
		set .guide, .guide++;
	}
//	if(.guide >= 1 && [email protected] >= 0 && [email protected][.guide] == 1) {
//		.guide++;
//		mes "Test complete";
//		close;
//		unitwalk getcharid(3),[email protected][.guide],[email protected][.guide];
//		end;
//	}
//	else if([email protected] >= 1) {
//		set .guide,0;
//		end;
//	}
}

prontera,157,170,6	duplicate(guide)	guide#1	650,1,1
prontera,157,162,6	duplicate(guide)	guide#2	650,1,1
prontera,157,153,6	duplicate(guide)	guide#3	650,1,1
prontera,152,150,6	duplicate(guide)	guide#4	650,1,1

I want to basically run this script OnTouch and boost the player to the next NPC on .guidetype0, except on the guidetype 1, I want to stray away from that and move onto another block and have it talk to the player but then go back to the original OnTouch basically like this...

screenrAthena014.thumb.jpg.f5ebe6438a4c3c532fb91e4e39793750.jpg

Except #3 it speaks to player and then moves back to the script to keep going until there's no more NPCs to move to.

Maybe something like this.

prontera,157,176,5	script	guide	650,1,1,{
end;
OnTouch:
	[email protected] = atoi(strnpcinfo(2));
	if([email protected]+1 == getarraysize(.npc_pos_x)) {
		dispbottom "End";
	}
	else {
		switch([email protected]) {
			case 0:
				npctalk "Hello I'm the first NPC!";
				break;

			case 1:
				npctalk "Hello I'm the second NPC!";
				break;

			default:
				npctalk "Hello I'm NPC #"[email protected]+".";
				break;
		}
		unitwalk getcharid(3),.npc_pos_x[[email protected]+1],.npc_pos_y[[email protected]+1];
	}
	end;

OnInit:
	getmapxy([email protected]$,[email protected],[email protected],BL_NPC,strnpcinfo(0));
	[email protected] = atoi(strnpcinfo(2));
	.npc_pos_x[[email protected]] = [email protected];
	.npc_pos_y[[email protected]] = [email protected];
}

prontera,157,170,6	duplicate(guide)	guide#1	650,1,1
prontera,157,162,6	duplicate(guide)	guide#2	650,1,1
prontera,157,153,6	duplicate(guide)	guide#3	650,1,1
prontera,152,150,6	duplicate(guide)	guide#4	650,1,1

 

Link to comment
Share on other sites

  • 0
Posted (edited)
4 hours ago, Skorm said:

Maybe something like this.

prontera,157,176,5	script	guide	650,1,1,{
end;
OnTouch:
	[email protected] = atoi(strnpcinfo(2));
	if([email protected]+1 == getarraysize(.npc_pos_x)) {
		dispbottom "End";
	}
	else {
		switch([email protected]) {
			case 0:
				npctalk "Hello I'm the first NPC!";
				break;

			case 1:
				npctalk "Hello I'm the second NPC!";
				break;

			default:
				npctalk "Hello I'm NPC #"[email protected]+".";
				break;
		}
		unitwalk getcharid(3),.npc_pos_x[[email protected]+1],.npc_pos_y[[email protected]+1];
	}
	end;

OnInit:
	getmapxy([email protected]$,[email protected],[email protected],BL_NPC,strnpcinfo(0));
	[email protected] = atoi(strnpcinfo(2));
	.npc_pos_x[[email protected]] = [email protected];
	.npc_pos_y[[email protected]] = [email protected];
}

prontera,157,170,6	duplicate(guide)	guide#1	650,1,1
prontera,157,162,6	duplicate(guide)	guide#2	650,1,1
prontera,157,153,6	duplicate(guide)	guide#3	650,1,1
prontera,152,150,6	duplicate(guide)	guide#4	650,1,1

 

Wow thank you for this, it's super close to what I'm looking for, except I'm looking to have 2 different types of NPCs, 1 type that just pushes the player on my guided path, and the other type talks to the player through a message like "hello there "+strcharinfo(3)+".". and then after the message it continues to push the player. To be quite honest, I'm trying to shrink this script from 600+ lines to less than 200. The reason I'm rewriting this is because, A. I already need to make huge adjustments and trying to make for easier editing and B. This file is huge and unoptimized.  The original script worked perfectly, just super hard to make changes.

 

1 thing that needs to stay is the chatbox staying open between NPCs since I don't think there's a way to stop players from moving off the path without there being a message box on the screen(I've blocked @commands on this map so they can't get out of this). Since NPC Block means no walking but I need movement and rather not teleport players.

 

Also not sure if it's possible, I have it set the player speed with @speed 50, and then reset to base, is there a way to instead set a temp speed that gets removed after this is complete that doesn't interfere with the players cards/equipment speed buffs unles they log out?

 

Edited by DR4LUC0N
Link to comment
Share on other sites

  • 0
3 hours ago, DR4LUC0N said:

Also not sure if it's possible, I have it set the player speed with @speed 50, and then reset to base, is there a way to instead set a temp speed that gets removed after this is complete that doesn't interfere with the players cards/equipment speed buffs unles they log out?

You could make it a bonus that just runs out after an amount of time and resets when they relog.

https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L6026

Link to comment
Share on other sites

  • 0
Posted (edited)
51 minutes ago, Skorm said:

You could make it a bonus that just runs out after an amount of time and resets when they relog.

https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L6026

Thanks for the help Skorm.

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.