Need some help with random stuff menu

User Tag List

Results 1 to 8 of 8
  1. #1
    Fumi's Avatar Contributor CoreCoins Purchaser
    Reputation
    207
    Join Date
    Feb 2008
    Posts
    561
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need some help with random stuff

    Hey mmowned


    I have this script
    Code:
    function OnSpawn(pUnit, Event)
      pUnit:RegisterEvent("CheckForPlayers", 1000, 0)
    end
    
    function CheckForPlayers(pUnit)
      local plr = pUnit:GetClosestPlayer()
      if plr ~= nil then
        if pUnit:GetDistanceYards(plr) < 10 then
          pUnit:SendChatMessage(12,0,"Its dangerous out there!")
           pUnit:RemoveEvents()
        end
      end
    end
    
    RegisterUnitEvent(99990, 18, "OnSpawn")
    and the guard only says it on spawn, and i want it to say it to each player coming close to him, in a 10 yard range

    ive also made mobs for a inctance but they seem to attack eachother due to the flags ive given em, do you know any good flags for mobs against allys i dont need em for hordes

    thanks

    Need some help with random stuff
  2. #2
    Facerolling's Avatar Contributor
    Reputation
    116
    Join Date
    Mar 2007
    Posts
    307
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function OnSpawn(pUnit, Event) -- This defines the functions name, and what the function uses.
      pUnit:RegisterEvent("CheckForPlayers", 1000, 0) -- This says the the pUnit (The NPC) is going to use the "CheckForPlayers" command every 1000 milliseconds, until the server dies or the Event is removed.
    end -- This tells the engine that that is everything that is in the function "OnSpawn"
    
    function CheckForPlayers(pUnit) -- Defines another function, "CheckForPlayers"
      local plr = pUnit:GetClosestPlayer() -- This is making a local word, "plr" whenever the word "plr" comes up, it now means what it is equal to.
      if plr ~= nil then --If nobody is nearby, then...
        if pUnit:GetDistanceYards(plr) < 10 then --check if there is a player within 10 yards, if there is..
          pUnit:SendChatMessage(12,0,"Its dangerous out there!") --Send this chat message in say, then...
           pUnit:RemoveEvents() -- Remove all events, including the one that pulses every 1000 milliseconds to check if someone is nearby.
        end -- closes the check for if anyone is nearby
      end -- closes the check for if player is equal to anything
    end -- closes the CheckForPlayers function
    
    RegisterUnitEvent(99990, 18, "OnSpawn") -- This script binds to NPCid 99990 when it spawns and starts at the function "OnSpawn"
    I'm not going to hand the answer directly to you on a silver platter, use the notes I have given at the end of each line and remove the line that is causing it.
    hey ervyone whats up gamboys

  3. #3
    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)
    Originally Posted by Facerolling View Post
    Code:
    function OnSpawn(pUnit, Event) -- This defines the functions name, and what the function uses.
      pUnit:RegisterEvent("CheckForPlayers", 1000, 0) -- This says the the pUnit (The NPC) is going to use the "CheckForPlayers" command every 1000 milliseconds, until the server dies or the Event is removed.
    end -- This tells the engine that that is everything that is in the function "OnSpawn"
    
    function CheckForPlayers(pUnit) -- Defines another function, "CheckForPlayers"
      local plr = pUnit:GetClosestPlayer() -- This is making a local word, "plr" whenever the word "plr" comes up, it now means what it is equal to.
      if plr ~= nil then --If nobody is nearby, then...
        if pUnit:GetDistanceYards(plr) < 10 then --check if there is a player within 10 yards, if there is..
          pUnit:SendChatMessage(12,0,"Its dangerous out there!") --Send this chat message in say, then...
           pUnit:RemoveEvents() -- Remove all events, including the one that pulses every 1000 milliseconds to check if someone is nearby.
        end -- closes the check for if anyone is nearby
      end -- closes the check for if player is equal to anything
    end -- closes the CheckForPlayers function
    
    RegisterUnitEvent(99990, 18, "OnSpawn") -- This script binds to NPCid 99990 when it spawns and starts at the function "OnSpawn"
    I'm not going to hand the answer directly to you on a silver platter, use the notes I have given at the end of each line and remove the line that is causing it.
    Didn't really answer the question, or have anything to do with only sending the message to each player as they draw close.

    Aka, this would have to be done via inserting the player into a table when they get near to make sure that they are not used again. Example script: http://subversion.assembla.com/svn/K...tainHilnom.lua

  4. #4
    Fumi's Avatar Contributor CoreCoins Purchaser
    Reputation
    207
    Join Date
    Feb 2008
    Posts
    561
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    Didn't really answer the question, or have anything to do with only sending the message to each player as they draw close.

    Aka, this would have to be done via inserting the player into a table when they get near to make sure that they are not used again. Example script: http://subversion.assembla.com/svn/K...tainHilnom.lua
    i am not that good at LUA and dont understand alot of the script, but it seems hard.

    so what if i just want it to say it every 30 sec?

    and i still need a good faction thats hostile with alliance

    ---------- Post added at 06:57 PM ---------- Previous post was at 06:53 PM ----------

    Originally Posted by Facerolling View Post
    Code:
    function OnSpawn(pUnit, Event) -- This defines the functions name, and what the function uses.
      pUnit:RegisterEvent("CheckForPlayers", 1000, 0) -- This says the the pUnit (The NPC) is going to use the "CheckForPlayers" command every 1000 milliseconds, until the server dies or the Event is removed.
    end -- This tells the engine that that is everything that is in the function "OnSpawn"
    
    function CheckForPlayers(pUnit) -- Defines another function, "CheckForPlayers"
      local plr = pUnit:GetClosestPlayer() -- This is making a local word, "plr" whenever the word "plr" comes up, it now means what it is equal to.
      if plr ~= nil then --If nobody is nearby, then...
        if pUnit:GetDistanceYards(plr) < 10 then --check if there is a player within 10 yards, if there is..
          pUnit:SendChatMessage(12,0,"Its dangerous out there!") --Send this chat message in say, then...
           pUnit:RemoveEvents() -- Remove all events, including the one that pulses every 1000 milliseconds to check if someone is nearby.
        end -- closes the check for if anyone is nearby
      end -- closes the check for if player is equal to anything
    end -- closes the CheckForPlayers function
    
    RegisterUnitEvent(99990, 18, "OnSpawn") -- This script binds to NPCid 99990 when it spawns and starts at the function "OnSpawn"
    I'm not going to hand the answer directly to you on a silver platter, use the notes I have given at the end of each line and remove the line that is causing it.
    if i remove the pUnit:RemoveEvents() he will spam every 1000 milisecond

  5. #5
    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)
    http://pastebin.com/3vaWGLrQ
    ^
    something like that should work
    Last edited by stoneharry; 04-02-2011 at 12:16 PM.

  6. #6
    Fumi's Avatar Contributor CoreCoins Purchaser
    Reputation
    207
    Join Date
    Feb 2008
    Posts
    561
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stoneharry View Post
    ty, i am too lazy to start the server right now, but i threw u a rep cookie

  7. #7
    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)

  8. #8
    Fumi's Avatar Contributor CoreCoins Purchaser
    Reputation
    207
    Join Date
    Feb 2008
    Posts
    561
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyone has a nice faction? remember it has to be hostile with alliance and friendly to eachother

Similar Threads

  1. Need Some Help With EMU Stuff!
    By LAFD in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 01-03-2008, 08:59 PM
  2. Need some help with druid skins
    By Surikat in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 04-30-2007, 04:42 AM
  3. Need some help with Head changing
    By Emotion in forum WoW ME Questions and Requests
    Replies: 6
    Last Post: 01-01-2007, 07:12 PM
  4. Need some help with fishing bot
    By ralphie123 in forum World of Warcraft Bots and Programs
    Replies: 3
    Last Post: 11-24-2006, 09:41 AM
  5. NEED SOME HELP with Model Editing
    By Dwarf in forum World of Warcraft Model Editing
    Replies: 4
    Last Post: 09-12-2006, 08:12 PM
All times are GMT -5. The time now is 02:51 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