Jump to content
  • 0

Warp to savepoint when respawn within certain coordinates


johnbond

Question


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

Is there a way to script that GMs below level 80 will be warped back to savepoint if they respawn in a certain set of cells of a map?

 

This is because I would want my game masters to be warped back to savepoint if they try to enter the "treasure box room" of castles. The problem is the "treasure box room" map name is the same with the castle so using OnPCLoadMapEvent is I think not appropriate here. I want Gms to be able to go inside castles but NOT in treasure rooms.

 

Maybe if there is some way that respawning within certain coordinates of a given map will warp them to savepoint.

Can somebody do this for me? I would like to be able to add several coordinates for all my treasure rooms. I can set cells of the treasure rooms manually within the script.

Kindly anyone knowledgeable please help.

 

Thank you.

Link to comment
Share on other sites

17 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Wait why did I use a function?!

//5x5 area around the npc
prtg_cas04,160,150,1	script	gmwarpouttreasure	-1,6,6,{
OnTouch:
	if (getgmlevel() <= 1 && getguildmasterid( getcastledata( strcharinfo(3),1 ) ) != getcharid(0))
		mes "You are not a Guild Master of this Castle";
	else if (getgmlevel() > 1 && getgmlevel() <= 98)
		mes "GAME MASTER, you are not allowed here.";
	else
		end;
	close2; 
	warp "SavePoint",0,0;
	end;
}

prtg_cas05,281,176,1	duplicate(gmwarpouttreasure)	gmwarpouttreasure2	-1,6,6
// others duplicate for other castle
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

You can use a NPC with OnTouch

prontera,160,150,0	script	-1,5,5,{// 5x5 area around the npc
OnTouch:
	if (getgmlevel() > 98)
		warp "Savepoint",0,0;
	end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

 

You can use a NPC with OnTouch

prontera,160,150,0	script	-1,5,5,{// 5x5 area around the npc
OnTouch:
	if (getgmlevel() > 98)
		warp "Savepoint",0,0;
	end;
}

 

 

This is great! I will test this and let you know.

Btw, what if I also want the non-guild masters to be warped out of the treasure room? What script line to add?

 

 

Thanks for the reply! :)

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

non-guild masters to be warped out of the treasure room?

well add getguildmasterid( getcastledata( strnpcinfo(4),1 ) ) != getcharid(0)

  • getcastledata( strnpcinfo(4),1 ) return the castle owner guild id
  • getguildmasterid return the char id of the guild master of the guild
if (getgmlevel() > 98 || getguildmasterid( getcastledata( strnpcinfo(4),1 ) ) != getcharid(0) )
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

 

non-guild masters to be warped out of the treasure room?

well add getguildmasterid( getcastledata( strnpcinfo(4),1 ) ) != getcharid(0)

  • getcastledata( strnpcinfo(4),1 ) return the castle owner guild id
  • getguildmasterid return the char id of the guild master of the guild
if (getgmlevel() > 98 || getguildmasterid( getcastledata( strnpcinfo(4),1 ) ) != getcharid(0) )

 

 

Its working! But I made a little modification based on my needs:

 

//5x5 area around the npc
prtg_cas04,160,150,1	script	gmwarpouttreasure	-1,5,5,{
OnTouch:

set @GID,getcharid(2);
if (getgmlevel() <= 1 && (strcharinfo(0)!=getguildmaster(@GID)) ) {
mes "You are not a Guild Master of this Castle";
close2; 
warp "SavePoint",0,0;
end;
}

if ((getgmlevel() >= 2) && (getgmlevel() <= 98)) {
mes "GAME MASTER, you are not allowed here.";
close2; 
warp "SavePoint",0,0;
end;
}
	end;
}

But how to make checks to warp him out if he is guild master but does NOT own that castle .

If guild master owning that same castle then he will NOT be warped.

If not guild master then warp out also.

 

Let's say "prtg_cas04", then I will just make copies of this script per castle.

 

Please also optimize what I did above.

 

Thank you Sir Capuche! You are a great help. :)

 

 

 

 

 

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

 

