Hello & Welcome to our community. Is this your first visit? Register
Follow us on
Follow us on Facebook Follow us on Twitter Watch us on YouTube


MMOCoin

Likes Likes:  0
Results 1 to 1 of 1
  1. #1
    Banned

    Join Date
    Jan 2010
    Location
    Baltimore,Maryland
    Posts
    260
    Post Thanks / Like
    Rep Power
    0
    Reputation
    87

    Exclamation (Share)[Lua]How to Script a Custom command


    Register to remove this ad
    Lets say i want a SpawnNPC Command, where it should spawn my teleporter..

    First start with a local function for the chat message, Like this:


    Code:
     
    local Teleporter_Spawn = "#TeleportSpawn"
    The Teleporter_Spawn is a local which is reffering to something further down in your script.
    Everything inside " " Are the command, which will say ingame they must now type #TeleportSpawn to spawn the teleporter!
    Now you gona want the function, Thenwe start off like this:


    Code:
     
    function OnChat_TeleportSpawn(event, player, message, type, language)
    the OnChat_TeleportSpawn is the function which will make it all work.
    Now we need it to find the message in the chat and make the teleporter be spawned.

    Then will tell the Lua what will happen if that message comes.


    Code:
     
    if (message == Teleporter_Spawn) then
    of course we want our teleporter infront of us, so we need to get some coordinations.
    then we will use these locals:


    Code:
     
    local x = player:GetX()local y = player:GetY()local z = player:GetZ()local o = player:GetO()
    Now that will give us the correct cords of your possision. We want the teleporter to be spawned 2 yards infront of you.
    then it is going to look like this:


    Code:
     
    player:SpawnCreature(76668, x, y+2, z, o, 35, 30000) player:SendAreaTriggerMessage("The Npc will be spawned for 30 sec.!")
    76668 is my teleporter ID, then x is GetX(), y is GetY(), z is GetZ() and 0 is GetO()
    35 is the faction, and 30000 is the spawn time,
    so it would be like this:

    Code:
     
    :SpawnCreature(NPCID, x, y, z, o, Faction, SpawnTime(In milliseconds)
    The SendAreaTriggerMessage send a message with yellow colour in the screen of the player
    Of course we do not want this message to be shown in the chat when people type it, so we will add



    Code:
     
    return 0
    right under SendAreaTriggerMessage.
    Now the script is basicly done so then we must add "end" to it so it will work
    end will be added 2 times in this script, since end is going to be there for every time u have written function or if

    Lets say you have 2 function lines, and 3 if lines. then we are going to do it like this:


    Code:
     
    endendendendend
    5 Times, since its 5 total
    ,

    so here we are going to need 2 end Right after the return 0



    Code:
     
    player:SendAreaTriggerMessage("The Npc will be spawned for 30 sec.!") return 0 endend
    at the end we need to register the function which will be done on commands by doing:

    Code:
     
    RegisterServerHook(16, "OnChat_TeleportSpawn")
    To the end my Command Script looks like this:

    Code:
     
    local Teleporter_Spawn = "#TeleportSpawn"function OnChat_TeleportSpawn(event, player, message, type, language) if (message == Teleporter_Spawn) thenlocal x = player:GetX()local y = player:GetY()local z = player:GetZ()local o = player:GetO() player:SpawnCreature(76668, x+2, y, z, o, 35, 30000) player:SendAreaTriggerMessage("The Npc will be spawned for 30 sec.!") return 0 endendRegisterServerHook(16, "OnChat_TeleportSpawn")
    Share plz dont Flame or QQ if u cant say some thing nice or helpful plz dont say it at all enless ure a mod or admin thank you


    Credits go to Wx2 From Ac-Web thxs Man!




    › See More: (Share)[Lua]How to Script a Custom command
    Last edited by Noblebeastx; 17-03-10 at 09:21 PM.



  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

 

 

Visitors found this page by searching for:

arcemu custom command lua

custom command lua wow

sendareatriggermessage colors

arcemu custom command script

script colour arcemu

ac-web [lua] how to make a custom command

ac-web how to make custom commands lua

ac web lua commands

arcema lua script for custom comands

SEO Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -5. The time now is 11:53 AM.
Powered by vBulletin® Copyright ©2000-2024, Jelsoft Enterprises Ltd.
See More links by ForumSetup.net. Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
vBulletin Licensed to: MMOPro.org