Party warper with map restrictions and online party member display.

ItsRas

New member
Messages
4
Points
0
Hello everyone,

Can anyone help me with my party warper? I have managed to convert the script from the other emulator to herc but the problem it won't warp you to your party member.

The error I am getting is this

image.png

The script:

Code:
prontera,156,182,0	script	Party Warper	4_F_SWORDMAN,{
	.@pid = getcharid(1);
	.@cid = getcharid(0);
	.@name$ = strcharinfo(0);
	if (!.@pid) end;
	getpartymember .@pid, 0;
	getpartymember .@pid, 1;
	getpartymember .@pid, 2;

	for (.@i = 0; .@i < $@partymembercount; .@i++)
		.@menu$ = .@menu$ + (.@name$ != $@partymembername$[.@i] ? $@partymembername$[.@i] : "") + ":";

	.@s = select(.@menu$) - 1;
	.@target$ = $@partymembername$[.@s];
	
	if (isloggedin($@partymemberaid[.@s], $@partymembercid[.@s])) {
		getmapxy .@map$, .@x, .@y, BL_PC, .@target$;
		if (setarray(.restricted_map$, .@map$) != -1)
			message .@name$,"This is a restricted map.";
		else
			warp .@map$, .@x, .@y, .@cid;
	} else 
		message .@name$, .@target$ + " is not online.";
	
	close;

	OnInit:
		setarray .restricted_map$[0], 
		"payon",
		"geffen";
		end;
}
Hope you guys can help me. Thanks in advance.

 
//Edited by Aeromesi
prontera,156,182,0 script Party Warper 4_F_SWORDMAN,{
.@pid = getcharid(1);
.@cid = getcharid(0);
.@name$ = strcharinfo(0);
if (!.@pid) end;
getpartymember .@pid, 0;
getpartymember .@pid, 1;
getpartymember .@pid, 2;

for (.@i = 0; .@i < $@partymembercount; .@i++)
.@menu$ = .@menu$ + (.@name$ != $@partymembername$[.@i] ? $@partymembername$[.@i] : "") + ":";

.@s = select(.@menu$) - 1;
.@target$ = $@partymembername$[.@s];

if (isloggedin($@partymemberaid[.@s], $@partymembercid[.@s])) {
getmapxy .@map$, .@x, .@y, UNITTYPE_PC, .@target$;
dispbottom "Player "+.@target$+" is at map "+.@map$+","+.@x+","+.@y+"";
if ( .@map$ == .restricted_map$[1]
|| .@map$ == .restricted_map$[2]
|| .@map$ == .restricted_map$[3]) {
message .@name$,"This is a restricted map.";
}
else
warp .@map$, .@x, .@y, .@cid;
} else
message .@name$, .@target$ + " is not online.";
dispbottom ""+.@map$+" is a restricted map.";
close;

OnInit:
setarray .restricted_map$[1],
"payon",
"geffen",
"alberta";
end;
}


I'm also attaching the txt file directly to my post. I offer a quick fix, not the best but it works. When adding a new map, make sure to add this same line but just change the number to the max amount of maps you have.
image.png

If you add a fourth map to the array in OnInit, make sure to copy and paste and add a .restricted_map$[4] to the line

So far it tests payon, geffen, and alberta, worked like a charm.

View attachment partywarper.txt

 
Last edited by a moderator:
Brilliant! Thank you so much for your help @Aeromesi. I appreciate it. ❤️
No problem, if you want make sure to // the dispbottoms, those were for me knowing if variable data was correct. I know it's not automatic like your rAthena version, but this just requires a slight edit I mentioned above when adding a new map, not much of a hassle. If you have problems figuring out adding new maps let me know, but I tried to explain it the best I could.

 
Last edited by a moderator:
Back
Top