Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is there easy way to know if player is in a city?
Author Message
fabiohvp
Apprentice
*

Posts: 23
Likes Given: 11
Likes Received: 5 in 4 posts
Joined: Jul 2018
Reputation: 0



Post: #1
Is there easy way to know if player is in a city?
1 - I want to forbid players from hiding and walk stealth inside cities if their skill is below 90.0, is there an easy way to know if the player is inside a city?
I could use region_flag_nobuilding but it would forbid to use inside houses and I don't want that.

2 - Also if is there a way to know if the player is inside a forest/swamp/desert would also be good to know.
(This post was last modified: 08-01-2018 03:28 PM by fabiohvp.)
08-01-2018 03:11 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,657
Likes Given: 234
Likes Received: 160 in 149 posts
Joined: Mar 2012
Reputation: 33



Post: #2
RE: Is there easy way to know if player is in a city?
Try this way open sphere_map0 and search for region blocks that starts with "a_town*", for each of these region add a tag like this:
Code:
[AREADEF a_townOcclo]
NAME=Ocllo
GROUP=Ocllo
P=3650,2519,0,0
RECT=3588,2460,3707,2685,0
RECT=3695,2558,3760,2705,0
FLAGS=region_flag_nobuilding|region_flag_guarded
EVENTS=r_default,r_default_rock,r_default_water,r_default_tree,r_default_grass
TAG.MUSIC=midi_ocllo
tag.city = 1

Then inside the @start (maybe better @prestart?) trigger of the hiding skill add this check
Code:
if <region.tag.city>  && <hiding> < 900
    sysmessage You can't hide here.


Same for wilderness region
08-01-2018 05:30 PM
Find all posts by this user Like Post Quote this message in a reply
fabiohvp
Apprentice
*

Posts: 23
Likes Given: 11
Likes Received: 5 in 4 posts
Joined: Jul 2018
Reputation: 0



Post: #3
RE: Is there easy way to know if player is in a city?
Thanks
08-02-2018 11:16 AM
Find all posts by this user Like Post Quote this message in a reply
xwerswoodx
Journeyman
*

Posts: 83
Likes Given: 4
Likes Received: 5 in 2 posts
Joined: Jun 2012
Reputation: 0

UoMMO

Post: #4
RE: Is there easy way to know if player is in a city?
But if every region defnames starts with a_town why does he need to add TAG.City for all of them,

Code:
IF (STRMATCH('<REGION.DEFNAME>', 'a_town*')) && <hiding> < 900
  SYSMESSAGE You can't hide here.
  RETURN 1
ENDIF
09-21-2018 12:14 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,657
Likes Given: 234
Likes Received: 160 in 149 posts
Joined: Mar 2012
Reputation: 33



Post: #5
RE: Is there easy way to know if player is in a city?
Maintenance.

If for example he wants to allow hiding in three different cities by using your IF he will have to add additional IF/ELSE statements, while by using a using tag he can just remove it from the areadef.
09-21-2018 12:57 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

This forum uses Lukasz Tkacz MyBB addons.