[Lua] Help with script - RemoveEvents() bugged menu

User Tag List

Results 1 to 4 of 4
  1. #1
    gospag's Avatar Member
    Reputation
    1
    Join Date
    Jul 2009
    Posts
    12
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Lua] Help with script - RemoveEvents() bugged

    First of all, hi! XD

    I need some help with my little boss encounter script here. I'll post the code then explain what I wanted to do and what doesn't work :\

    Code:
    function OnSpawn(pUnit, Event)
    pUnit:SendChatMessage(12,0,"I'm alive!")
    pUnit:SpawnCreature(13442, 233.11, -344.07, 42.48, 5.28, 1216, 0)
    end
    
    function OnAttack(pUnit, Event)
    pUnit:SendChatMessage(12,0,"Die!")
    end
    
    function OnDeath(pUnit, Event)
    pUnit:SendChatMessage(12,0,"Ohno! I'm dead")
    pUnitespawn(1,0)
    pUnit:RemoveEvents()
    pUnit:SpawnCreature(11947, 201.98, -358.67, 56.38, 5.55, 1214, 0)
    end
    
    
    RegisterUnitEvent(11949, 1, "OnAttack")
    RegisterUnitEvent(11949, 4, "OnDeath")
    RegisterUnitEvent(11949, 18, "OnSpawn")
    The main idea is that when I spawn the boss, it says "I'm alive!" and it spawns one add (remember, this on spawn). So far so good.

    Then when someone attacks the boss, it says "Die!". (nothing special, this works)

    Now.. The problem occurs when the boss dies:

    It despawns itself -> pUnitespawn(1,0) - works
    It should remove the events (it should despawn the add which was spawned at the start) -> pUnit:RemoveEvents() - doesn't work
    It spawns a secondary boss -> pUnit:SpawnCreature(bla bla) - works

    So I have no idea why doesn't the add despawn when the boss dies...
    The emulator world.exe shows no error.

    Any idea what to do in order to despawn the add?

    Thanks in advance :\

    [Lua] Help with script - RemoveEvents() bugged
  2. #2
    Reflection's Avatar Legendary
    Reputation
    783
    Join Date
    Mar 2008
    Posts
    3,377
    Thanks G/R
    1/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think RemoveEvents() would work on something that has already occured.

    Freelance Digital Artist
    https://reflectionartwork.deviantart.com
    You did not desert me
    My brothers in arms


  3. #3
    gospag's Avatar Member
    Reputation
    1
    Join Date
    Jul 2009
    Posts
    12
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well yea, I was thinking the same. The spawned mobs have no link to the boss after they're spawned... But every tutorial said that RemoveEvents() should despawn the npcs... That's why I posted here :\

    Any idea on how to fix the despawns?

  4. #4
    Dynashock's Avatar Contributor

    Reputation
    176
    Join Date
    Nov 2007
    Posts
    203
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unit:RemoveEvents() removes events that have been registered by the unit. Thus it would remove an event if you registered it like Unit:RegisterEvent("DoThis", 5000, 0). If you wouldn't remove this event it would keep occuring every 5 seconds.

    Mind you, remove events removes ALL events currently registered with the unit.
    Ignorance is bliss.

Similar Threads

  1. New to LUA need help with script
    By nickelo in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 06-30-2008, 01:34 PM
  2. [Help] New to LUA, Need help with script.
    By nickelo in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 03-14-2008, 11:23 PM
  3. [Help] i need Lua help with this script...
    By Ellenor in forum World of Warcraft Emulator Servers
    Replies: 25
    Last Post: 03-03-2008, 03:45 PM
  4. i need help with script, im a noob
    By orangegold in forum WoW UI, Macros and Talent Specs
    Replies: 2
    Last Post: 10-27-2007, 05:47 PM
  5. help with scripts
    By orangegold in forum World of Warcraft General
    Replies: 0
    Last Post: 03-28-2007, 05:50 PM
All times are GMT -5. The time now is 06:36 PM. 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