Jump to content
  • 0

detect users within the map


joelolopez

Question


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

is this possible???>>item that allows you to see other players within the map as if all the players within the map is your party member...displays markings on y0ur mini map...

Link to comment
Share on other sites

Recommended Posts


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

Example adding it to items.

2201,Sunglasses,Sunglasses,5,5000,,100,,0,,0,0xFFFFFFFF,7,2,512,,0,0,12,{ callfunc "players2minimap"; },{},{}
Functions:
function	script	players2minimap	{
	While((playerattached()?IsEquipped(.itemid):0)){
		getmapxy(.@N$,.@B,.@C,0);
		while((playerattached()?.@V<($PlayerNumber<=0?.@V+1:$PlayerNumber):0)){
			set .@V,.@V+1; 
			if(isloggedin(getd("$RecordAID"+.@V))) getmapxy(.@map$,.@x[.@V],.@y[.@V],0,rid2name(getd("$RecordAID"+.@V)));
			if( .@N$ == .@map$ && getd("$RecordAID"+.@V) != getcharid(3) && isloggedin(getd("$RecordAID"+.@V))){
				viewpoint 1,.@x[.@V],.@y[.@V],.@V,0xFF0000;
			}
			if(.@V>=$PlayerNumber){
				sleep2 1+.delay;
				for(set .@i,1;.@i<=$PlayerNumber;set .@i,.@i+1) viewpoint 2,.@x[.@i],.@y[.@i],.@i,0xFF0000;
			}
		}
		if(playerattached()){ set .@V,0; } else { break; }
	}
	end;
	
OnInit:
	//=-=-=-=-=Configuration=-=-=-=-=-=
	set .delay,0; // Delay between refresh in Milliseconds. Default is one Millisecond.
	set .itemid,2201; // ID of item being used.
	//You can change the color of the markers
	//By searching for "FF0000" and replacing
	//It with a Hexidecimal number.
	//=-=-=-=-=-=-=Skorm=-=-=-=-=-=-=-=
	//Credits to goddameit for 
	//file architecture and  BlackHoleEvent.
	//Special thanks to joelolopez for
	//The idea, and testing. <3
}

-	script	BlackHoleEvent	-1,{
OnPCLoginEvent:
	setd "$RecordAID"+set($PlayerNumber,$PlayerNumber+1),getcharid(3);
	end;
OnInit:
OnTimer1000:
	initnpctimer;
OnPCLogoutEvent:
	for(set .@i,1;.@i<=$PlayerNumber;set .@i,.@i+1)
	{
		if(!isloggedin(getd("$RecordAID"+.@i)))
		{
			set $PlayerNumber,$PlayerNumber-1;
			setd "$RecordAID"+.@i,getd("$RecordAID"+(.@i+1));
			setd "$RecordAID"+(.@i+1),0;
			set .@i,.@i-1;
		}
	}
	end;
}
Tested small update to make sure the script fully runs after unequipped. Fully working done!

Edited by Skorm
  • Upvote 1
Link to comment
Share on other sites


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

-	script	fi	-1,{
OnWhisperGlobal:
	if(!getgmlevel())
		end;
	getmapxy(.@N$,.@B,.@C,0);
	while( .@V < $PlayerNumber ){
		set .@V,.@V+1;
		getmapxy(.@map$,.@x,.@y,0,rid2name(getd("$RecordAID"+.@V)));
		if( .@N$ == .@map$ && getarg(3) == "" )||( getarg(3) != "" && getarg(3) == .@map$ ){
			viewpoint 0,.@x,.@y,.@V,0xFF0000;
		}
	}
}

-	script	BlackHoleEvent	-1,{
OnPCLoginEvent:
	setd "$RecordAID"+set($PlayerNumber,$PlayerNumber+1),getcharid(3);
	end;
OnInit:
OnTimer5000:
	initnpctimer;
	for(set .@i,1;.@i<=$PlayerNumber;set .@i,.@i+1)
	{
		if(!isloggedin(getd("$RecordAID"+.@i)))
		{
			if(!getd("$RecordAID"+.@i))
			{
				set $PlayerNumber,0;
				break;
			}
			setd "$RecordAID"+.@i,getd("$RecordAID"+(.@i+1));
			setd "$RecordAID"+(.@i+1),0;
			set .@i,.@i-1;
		}
	}
	end;
}

I think only 3 of them can be on the map at once... but w/e.

Edited by Skorm
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

not working ahm ,, is there any way i can make this work

Link to comment
Share on other sites


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

I forgot to remove some old parts it's working now. I'm going to make one that updates constantly though give me a sec.

-	script	fis	-1,{
OnWhisperGlobal:
	if(!getgmlevel())
		end;
	getmapxy(.@N$,.@B,.@C,0);
	while( .@V < $PlayerNumber ){
		set .@V,.@V+1;
		getmapxy(.@map$,.@x,.@y,0,rid2name(getd("$RecordAID"+.@V)));
		if( .@N$ == .@map$ ){
			viewpoint 0,.@x,.@y,.@V,0xFF0000;
		}
	}
}

