PvP Guard menu

User Tag List

Thread: PvP Guard

Results 1 to 3 of 3
  1. #1
    choweyiii's Avatar Contributor
    Reputation
    91
    Join Date
    Aug 2010
    Posts
    127
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PvP Guard

    I wanted to make a guard that would become aggressive towards a player attacking another player. So far, I have achieved this, however when going to attack a hostile creature the guards attack. I thought maybe I could do a race check, but that doesn't seem to be working. Here's what I've got so far:

    Code:
    local GUARD_FEATURE = "Enabled" 
    local type, pairs = type, pairs;
    
    function UberFireBall(pUnit, Player) 
        pUnit:FullCastSpellOnTarget(30971, Player)
    end
    
    function PvPGuard_OnSpawn(pUnit, Event)
    	if (GUARD_FEATURE == "Enabled") then
            pUnit:RegisterEvent("Check_PvP", 1200, 0)
    	end
    	pUnit:EquipWeapons(1728, 1168, 11303)
    	pUnit:SetFaction(1775)
    end
    
    function Check_PvP(pUnit, Event, Player)
        local Player_W = pUnit:GetInRangePlayers()
        
        if (Player_W ~= nil) and (type(Player_W) == "table") then
    	
    	for index, player in pairs(Player_W) do
    	if (player:IsPlayerAttacking() == true) then
    	pUnit:RegisterEvent("UberFireBall", 1500, 4)
    	UberFireBall(pUnit, player)
    	if  (player:GetPlayerRace() == 1 or --alliance
    		player:GetPlayerRace() == 3 or
    		player:GetPlayerRace() == 4 or
    		player:GetPlayerRace() == 7 or
    		player:GetPlayerRace() == 11) then
    			pUnit:SetFaction(85) --Orgrimmar defender
    			end
    	if (player:GetPlayerRace() == 2 or --horde
    		player:GetPlayerRace() == 5 or 
    		player:GetPlayerRace() == 6 or
    		player:GetPlayerRace() == 8 or
    		player:GetPlayerRace() == 10) then
    			if (player:IsPlayerAttacking(player:GetPlayerRace(1)) then --trying to do a race check here, because mobs don't have races(?) and would't attack you unless you are targeting a hostile race
    			pUnit:SetFaction(12) --Orgrimmar defender
    			pUnit:Despawn(10000, 200)
    			
    			end
    		end
    	end
    	end 
    	end
    	end
    	
    
    function PvPGuard_OnCombat(pUnit, Event)
    pUnit:SetAttackTimer(100, 100)
    pUnit:CastSpell(43430)
    end
    
    function PvPGuard_OnLeaveCombat(pUnit, Event)
    pUnit:Despawn(500, 1000)
    pUnit:RemoveEvents()
    end
    
    RegisterUnitEvent(900056, 18, "PvPGuard_OnSpawn")
    RegisterUnitEvent(900056, 2, "PvPGuard_OnLeaveCombat")
    RegisterUnitEvent(900056, 1, "PvPGuard_OnCombat")
    Table code taken from google. I just spiced it up a bit. (tinyurl.com/9xd27t9)


    As always, I'll rep if you can help. Thanks!

    PvP Guard
  2. #2
    Harambeqt's Avatar Elite User CoreCoins Purchaser
    Reputation
    333
    Join Date
    Mar 2010
    Posts
    1,206
    Thanks G/R
    9/29
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "when going to attack a hostile creature the guards attack."

    attack a creature (npc) - hostile or neutral ?
    are the creatures of the same faction ?
    Last edited by Harambeqt; 10-16-2012 at 04:18 PM.
    Support the #1 WoW Emulator:
    http://arcemu.org/
    https://github.com/arcemu/arcemu
    - - -

  3. #3
    choweyiii's Avatar Contributor
    Reputation
    91
    Join Date
    Aug 2010
    Posts
    127
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, they are hostile. I made the guard's faction the Shattrath City Guard's faction, they help you if a hostile enemy attacks you, such as hogger, but if you attack back they'll get you.

Similar Threads

  1. PVP Guard
    By jackthripper in forum WoW EMU Questions & Requests
    Replies: 14
    Last Post: 07-23-2009, 02:35 AM
  2. Anti-PvP Guard script help
    By gimmeurlife in forum WoW EMU Questions & Requests
    Replies: 0
    Last Post: 06-16-2009, 12:32 AM
  3. PVP Guards
    By 1337 in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 03-07-2009, 04:21 PM
  4. [Request] Anti pvp Guard C++
    By mjas in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 10-14-2008, 05:41 AM
  5. How can you make guards that attack people who are PvP-ing ?
    By Wheeze201 in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 12-31-2007, 07:24 AM
All times are GMT -5. The time now is 09:19 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search