Thread Tools Display Modes
11/23/14, 05:03 AM   #1
klaro00
 
klaro00's Avatar
Join Date: Apr 2014
Posts: 31
How to determine PvE/PvP

Hi,

if I wanted to find out wether I am in a PvP or in a PvE zone (or, to be more precise: wether all NPCs, mobs and players ar on level 50 or not), what would be the safest way? The following method seems to do what I need.

Lua Code:
  1. local function isInPVEZone()
  2.     return (GetMapContentType() ~= MAP_CONTENT_AVA)
  3. end
  4.  
  5. local function isInPVPZone()
  6.     return (GetMapContentType() == MAP_CONTENT_AVA)
  7. end

I just like to know if this code works under all circumstances. Is it the correct approach to investigate the result of "GetMapContentType()"? Maybe there is another, better, safer way to find out if I am currently in PvP or PvE? Can someone confirm that this way of testing for PvP/PvE is correct?

// Klaro

Last edited by klaro00 : 11/23/14 at 05:05 AM. Reason: typo
  Reply With Quote
11/23/14, 05:52 AM   #2
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Lua Code:
  1. IsPlayerInAvAWorld()
returns true if player is in AvA world.
  Reply With Quote
11/24/14, 01:25 AM   #3
klaro00
 
klaro00's Avatar
Join Date: Apr 2014
Posts: 31
Thank you.

// Klaro
  Reply With Quote
09/11/21, 05:46 PM   #4
Phinix
 
Phinix's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 186
Originally Posted by Ayantir View Post
Lua Code:
  1. IsPlayerInAvAWorld()
returns true if player is in AvA world.
Will this return true for battlegrounds as well?
  Reply With Quote
09/12/21, 12:33 AM   #5
Scootworks
 
Scootworks's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2014
Posts: 312
https://wiki.esoui.com/PvP_Zone_Detection
  Reply With Quote
09/13/21, 07:08 AM   #6
zelenin
AddOn Author - Click to view addons
Join Date: Nov 2018
Posts: 7
Originally Posted by Phinix View Post
Will this return true for battlegrounds as well?
Code:
if IsPlayerInAvAWorld() or IsActiveWorldBattleground() then
  Reply With Quote
09/13/21, 09:48 PM   #7
Phinix
 
Phinix's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 186
Thanks for clarifying. That link is very helpful with the visual layout of the overlap of different functions.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » How to determine PvE/PvP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off