But how to make checks to warp him out if he is guild master but does NOT own that castle .

  • getcastledata( strnpcinfo(4),1 ) return the castle owner guild id

Try

//5x5 area around the npc
prtg_cas04,160,150,1	script	gmwarpouttreasure	-1,5,5,{
OnTouch:
	if (getgmlevel() <= 98) {
		if (getgmlevel() <= 1 && getguildmasterid( getcastledata( strnpcinfo(4),1 ) ) != getcharid(0))
			mes "You are not a Guild Master of this Castle";
		else if (getgmlevel() <= 98)
			mes "GAME MASTER, you are not allowed here.";
		close2; 
		warp "SavePoint",0,0;
	}
	end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

 

Try

//5x5 area around the npc
prtg_cas04,160,150,1	script	gmwarpouttreasure	-1,5,5,{
OnTouch:
	if (getgmlevel() <= 98) {
		if (getgmlevel() <= 1 && getguildmasterid( getcastledata( strnpcinfo(4),1 ) ) != getcharid(0))
			mes "You are not a Guild Master of this Castle";
		else if (getgmlevel() <= 98)
			mes "GAME MASTER, you are not allowed here.";
		close2; 
		warp "SavePoint",0,0;
	}
	end;
}

 

Sir,

 

It is already working when GM below 97 walks to it, gm gets warped.

Working when GM 99 walks to it, npc does not say anything. Correct.

It is already working when a non-guild master walk to it, he gets warped.

 

But not working when the player is guild master and owner of castle payg_cas03. He gets warped out also. I also loaded the NPC at payg_cas03. It seems it was not able to properly check who owns the castle and who the guildmaster owning.

 

 

Thank you sir.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

I just figured out yes...

//5x5 area around the npc
prtg_cas04,160,150,1	script	gmwarpouttreasure	-1,5,5,{
OnTouch:
	if (getgmlevel() <= 1 && getguildmasterid( getcastledata( strnpcinfo(4),1 ) ) != getcharid(0))
		mes "You are not a Guild Master of this Castle";
	else if (getgmlevel() <= 98)
		mes "GAME MASTER, you are not allowed here.";
	else
		end;
	close2; 
	warp "SavePoint",0,0;
	end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

 

I just figured out yes...

//5x5 area around the npc
prtg_cas04,160,150,1	script	gmwarpouttreasure	-1,5,5,{
OnTouch:
	if (getgmlevel() <= 1 && getguildmasterid( getcastledata( strnpcinfo(4),1 ) ) != getcharid(0))
		mes "You are not a Guild Master of this Castle";
	else if (getgmlevel() <= 98)
		mes "GAME MASTER, you are not allowed here.";
	else
		end;
	close2; 
	warp "SavePoint",0,0;
	end;
}

 

 

Its still not working sir. When the guild master owning the castle prtg_cas04 walks to it, the NPC still warps him out. Intended behavior is the guildmaster of that castle SHOULD BE ALLOWED. If the player does not own the castle then not allowed.

 

Thank you Sir.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

My bad try

//5x5 area around the npc
prtg_cas04,160,150,1	script	gmwarpouttreasure	-1,5,5,{
OnTouch:
	if (getgmlevel() <= 1 && getguildmasterid( getcastledata( strnpcinfo(4),1 ) ) != getcharid(0))
		mes "You are not a Guild Master of this Castle";
	else if (getgmlevel() > 1 && getgmlevel() <= 98)
		mes "GAME MASTER, you are not allowed here.";
	else
		end;
	close2; 
	warp "SavePoint",0,0;
	end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

 

My bad try

//5x5 area around the npc
prtg_cas04,160,150,1	script	gmwarpouttreasure	-1,5,5,{
OnTouch:
	if (getgmlevel() <= 1 && getguildmasterid( getcastledata( strnpcinfo(4),1 ) ) != getcharid(0))
		mes "You are not a Guild Master of this Castle";
	else if (getgmlevel() > 1 && getgmlevel() <= 98)
		mes "GAME MASTER, you are not allowed here.";
	else
		end;
	close2; 
	warp "SavePoint",0,0;
	end;
}

Same problem sir, when a guildmaster owns the castle he still cannot get through. Message is "You are not a Guild Master of this Castle";

 

It looks like it cannot see who the owner for the castle is. He should be allowed inside because he owns the castle. All other checks are working perfectly except this one. it seems the problem is somewhere here:

 

if (getgmlevel() <= 1 && getguildmasterid( getcastledata( strnpcinfo(4),1 ) ) != getcharid(0))

   

 

Thank you Sir Capuche.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

That's weird I just tested it and it's working, i can't reproduce your problem. Btw your coordinates for the treasure room is wrong, ref. https://github.com/rathena/rathena/blob/master/npc/guild/agit_main.txt#L594

(if you take this coordinate, put a bigger x/y trigger)

do you use rathena?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

I think his using 3ceam xD I saw his other post.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

That's weird I just tested it and it's working, i can't reproduce your problem. Btw your coordinates for the treasure room is wrong, ref. https://github.com/rathena/rathena/blob/master/npc/guild/agit_main.txt#L594

(if you take this coordinate, put a bigger x/y trigger)

do you use rathena?

 

I use 3ceam sorry. :)

About the coordinates, its just for testing first. I just put it near the entrance portal for tests.

 

 

I think his using 3ceam xD I saw his other post.

 

Yes.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

well then 3ceam doesn't support strnpcinfo(4)  4 - The name of the map the NPC is in.

try

//5x5 area around the npc
prtg_cas04,160,150,1	script	gmwarpouttreasure	-1,5,5,{
OnTouch:
	callfunc "F_gmwarpouttreasure", "prtg_cas04";
}
function	script	F_gmwarpouttreasure	{
	if (getgmlevel() <= 1 && getguildmasterid( getcastledata( getarg(0),1 ) ) != getcharid(0))
		mes "You are not a Guild Master of this Castle";
	else if (getgmlevel() > 1 && getgmlevel() <= 98)
		mes "GAME MASTER, you are not allowed here.";
	else
		end;
	close2; 
	warp "SavePoint",0,0;
	end;
}

just need to call the fuction for the other castle

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

well then 3ceam doesn't support strnpcinfo(4)  4 - The name of the map the NPC is in.

try

//5x5 area around the npc
prtg_cas04,160,150,1	script	gmwarpouttreasure	-1,5,5,{
OnTouch:
	callfunc "F_gmwarpouttreasure", "prtg_cas04";
}
function	script	F_gmwarpouttreasure	{
	if (getgmlevel() <= 1 && getguildmasterid( getcastledata( getarg(0),1 ) ) != getcharid(0))
		mes "You are not a Guild Master of this Castle";
	else if (getgmlevel() > 1 && getgmlevel() <= 98)
		mes "GAME MASTER, you are not allowed here.";
	else
		end;
	close2; 
	warp "SavePoint",0,0;
	end;
}

just need to call the fuction for the other castle

 

 

Wow it's already working! You are awesome Sir!

But how about if I need to also enable this on other castles as well? Shall I just copy this script and change coordinates? But what about the variables, wont they be identical variables which will conflict?

 

Thank you Sir!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

 

Wait why did I use a function?!

//5x5 area around the npc
prtg_cas04,160,150,1	script	gmwarpouttreasure	-1,6,6,{
OnTouch:
	if (getgmlevel() <= 1 && getguildmasterid( getcastledata( strcharinfo(3),1 ) ) != getcharid(0))
		mes "You are not a Guild Master of this Castle";
	else if (getgmlevel() > 1 && getgmlevel() <= 98)
		mes "GAME MASTER, you are not allowed here.";
	else
		end;
	close2; 
	warp "SavePoint",0,0;
	end;
}

prtg_cas05,281,176,1	duplicate(gmwarpouttreasure)	gmwarpouttreasure2	-1,6,6
// others duplicate for other castle

 

 

Awesome Sir its already working!

 

Thank you very very much. :D

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