-	script	BlackHoleEvent	-1,{
OnPCLoginEvent:
	setd "$RecordAID"+set($PlayerNumber,$PlayerNumber+1),getcharid(3);
	end;
OnInit:
OnTimer5000:
	initnpctimer;
	for(set .@i,1;.@i<=$PlayerNumber;set .@i,.@i+1)
	{
		if(!isloggedin(getd("$RecordAID"+.@i)))
		{
			if(!getd("$RecordAID"+.@i))
			{
				set $PlayerNumber,0;
				break;
			}
			setd "$RecordAID"+.@i,getd("$RecordAID"+(.@i+1));
			setd "$RecordAID"+(.@i+1),0;
			set .@i,.@i-1;
		}
	}
	end;
}
Edited by Skorm
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

sir can you use callfunction with this , it would be much cooler if equipable item

Link to comment
Share on other sites


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

Lol I see where you're going with this.

- script fis -1,{OnWhisperGlobal:if(!getgmlevel())end;getmapxy(.N$,.B,.C,0);if(atoi(@whispervar0$)>0&&.s>0) {dispbottom "Player View is already active!";end;} else if(!atoi(@whispervar0$)){set .s,0;dispbottom "Closing View!";end;} else {set .s,1;dispbottom "Activating View!";}setnpctimer 0; attachnpctimer(strcharinfo(0)); startnpctimer;sleep2 2;while(.V<$PlayerNumber&&.s){set .V,.V+1;getmapxy(.map$,.x,.y,0,rid2name(getd("$RecordAID"+.V)));if( .N$ == .map$ ){viewpoint 1,.x,.y,.V,0xFF0000;sleep2 1;viewpoint 2,.x,.y,.V,0xFF0000;}if(.V>=$PlayerNumber) set .V,0;}sleep2 14999;end;OnTimer1:stopnpctimer;sleep2 1;set .Q,$PlayerNumber;while(.Q>0&&.s){set .Q,.Q-1;getmapxy(.@map$,.@x,.@y,0,rid2name(getd("$RecordAID"+.Q)));if( .N$ == .@map$ ){sleep2 1;viewpoint 1,.@x,.@y,.Q,0xFF0000;sleep2 1;viewpoint 2,.@x,.@y,.Q,0xFF0000;}if(.Q<=1) set .Q,$PlayerNumber;}end;}- script BlackHoleEvent -1,{OnPCLoginEvent:setd "$RecordAID"+set($PlayerNumber,$PlayerNumber+1),getcharid(3);end;OnInit:OnTimer5000:initnpctimer;for(set .@i,1;.@i<=$PlayerNumber;set .@i,.@i+1){if(!isloggedin(getd("$RecordAID"+.@i))){if(!getd("$RecordAID"+.@i)){set $PlayerNumber,0;break;}setd "$RecordAID"+.@i,getd("$RecordAID"+(.@i+1));setd "$RecordAID"+(.@i+1),0;set .@i,.@i-1;}}end;}

^ Can't be called from a function because of the Timer I added to try and fix the blinking, but I'll remove that re-add the character variables and call it from a function inside an item.

npc:fis 1 to activate 0 to disable.

Edit:

- script fis -1,{OnWhisperGlobal:if(!getgmlevel())end;getmapxy(.@N$,.@B,.@C,0);if(atoi(@whispervar0$)>0&&.@s>0) {dispbottom "Player View is already active!";end;} else if(!atoi(@whispervar0$)){set .@s,0;dispbottom "Closing View!";end;} else {set .@s,1;dispbottom "Activating View!";}while(.@V<$PlayerNumber&&.@s){set .@V,.@V+1;getmapxy(.@map$,.@x[.@V],.@y[.@V],0,rid2name(getd("$RecordAID"+.@V)));if( .@N$ == .@map$ ){viewpoint 1,.@x[.@V],.@y[.@V],.@V,0xFF0000;}if(.@V>=$PlayerNumber){sleep2 1;for(set .@i,1;.@i<$PlayerNumber;set .@i,.@i+1) viewpoint 2,.@x[.@i],.@y[.@i],.@i,0xFF0000;set .@V,0;}}end;}

^ much better way of doing it no more blinking ^_^. Sorry Forums keeps putting my code into one line. T_T

Edited by Skorm
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

sir can you do it like this

 

when headgear equipped

 

menu appear

 

selection detect and cancel

 

when the user select "detect"

 

then the players within the map will appear on

the mini map with blinking marks.

Edited by joelolopez
Link to comment
Share on other sites


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

Probably not what I plan to do is just activate when you equipped the headgear and when you remove it, the markings will go away. No menu because bleh. I'll add that after I'm done if you still want it.

Right now I'm just working out the best way to show the markings.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

okay sir /ok/no1

Link to comment
Share on other sites


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

Example adding it to items.

