Strange Bug with Eluna, need help menu

Shout-Out

User Tag List

Results 1 to 2 of 2
  1. #1
    Vale the Violet Mote's Avatar Member
    Reputation
    6
    Join Date
    May 2016
    Posts
    3
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Strange Bug with Eluna, need help

    I am absolutely stumped. I have a function prepareNPCs() that registers an event to a list of creatures. I call this when Eluna reloads. It works as expected.

    But if I call prepareNPCs() later, after I add more items to the list, the event function never gets fired, as if the RegisterCreatureEvent doesn't work.

    I'm baffled. What's the difference between registering NPCs on eluna reload and registering them later?

    Call at startup:

    (I've made it SendWorldMessage the command)

    12:32:42 RegisterCreatureEvent(299,4,mobKill)
    12:32:42 RegisterCreatureEvent(69,4,mobKill)
    12:32:42 RegisterCreatureEvent(1995,4,mobKill)

    Call after adding another item to the list and then using a command that calls the prepareNPCs() function

    12:33:13 RegisterCreatureEvent(299,4,mobKill)
    12:33:13 RegisterCreatureEvent(69,4,mobKill)
    12:33:13 RegisterCreatureEvent(1995,4,mobKill)
    12:33:13 RegisterCreatureEvent(721,4,mobKill)
    12:33:13 Reloaded.

    And yet the event does not fire when an npc with entry 721 is killed.

    Only when I reload Eluna again does the event get properly registered.

    Code:
    local function prepareNPCs()
    	local dbRes = WorldDBQuery("SELECT nentry,type FROM v_npc");
    	if dbRes ~= nil then
    		for x=1,dbRes:GetRowCount(),1 do
    			RegisterCreatureEvent(dbRes:GetInt32(0),4,mobKill);
    			SendWorldMessage("RegisterCreatureEvent("..dbRes:GetInt32(0)..",4,mobKill)");
    			if dbRes:GetInt8(1)==1 then
    				RegisterCreatureEvent(dbRes:GetInt32(0),37,VLHandler.qremove,1);
    			end
    			dbRes:NextRow();
    		end
    	end
    end
    
    
    local function vcomms(event,player,command)
    
    	if player:GetGMRank()>=3 then
    		if command=="vtest" then
    			prepareNPCs();
    			player:SendBroadcastMessage("Reloaded.");
    			return false;
    		end
    	end
    
    end
    
    local function onLoad()
    	RegisterPlayerEvent(42, vcomms);
    	prepareNPCs();
    	RegisterGameObjectGossipEvent(lGOB,1,VLHandler.useBag);
    end
    
    onLoad();
    I don't understand what is making a world of difference here. I've registered events for creatures post-load before, and I've never encountered this problem.


    Thanks in advance for any help.

    Strange Bug with Eluna, need help
  2. #2
    Vale the Violet Mote's Avatar Member
    Reputation
    6
    Join Date
    May 2016
    Posts
    3
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rochet has the answer:

    If a creature does not have any lua events registered, then due to the system using the AI systems of the core, it is not possible to suddenly add new hooks to the creature.

    You have to register some event, a dummy event .. any kind of AI event on the creature before the creature is spawned ingame.
    Then you can add new hooks as you like.
    This needs to be done so that when the creature is initially spawned, he gets a lua AI chosen.

  3. Thanks stoneharry (1 members gave Thanks to Vale the Violet Mote for this useful post)

Similar Threads

  1. [Bot] Strange "bugs" with CTM (gotoXY and looting)
    By reliasn in forum WoW Memory Editing
    Replies: 5
    Last Post: 08-27-2012, 06:17 PM
  2. Strange Bug with the Poledancing Buff
    By soto in forum World of Warcraft Exploits
    Replies: 10
    Last Post: 06-23-2009, 03:16 PM
  3. Something going on with mounts...need help investigating.
    By techbota in forum World of Warcraft Exploits
    Replies: 12
    Last Post: 10-27-2008, 11:02 PM
  4. weird bug with 4324.. lil help here?:)
    By b!atch in forum World of Warcraft Emulator Servers
    Replies: 6
    Last Post: 04-22-2008, 01:16 PM
  5. Problems with ascent...need help!
    By CyberKurt in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 03-30-2008, 10:38 AM
All times are GMT -5. The time now is 05:50 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