Requesting help with Ready = true/false stuff. menu

Shout-Out

User Tag List

Results 1 to 4 of 4
  1. #1
    BurnDownTheSystem's Avatar Private
    Reputation
    1
    Join Date
    Jun 2012
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Requesting help with Ready = true/false stuff.

    Hi, im very sorry if I explain this bad.. my english aint so good/lack of sleep.

    So I want to create this basic gossip script: talking to a creature which will check if every hostile unit in the area / with id 525003 is dead OR alive, if they all are dead I want some spawned units to move forward. There is just 1 problem, I have never done a script like this before.. so how do I do this? I have inspected some scripts from several people with for example something like if Ready = false then and if Ready = true then stuff, I have basic experience with the lua commands "if" "else" and "then" could anyone please post an example of a script so I can see how I can do it or just explain to me what is best to do? :confused:

    Kind regards

    Requesting help with Ready = true/false stuff.
  2. #2
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Something like this:

    Code:
    for _,unit in pairs(pUnit:GetInRangeUnits()) do
       if unit:GetAreaId() == 1 and unit:GetEntry() == 525003 then
         if unit:IsAlive() then
           -- Unit is alive
           -- Do something
        else
          -- Unit is dead, do something
        end
      end
    end

  3. #3
    BurnDownTheSystem's Avatar Private
    Reputation
    1
    Join Date
    Jun 2012
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks it worked, had to remove "unit:GetAreaId() == 1 and" from it otherwise it would bug.

    Now I have to find a way that if there are more than 1 npc's alive/dead that it doesnt spam with the message I want him to say, but that aint so hard I guess, got it all planned out in my mind already.

    Thanks alot

    EDIT: +rep sorry almost forgot

  4. #4
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Call 'break' to make that loop stop and for it to move on.

    e.g:

    Code:
    for _,unit in pairs(pUnit:GetInRangeUnits()) do
       if unit:GetAreaId() == 1 and unit:GetEntry() == 525003 then
         if unit:IsAlive() then
           -- Unit is alive
           -- Do something
           break
        else
          -- Unit is dead, do something
          break
        end
      end
    end
    Alternatively you can do something similar with a function:

    Code:
    function CreatureSpawn(pUnit, Event)
    	pUnit:RegisterEvent("HandleStuff", 1000, 0)
    end
    
    function HandleStuff(pUnit)
    	local result = DoStuff(pUnit) -- We call the function, which will return a value
    	if result == 1 then
    		-- the unit was alive that we found
    	elseif result == 2 then
    		-- the unit was dead that we found
    	elseif result == 0 then
    		-- nothing was found
    	end
    end
    
    function DoStuff(pUnit)
    	for _,unit in pairs(pUnit:GetInRangeUnits()) do
    	   if unit:GetAreaId() == 1 and unit:GetEntry() == 525003 then
    		 if unit:IsAlive() then
    		   -- Unit is alive
    		   -- Do something
    		   return 1
    		else
    		  -- Unit is dead, do something
    		  return 2
    		end
    	  end
    	end
    	return 0
    end

Similar Threads

  1. [Request] Help with Photoshop!
    By Randie in forum Art & Graphic Design
    Replies: 4
    Last Post: 06-13-2008, 06:44 AM
  2. [Request] Help with Warglavirs
    By henkeike in forum WoW ME Questions and Requests
    Replies: 4
    Last Post: 05-22-2008, 04:37 PM
  3. [Request] Help with Changing poison proc to TF Proc
    By Maxpower111 in forum WoW ME Questions and Requests
    Replies: 8
    Last Post: 03-08-2008, 09:45 AM
  4. REQUEST : request help with druid forms edit
    By littleevil in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 11-23-2007, 09:02 PM
  5. [Request] Help with mount swap plz! +rep
    By oliax in forum WoW ME Questions and Requests
    Replies: 6
    Last Post: 10-02-2007, 02:36 PM
All times are GMT -5. The time now is 07:46 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