LUA Player Cast Spell menu

User Tag List

Results 1 to 12 of 12
  1. #1
    Bapesy's Avatar Banned
    Reputation
    35
    Join Date
    May 2008
    Posts
    126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LUA Player Cast Spell

    Hello, how can I make a player cast a spell in gossip lua, I have teleporter working but can't figure out how to make a player cast a spell. Also how would I set it so if alliance view the teleporter it would be different from horde? ie: Horde Cities & Alliance Cities.

    Thanks,

    Five Gum!

    LUA Player Cast Spell
  2. #2
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use the (You have to have LUA++)
    if(unit:GetFaction()) = ally faction 1 or 2 or 3 or 4 or 5 then
    Gossip Menus here

    And what do you mean by cast a spell? Like teleportation? If so, use unit:TeleportUnit

  3. #3
    Bapesy's Avatar Banned
    Reputation
    35
    Join Date
    May 2008
    Posts
    126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No like cast a buff on the player. Also were does the faction id go in there? In between the ())?

    Five Gum!

  4. #4
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, just use the setup I have.

    Anyways, it would be like
    Unit:GetClosestPlayer()
    Unit:CastSpellOnTarget(player, spell)

    I'm writing a LUA .pdf guide thats 20 pages long soon so just wait for that for more complex stuff

  5. #5
    Bapesy's Avatar Banned
    Reputation
    35
    Join Date
    May 2008
    Posts
    126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unit:GetClosestPlayer()
    Unit:CastSpellOnTarget(player, spell)

    Can that be done with OpenAscent lua?

    Five Gum!


  6. #6
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, you need LUA++'s LUAscripting.cpp LUAscripting.h and LUAengine.cpp (or .h can't remember)

    Edit- Now you can, they merged

  7. #7
    Bapesy's Avatar Banned
    Reputation
    35
    Join Date
    May 2008
    Posts
    126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright, and what about if the player is in combat than It'll broadcast message and if hes not then It'll do the function?

    Edit: You can do all the things you said or just cast spell?


    Five Gum!
    Last edited by Bapesy; 05-31-2008 at 11:07 PM.

  8. #8
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All the things I said.

    I'm not sure if combat checks are supported in LUA, but I may be able to create a semi-working one.

    if(unit:IsPlayer = true)(unit:GetHealthPct() = 100)then
    Stuff here

    That would work if the player had 100% meaning not in combat. Of course if he wasn't in combat and had 90% health then it wouldn't work. But thats a makeshift function

  9. #9
    Bapesy's Avatar Banned
    Reputation
    35
    Join Date
    May 2008
    Posts
    126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is the little script and I got this error - calling 'CastSpellOnTarget' on bad self (number expected, got userdata)

    Code:
    function warp_on_gossip_talk3(unit, event, player)
    unit:GossipCreateMenu(3543, player)
    unit:GossipMenuAddItem(player, 5, "Remove Resurrection Sickness", 1, 0)
    unit:GossipMenuAddItem(player, 5, "Mall", 2, 0)
    unit:GossipSendMenu(player)
    end
    
    function warp_on_gossip_select3(unit, event, player, id, intid, code)
     
    if(intid == 1) then
    player:LearnSpell(15007)
    player:UnlearnSpell(15007)
    unit:SendChatMessage(12,0, "Resurrection Sickness has been removed from you.")
    end
    
    if(intid == 2) then
    unit:GetClosestPlayer()
    unit:CastSpellOnTarget(player, 29562)
    end
    
    intid = 0
    end
     
    RegisterGossipEvent(45403 , 1, "warp_on_gossip_talk3")
    RegisterGossipEvent(45403 , 2, "warp_on_gossip_select3")

  10. #10
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah the error is at the line
    unit:CastSpellOnTarget(player, 29562)

    not sure what it was though. I believe you can't use player function with that statement.

  11. #11
    Bapesy's Avatar Banned
    Reputation
    35
    Join Date
    May 2008
    Posts
    126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is how it should look right -

    Code:
    function warp_on_gossip_talk3(unit, event, player)
    if (unit:GetHealthPct() > 100)then
    if(unit:GetFaction()) = ally faction 1 or 2 or 3 or 4 or 5 then
    
    unit:GossipCreateMenu(3543, player)
    unit:GossipMenuAddItem(player, 5, "Remove Resurrection Sickness", 1, 0)
    unit:GossipMenuAddItem(player, 5, "Mall", 2, 0)
    unit:GossipSendMenu(player)
    
    else
    
    unit:SendChatMessage(12,0, "You are below 100% health, regenerate back to 100% to continue.")
       end
    end
    
    function warp_on_gossip_select3(unit, event, player, id, intid, code)
     
    if(intid == 1) then
    player:LearnSpell(15007)
    player:UnlearnSpell(15007)
    unit:SendChatMessage(12,0, "Resurrection Sickness has been removed from you.")
    end
    
    if(intid == 2) then
    unit:GetClosestPlayer()
    unit:CastSpellOnTarget(player, 29562)
    end
    
    intid = 0
    end
     
    RegisterGossipEvent(45403 , 1, "warp_on_gossip_talk3")
    RegisterGossipEvent(45403 , 2, "warp_on_gossip_select3")
    Edit: What would it be if I just wanted a certain class to see it? GetClass = 2?

    Five Gum!
    Last edited by Bapesy; 05-31-2008 at 11:30 PM.

  12. #12
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    unit:GetClosestPlayer()

    ^ Why are you calling this?

Similar Threads

  1. [Question] Using Lua to Cast Spells: Dealing with overhead
    By nilum in forum WoW Bots Questions & Requests
    Replies: 0
    Last Post: 10-17-2011, 06:31 PM
  2. [Guide] How to make a NPC cast spells. NO LUA!
    By Power of Illuminati in forum WoW EMU Guides & Tutorials
    Replies: 52
    Last Post: 05-06-2011, 07:13 AM
  3. [LUA] Custom NPC's don't cast spells or talk
    By Evilbuffy in forum WoW EMU Questions & Requests
    Replies: 15
    Last Post: 04-07-2009, 06:59 AM
  4. LUA scripting -- Making game objects cast spells.
    By Jotox in forum World of Warcraft Emulator Servers
    Replies: 6
    Last Post: 05-08-2008, 03:44 PM
  5. Player Cast Spell?
    By Ballwinkle in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 02-06-2008, 06:06 PM
All times are GMT -5. The time now is 05:40 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