2201,Sunglasses,Sunglasses,5,5000,,100,,0,,0,0xFFFFFFFF,7,2,512,,0,0,12,{ callfunc "players2minimap"; },{},{}
Functions:
function	script	players2minimap	{
OnWhisperGlobal:
	While((playerattached()?IsEquipped(2201):0)){
		if(!playerattached()){ end; }
		getmapxy(.@N$,.@B,.@C,0);
		while((playerattached()?.@V<($PlayerNumber<=0?.@V+1:$PlayerNumber):0)){
			if(!playerattached()){ end; }
			set .@V,.@V+1; 
			if(isloggedin(getd("$RecordAID"+.@V))) getmapxy(.@map$,.@x[.@V],.@y[.@V],0,rid2name(getd("$RecordAID"+.@V)));
			if( .@N$ == .@map$ && getd("$RecordAID"+.@V) != getcharid(3) && isloggedin(getd("$RecordAID"+.@V))){
				viewpoint 1,.@x[.@V],.@y[.@V],.@V,0xFF0000;
			}
			if(.@V>=$PlayerNumber){
				sleep2 1;
				for(set .@i,1;.@i<=$PlayerNumber;set .@i,.@i+1) viewpoint 2,.@x[.@i],.@y[.@i],.@i,0xFF0000;
			}
		}
		if(playerattached()){ set .@V,0; } else { break; }
	}
	end;
}

-	script	BlackHoleEvent	-1,{
OnPCLoginEvent:
	setd "$RecordAID"+set($PlayerNumber,$PlayerNumber+1),getcharid(3);
	end;
OnInit:
OnTimer1000:
	initnpctimer;
OnPCLogoutEvent:
	for(set .@i,1;.@i<=$PlayerNumber;set .@i,.@i+1)
	{
		if(!isloggedin(getd("$RecordAID"+.@i)))
		{
			set $PlayerNumber,$PlayerNumber-1;
			setd "$RecordAID"+.@i,getd("$RecordAID"+(.@i+1));
			setd "$RecordAID"+(.@i+1),0;
			set .@i,.@i-1;
		}
	}
	end;
}
Tested small update to make sure the script fully runs after unequipped. Fully working done!

Post moved to answered post.

Edited by Skorm
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

sir its working great!!! but there still some bugs left like when i unequip the headgear the function still running

 

i still able to detect players w/o the headgear

Edited by joelolopez
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

i notice that in order to refresh the minimap i need to logout w/o the headgear equipped...any solution for this sir

Edited by joelolopez
Link to comment
Share on other sites


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

Yeah It's fixed now the script wasn't running for a final time after the glasses were unequipped. Just added a second loop to fix the problem. Make sure you restart your server after implementing the new script. Thanks.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

the headgear doesnt detect the players in the map when the players is already in map at the first place

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

sir i had an infinity loop..

Link to comment
Share on other sites


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

Hmm, how many players did you test it with? I updated the script a little bit the last loop wasn't running enough to remove all the icons, and you should stop double posting just update your existing post I refresh the page.

Edit: I'm getting no infinity loop, and it is detecting players on the map previously. The only problem I seem to have is after warping off the map the red dots still exist from the previous map. but I know how to fix that as well.

Edited by Skorm
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

i tried 4 players and it detects all 4 but when i unequipped the 3 red marks disappear but the 1 red mark is still there and blinking

Link to comment
Share on other sites


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

Make sure you're grabbing my code from that same post after refreshing the page because I'm updating it as you find buggs. Also REMEMBER to restart your server after you added the code, because @reloadscripts is tricky with functions. Thanks.

Also I think you're having problems because the OnEquipped area of the item script only runs when the item's equipped try moving it to the first section, but I might need to add something to avoid stack continuum error.

Edited by Skorm
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

yep i know that sir lol ,

 

just another update sir when you login w/o the headgear the function wont run

unless you're going to logout again wearing the headgear

 

and when you login again that is the time u will be able to detect the players 1 by 1

 

1 logout and login 1 player detected ,some times all players are gone

Edited by joelolopez
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

code post 6:14 = unable to detect players after loging out and loging in with headgear

Link to comment
Share on other sites


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

I was able to emulate that infinity loop you were talking about. I added some kind of insanity check lol I had a few sleep2 1; in there aswell and it wasn't doing it but I think I got the problem so I took them out.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

code 6:46

 

first login w/ headgear okay

first login w/o headgear okay

 

when remove and equip again okay

 

but when logout  w/equip and login again

mark disappear in the mini map :<

Link to comment
Share on other sites


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

I think this is happening because when you logout with it on you literally break the function because it's still looping and looking for the account, and being a function it doesn't spit out that information to the prompt. Meh I can remove character variables and instead make temporary npc variables for each account using the glasses. Alternativly we might just beable to unequipped them when the user logs out with the OnPCLogoutEvent label.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

sir wheres the code with onpclogout, just post your script sir so that i can test em out /ok

Link to comment
Share on other sites


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

It's the way blackhole stores the variables... sec sec

From what I can tell it's working now, but you seem to be able to find bugs that I otherwise wouldn't. Lol

See this post http://rathena.org/board/topic/80727-detect-users-within-the-map/?p=190265

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