LUA scripting -- Making game objects cast spells. menu

User Tag List

Results 1 to 7 of 7
  1. #1
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LUA scripting -- Making game objects cast spells.

    Since the game's LUA doesn't allow game objects to cast spells, I had the idea of making the game object summon a unit and then making the unit cast the spell on the target player.

    I can't test it though, can somebody try this out?

    Here's the LUA script:
    Code:
    function Object_CastSpell (pUnit, Event, pMisc)
         local posx, posy, posz, poso = pMisc:GetX(), pMisc:GetY(), pMisc:GetZ(), pMisc:GetO();
         pUnit:SpawnCreature(<PUT CREATURE ID HERE>, posx, posy, posz, poso, 35, 5000);
    end
    RegisterGameObjectEvent(<PUT OBJECT ID HERE>, 2, "Object_CastSpell")
    
    function ObjectUnit_CastSpell (Unit)
         Unit:CastSpellOnTarget(<PUT SPELL ID HERE>, Unit:GetClosestPlayer()) 
    end
    RegisterUnitEvent(<PUT CREATURE ID HERE>, 6, "ObjectUnit_CastSpell")

    Now the SQL for the Unit and for the Object:

    Object:
    Code:
    INSERT INTO gameobject_names
    (entry, Type, DisplayID, Name, spellfocus, sound1, sound2, sound3, sound4, sound5, sound6, sound7, sound8, sound9, unknown1, unknown2, unknown3, unknown4, unknown5, unknown6, unknown7, unknown8, unknown9, unknown10, unknown11, unknown12, unknown13, unknown14)
    VALUES
    (ENTRY, 4, DISPLAYID, "NAME", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    Unit:
    Code:
    INSERT INTO creature_proto (entry, minlevel, maxlevel, faction, minhealth, maxhealth, mana, scale, npcflags, attacktime, mindamage, maxdamage, rangedattacktime, rangedmindamage, rangedmaxdamage, mountdisplayid, equipmodel1, equipinfo1, equipslot1, equipmodel2, equipinfo2, equipslot2, equipmodel3, equipinfo3, equipslot3, respawntime, armor, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, combat_reach, bounding_radius, auras, boss, money, invisibility_type, death_state)
    VALUES (ENTRY, 100, 100, 814,  1,  1,  99999,  1, 0, 1800, 150, 250, 1800, 500, 650, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36000, 0, 0, 0, 0, 0, 0, 0, 1, 0, "MEMO", 0, 0, 5, 0); INSERT INTO creature_names (entry, `name`, Subname, Flags1, type, Family, Rank, unk4, SpellDataID, male_displayid, female_displayid, unknown_float1, unknown_float2, Civilian, Leader, info_str)
    VALUES (," "," ",0,7,0,0,0,NULL,1,1,1, 1,1,NULL, '');
    Plz test =D

    LUA scripting -- Making game objects cast spells.
  2. #2
    Gastricpenguin's Avatar Legendary
    Reputation
    980
    Join Date
    Feb 2007
    Posts
    2,236
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or you could put the spell in the SPELLFOCUS field to make the object cast that spell : /
    Life Puzzler WoW - Website | Forums

  3. #3
    Jotox's Avatar Contributor
    Reputation
    250
    Join Date
    Mar 2008
    Posts
    282
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    :P You didn't read the whole post. This allows u to use game object spell casting in scripts. Like: If player's class is paladin, cast this, otherwise cast other.

  4. #4
    tyrant9's Avatar Member
    Reputation
    3
    Join Date
    May 2008
    Posts
    7
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how do i use script?

  5. #5
    Snailz's Avatar Contributor Authenticator enabled
    Reputation
    239
    Join Date
    Nov 2007
    Posts
    941
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ill Try Them
    Cheese Cake?

  6. #6
    AzolexX's Avatar Contributor
    Reputation
    179
    Join Date
    May 2007
    Posts
    587
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ty:P i will get use of this.

  7. #7
    AzolexX's Avatar Contributor
    Reputation
    179
    Join Date
    May 2007
    Posts
    587
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Btw can you Script to GO spawns after mob Death??
    Last edited by AzolexX; 05-08-2008 at 03:47 PM.

Similar Threads

  1. [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
  2. [Lua Script] [Request] LUA Script on game objects
    By Ultradethv2 in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 08-10-2010, 10:17 AM
  3. [Guide] Making GO`s cast spells.
    By Mr FlySquirrel in forum WoW EMU Guides & Tutorials
    Replies: 8
    Last Post: 02-27-2008, 02:39 PM
  4. How to make game objects teleport with LUA!
    By Le Froid in forum WoW EMU Guides & Tutorials
    Replies: 4
    Last Post: 01-02-2008, 06:59 PM
  5. [GUIDE] - Scripting for Antrix, Making Mobs Talk, Cast Spells, etc
    By Greed in forum WoW EMU Guides & Tutorials
    Replies: 6
    Last Post: 12-10-2007, 07:51 PM
All times are GMT -5. The time now is 01:38 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search