Jump to content
  • 0

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


DR4LUC0N

Question


  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   6
  • Joined:  04/04/12
  • Last Seen:  

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 .@mapx,156,156,156,153;
setarray .@mapy,170,161,153,150;
setarray .@guidetype,0,0,1,0;
.1a = ++
OnTouch:
	if(.guide == 0) {
		unitwalk getcharid(3),.@mapx[.guide[.1a]],.@mapy[.guide[.1a]];
		set .guide,.1a;
	}
	if(.guide >= 1 && .@guidetype[.guide] == 0) {
		unitwalk getcharid(3),.@mapx[.guide[.1a]],.@mapy[.guide[.1a]];
		set .guide, .guide++;
	}
//	if(.guide >= 1 && .@end >= 0 && .@guidetype[.guide] == 1) {
//		.guide++;
//		mes "Test complete";
//		close;
//		unitwalk getcharid(3),.@mapx[.guide],.@mapy[.guide];
//		end;
//	}
//	else if(.@end >= 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

  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   381
  • Joined:  02/03/12
  • Last Seen:  

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 .@mapx,156,156,156,153;
setarray .@mapy,170,161,153,150;
setarray .@guidetype,0,0,1,0;
.1a = ++
OnTouch:
	if(.guide == 0) {
		unitwalk getcharid(3),.@mapx[.guide[.1a]],.@mapy[.guide[.1a]];
		set .guide,.1a;
	}
	if(.guide >= 1 && .@guidetype[.guide] == 0) {
		unitwalk getcharid(3),.@mapx[.guide[.1a]],.@mapy[.guide[.1a]];
		set .guide, .guide++;
	}
//	if(.guide >= 1 && .@end >= 0 && .@guidetype[.guide] == 1) {
//		.guide++;
//		mes "Test complete";
//		close;
//		unitwalk getcharid(3),.@mapx[.guide],.@mapy[.guide];
//		end;
//	}
//	else if(.@end >= 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:
	.@index = atoi(strnpcinfo(2));
	if(.@index+1 == getarraysize(.npc_pos_x)) {
		dispbottom "End";
	}
	else {
		switch(.@index) {
			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 #"+.@index+".";
				break;
		}
		unitwalk getcharid(3),.npc_pos_x[.@index+1],.npc_pos_y[.@index+1];
	}
	end;

OnInit:
	getmapxy(.@map$,.@x,.@y,BL_NPC,strnpcinfo(0));
	.@index = atoi(strnpcinfo(2));
	.npc_pos_x[.@index] = .@x;
	.npc_pos_y[.@index] = .@y;
}

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

  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   6
  • Joined:  04/04/12
  • Last Seen:  

4 hours ago, Skorm said:

Maybe something like this.


prontera,157,176,5	script	guide	650,1,1,{
end;
OnTouch:
	.@index = atoi(strnpcinfo(2));
	if(.@index+1 == getarraysize(.npc_pos_x)) {
		dispbottom "End";
	}
	else {
		switch(.@index) {
			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 #"+.@index+".";
				break;
		}
		unitwalk getcharid(3),.npc_pos_x[.@index+1],.npc_pos_y[.@index+1];
	}
	end;

OnInit:
	getmapxy(.@map$,.@x,.@y,BL_NPC,strnpcinfo(0));
	.@index = atoi(strnpcinfo(2));
	.npc_pos_x[.@index] = .@x;
	.npc_pos_y[.@index] = .@y;
}

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

  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   381
  • Joined:  02/03/12
  • Last Seen:  

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

  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  135
  • Reputation:   6
  • Joined:  04/04/12
  • Last Seen:  

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