Trinitycore: DB/CORE: SCRIPT_COMMAND_CAST_SPELL for gameobjects

Created on 19 Jan 2019  路  9Comments  路  Source: TrinityCore/TrinityCore

Description: This 2 gobs SELECT * FROM gameobject_template WHERE entry IN (180911, 180912); are goobers they have a dbc spell on data=10 that is casted when the player click the gob.

Once clicked this DBC spell will trigger another spell casted by the gob on the player via spell_script:
SELECT * FROM spell_scripts WHERE id IN (34448, 34452);

Before the implementation of gameobject cast, this was working correctly, but now it looks like spell_scripts doesn't support a gob as a source caster:

SCRIPT_COMMAND_CAST_SPELL ('spell_scripts' script id: 34448) no source unit found for spell 26566
SCRIPT_COMMAND_CAST_SPELL ('spell_scripts' script id: 34452) no source unit found for spell 26572

/// todo Allow gameobjects to be targets and casters
https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/game/Maps/MapScripts.cpp#L665

Steps to reproduce the problem:

  1. .go xyz 9333.637, -7879.619, 74.91 530 (Don't get too close to the orb or you will be teleported by the area trigger)
  2. Clique the orb (No tp will be executed)
  3. look to the server log (console)

Branch(es): 3.3.5

TC rev. hash/commit: rev. 0cbdbd8a3f3c

Branch-3.3.5a Comp-Core Feedback-PatchFix Sub-GameObject Sub-ScriptingEngine

All 9 comments

is there any requirement to be able to click the orb ?

No requirements, just a horde char.

I added support to GameObjects as casters but target GUID is empty
https://github.com/jackpoz/TrinityCore/tree/3.3.5-go_caster

UPDATE `spell_dbc` SET `effectimplicittargeta1`=25, `rangeindex`=12 WHERE `Id` IN (34448, 34452);

this is needed to let 34448 target the player.
then 26566 is triggered but it doesn't allow to target the player so the spell fails...

@Killyana I allowed gameobjects to cast spells at https://github.com/TrinityCore/TrinityCore/commit/813cf761fcf8737e50486672be28900c9cf4f36f but the current database data must be updated to reflect the change from Player -> Player to GameObject -> Player:

  • the server side spells need to be able to target Player so EffectImplicitTargetA1 = 25 (Any)
  • RangeIndex = 12 (Interaction) otherwise spell will fail with Out Of Range (not shown ingame since the GO is casting)
    Here's a working example
UPDATE `spell_dbc` SET `effectimplicittargeta1`=25, `rangeindex`=12 WHERE `Id` IN (34448, 34452);
UPDATE `spell_scripts` SET `datalong2`=2 WHERE `Id` IN (34448, 34452);

Works fine Thanks, I will check the other spells.

``` sql
-- Spells that must be checked
SELECT * FROM spell_dbc WHERE id IN (SELECT data10 FROM gameobject_template WHERE data10>0 AND TYPE=10); -- goober
SELECT * FROM spell_dbc WHERE id IN (SELECT data3 FROM gameobject_template WHERE data3>0 AND TYPE=6); -- trap
SELECT * FROM spell_dbc WHERE id IN (SELECT data1 FROM gameobject_template WHERE data1>0 AND TYPE=18); -- ritual
SELECT * FROM spell_dbc WHERE id IN (SELECT data0 FROM gameobject_template WHERE data0>0 AND TYPE=22); -- spellcaster
SELECT * FROM spell_dbc WHERE id IN (SELECT data1 FROM gameobject_template WHERE data1>0 AND TYPE=24); -- FLAGSTAND
SELECT * FROM spell_dbc WHERE id IN (SELECT data2 FROM gameobject_template WHERE data2>0 AND TYPE=26); -- FLAGDROP
SELECT * FROM spell_dbc WHERE id IN (SELECT data2 FROM gameobject_template WHERE data2>0 AND TYPE=30); -- AURAGENERATOR

Good work, thanks for the effort so far. 馃憤

Btw I forgot to mention datalong2=2 is needed to make the player cast himself the triggered spell dive in this case it has TARGET_UNIT_CASTER

Was this page helpful?
0 / 5 - 0 ratings