Sign in to follow this  
Followers 0
LordPsyan

Spell Scripting - adding timer countdown then cast secondary spell.

3 posts in this topic

I am trying to make a spell script, something I have never messed with before. Simply put, a spell is cast upon you when you touch an object. I have that working, since that is a game object script. it also adds a 30 second duration, which also works, but does not show the countdown timer like many other spells. I think this needs to be done in a spell script, instead of newSpell->SetDuration(30000); in gameobject script.

I cannot figure out how to get the timer working, and then get another spell cast upon the player.

I have this set in my spell script, so if the spell is removed by any other means, the script shouldn't do anything:

                if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
                    return;

so to sum up my question:

spell cast upon player. timer counts down 30 seconds, which gives player enough time to remove the spell, then at end of countdown, another spell cast upon player. Can anyone give me some sample code? I tried working with professor putricide spell codes, and the life bloom spell, but its just not triggering. Yes I added an entry in spell_script_names...

 

Thanks.

0

Share this post


Link to post
Share on other sites

Not to bump this, but figured out how to set the timer. Now I need to set it to cast a spell if the timer runs out. During testing, however, the timer counted down to 4 seconds, then the spell vanished...

1

Share this post


Link to post
Share on other sites

Adding this to Unit.h/Unit.cpp will do the Job...

void CastWithDelay(uint32 delay, Unit* victim, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid::Empty);

 

void Unit::CastWithDelay(uint32 delay, Unit* victim, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster)
{
    class DelayCastEvent : public BasicEvent
    {
    public:
        DelayCastEvent(Unit *caster, Unit* victim, uint32 spellId, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, ObjectGuid originalCaster) : BasicEvent(),
            _caster(caster),
            _victim(victim),
            _spellId(spellId),
            _triggered(triggered),
            _castItem(castItem),
            _triggeredByAura(triggeredByAura),
            _originalCaster(originalCaster)
        {
            ;
        }

        bool Execute(uint64, uint32)
        {
            _caster->CastSpell(_victim, _spellId, _triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, _castItem, _triggeredByAura, _originalCaster);
            return true;
        }

    private:
        Unit *_caster;
        Unit *_victim;
        uint32 _spellId;
        bool _triggered;
        Item *_castItem;
        AuraEffect const* _triggeredByAura;
        ObjectGuid _originalCaster;
    };

    m_Events.AddEvent(new DelayCastEvent(this, victim, spellId, triggered, castItem, triggeredByAura, originalCaster), m_Events.CalculateTime(delay));
}

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By wildcat
      server version:
      TrinityCore rev. cf3497cfbf4a+ 2017-03-15 22:48:31 +0100 (master branch) (Win64, Release, Static) (worldserver-daemon)
       
      client version:
      7.1.5 23420
       
      issus:
      Running worldserver.exe,warnings:
      -----------------------------------------------------------------------------------------------
      Validating spell scripts...
      Spell `100` Effect `Index: EFFECT_1 Name: 3` of script `spell_warr_charge` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `100` did not pass Validate() function of script `spell_warr_charge` - script will be not added to the spell
      Spell `118` did not pass Validate() function of script `spell_mage_polymorph` - script will be not added to the spell
      Spell `120` Effect `Index: EFFECT_0 Name: 6` of script `spell_mage_cone_of_cold` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `139` did not pass Validate() function of script `spell_pri_renew` - script will be not added to the spell
      Spell `527` Effect `Index: EFFECT_0 Name: 3` of script `spell_pri_dispel_magic` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `527` did not pass Validate() function of script `spell_pri_dispel_magic` - script will be not added to the spell
      Spell `603` did not pass Validate() function of script `spell_warl_bane_of_doom` - script will be not added to the spell
      Spell `633` did not pass Validate() function of script `spell_pal_lay_on_hands` - script will be not added to the spell
      Spell `755` Effect `Index: EFFECT_0 AuraName: 20` of script `spell_warl_health_funnel` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed
      Spell `755` Effect `Index: EFFECT_0 AuraName: 20` of script `spell_warl_health_funnel` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed
      Spell `755` Effect `Index: EFFECT_0 AuraName: 20` of script `spell_warl_health_funnel` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed
      Spell `1463` Effect `Index: EFFECT_0 AuraName: 97` of script `spell_mage_mana_shield` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed
      Spell `1463` Effect `Index: EFFECT_0 AuraName: 97` of script `spell_mage_mana_shield` did not match dbc effect data - handler bound to hook `AfterEffectManaShield` of AuraScript won't be executed
      Spell `1464` Effect `Index: EFFECT_0 Name: 3` of script `spell_warr_slam` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `1464` did not pass Validate() function of script `spell_warr_slam` - script will be not added to the spell
      Spell `1784` did not pass Validate() function of script `spell_rog_stealth` - script will be not added to the spell
      Spell `2912` Effect `Index: EFFECT_1 Name: 3` of script `spell_dru_eclipse_energize` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `5176` Effect `Index: EFFECT_1 Name: 3` of script `spell_dru_eclipse_energize` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `5246` Effect `Index: EFFECT_1 Target: 15` of script `spell_warr_intimidating_shout` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed
      Spell `5308` Effect `Index: EFFECT_0 Name: 2` of script `spell_warr_execute` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `6358` did not pass Validate() function of script `spell_warl_seduction` - script will be not added to the spell
      Spell `12975` Effect `Index: EFFECT_0 Name: 3` of script `spell_warr_last_stand` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed
      Spell `12975` did not pass Validate() function of script `spell_warr_last_stand` - script will be not added to the spell
      Spell `15286` Effect `Index: EFFECT_0 AuraName: 4` of script `spell_pri_vampiric_embrace` did not match dbc effect data - handler bound to hook `OnEffectProc` of AuraScript won't be executed
      Spell `15290` Effect `Index: EFFECT_0 Target: 20` of script `spell_pri_vampiric_embrace_target` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed
      Spell `18765` did not pass Validate() function of script `spell_warr_sweeping_strikes` - script will be not added to the spell
      Spell `19505` did not pass Validate() function of script `spell_warl_devour_magic` - script will be not added to the spell
      Spell `20271` Effect `Index: EFFECT_0 Name: 3` of script `spell_pal_judgement` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `20271` did not pass Validate() function of script `spell_pal_judgement` - script will be not added to the spell
      Spell `23881` Effect `Index: EFFECT_1 Name: 3` of script `spell_warr_bloodthirst` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed
      Spell `23881` Effect `Index: EFFECT_0 Name: 2` of script `spell_warr_bloodthirst` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `28764` Effect `Index: EFFECT_0 AuraName: 4` of script `spell_gen_adaptive_warding` did not match dbc effect data - handler bound to hook `OnEffectProc` of AuraScript won't be executed
      Spell `29166` Effect `Index: EFFECT_0 AuraName: 24` of script `spell_dru_innervate` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed
      Spell `30108` of script `spell_warl_unstable_affliction` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed
      Spell `31821` did not pass Validate() function of script `spell_pal_aura_mastery` - script will be not added to the spell
      Spell `31884` did not pass Validate() function of script `spell_pal_avenging_wrath` - script will be not added to the spell
      Spell `33763` Effect `Index: EFFECT_1 AuraName: 4` of script `spell_dru_lifebloom` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed
      Spell `33763` did not pass Validate() function of script `spell_dru_lifebloom` - script will be not added to the spell
      Spell `34477` Effect `Index: EFFECT_1 AuraName: 4` of script `spell_hun_misdirection` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed
      Spell `34477` Effect `Index: EFFECT_1 AuraName: 4` of script `spell_hun_misdirection` did not match dbc effect data - handler bound to hook `OnEffectProc` of AuraScript won't be executed
      Spell `34861` did not pass Validate() function of script `spell_pri_circle_of_healing` - script will be not added to the spell
      Spell `34914` Effect `Index: EFFECT_2 AuraName: 4` of script `spell_pri_vampiric_touch` did not match dbc effect data - handler bound to hook `OnEffectProc` of AuraScript won't be executed
      Spell `34914` did not pass Validate() function of script `spell_pri_vampiric_touch` - script will be not added to the spell
      Spell `35429` did not pass Validate() function of script `spell_warr_sweeping_strikes` - script will be not added to the spell
      Spell `39238` did not pass Validate() function of script `spell_q10929_fumping` - script will be not added to the spell
      Spell `41054` Effect `Index: EFFECT_0 AuraName: 226` of script `spell_gen_clone_weapon_aura` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed
      Spell `41054` Effect `Index: EFFECT_0 AuraName: 226` of script `spell_gen_clone_weapon_aura` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed
      Spell `41475` did not pass Validate() function of script `spell_boss_lady_malande_shield` - script will be not added to the spell
      Spell `44457` Effect `Index: EFFECT_1 AuraName: 4` of script `spell_mage_living_bomb` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed
      Spell `44457` did not pass Validate() function of script `spell_mage_living_bomb` - script will be not added to the spell
      Spell `45204` Effect `Index: EFFECT_1 Name: 77` of script `spell_gen_clone` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `45406` did not pass Validate() function of script `spell_gen_ribbon_pole_dancer_check` - script will be not added to the spell
      Spell `47541` did not pass Validate() function of script `spell_dk_death_coil` - script will be not added to the spell
      Spell `47788` Effect `Index: EFFECT_1 AuraName: 69` of script `spell_pri_guardian_spirit` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed
      Spell `47788` Effect `Index: EFFECT_1 AuraName: 69` of script `spell_pri_guardian_spirit` did not match dbc effect data - handler bound to hook `OnEffectAbsorb` of AuraScript won't be executed
      Spell `48181` Effect `Index: EFFECT_1 AuraName: 4` of script `spell_warl_haunt` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed
      Spell `48181` did not pass Validate() function of script `spell_warl_haunt` - script will be not added to the spell
      Spell `48707` did not pass Validate() function of script `spell_dk_anti_magic_shell` - script will be not added to the spell
      Spell `49107` did not pass Validate() function of script `spell_vehicle_warhead_fuse` - script will be not added to the spell
      Spell `49576` Effect `Index: EFFECT_0 Name: 3` of script `spell_dk_death_grip_initial` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `49889` Effect `Index: EFFECT_1 Name: 77` of script `spell_gen_clone` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `49889` Effect `Index: EFFECT_2 Name: 77` of script `spell_gen_clone` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `50218` Effect `Index: EFFECT_1 Name: 77` of script `spell_gen_clone` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `50218` Effect `Index: EFFECT_2 Name: 77` of script `spell_gen_clone` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `50842` Effect `Index: EFFECT_0 Name: 3` of script `spell_dk_blood_boil` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `50842` Effect `Index: EFFECT_1 Name: 30` of script `spell_dk_blood_boil` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `50842` did not pass Validate() function of script `spell_dk_blood_boil` - script will be not added to the spell
      Spell `51690` Effect `Index: EFFECT_1 Target: 16` of script `spell_rog_killing_spree` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed
      Spell `51719` Effect `Index: EFFECT_1 Name: 77` of script `spell_gen_clone` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `51719` Effect `Index: EFFECT_2 Name: 77` of script `spell_gen_clone` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `52408` did not pass Validate() function of script `spell_gen_seaforium_blast` - script will be not added to the spell
      Spell `52437` Effect `Index: EFFECT_0 AuraName: 4` of script `spell_warr_sudden_death` did not match dbc effect data - handler bound to hook `AfterEffectApply` of AuraScript won't be executed
      Spell `52437` did not pass Validate() function of script `spell_warr_sudden_death` - script will be not added to the spell
      Spell `53209` Effect `Index: EFFECT_0 Name: 77` of script `spell_hun_chimera_shot` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `53209` did not pass Validate() function of script `spell_hun_chimera_shot` - script will be not added to the spell
      Spell `53478` Effect `Index: EFFECT_0 Name: 3` of script `spell_hun_last_stand_pet` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `53478` did not pass Validate() function of script `spell_hun_last_stand_pet` - script will be not added to the spell
      Spell `54845` did not pass Validate() function of script `spell_dru_glyph_of_starfire_proc` - script will be not added to the spell
      Spell `55233` Effect `Index: EFFECT_1 AuraName: 34` of script `spell_dk_vampiric_blood` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed
      Spell `57934` did not pass Validate() function of script `spell_rog_tricks_of_the_trade` - script will be not added to the spell
      Spell `61551` Effect `Index: EFFECT_ALL Target: 30` of script `spell_item_toy_train_set_pulse` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed
      Spell `62552` did not pass Validate() function of script `spell_gen_defend` - script will be not added to the spell
      Spell `62719` did not pass Validate() function of script `spell_gen_defend` - script will be not added to the spell
      Spell `66482` did not pass Validate() function of script `spell_gen_defend` - script will be not added to the spell
      Spell `67518` did not pass Validate() function of script `spell_warl_devour_magic` - script will be not added to the spell
      Spell `69893` Effect `Index: EFFECT_0 AuraName: 226` of script `spell_gen_clone_weapon_aura` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed
      Spell `69893` Effect `Index: EFFECT_0 AuraName: 226` of script `spell_gen_clone_weapon_aura` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed
      Spell `78674` Effect `Index: EFFECT_1 Name: 3` of script `spell_dru_eclipse_energize` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `82691` did not pass Validate() function of script `spell_mage_ring_of_frost_freeze` - script will be not added to the spell
      Spell `85256` Effect `Index: EFFECT_0 Name: 31` of script `spell_pal_templar_s_verdict` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `85256` did not pass Validate() function of script `spell_pal_templar_s_verdict` - script will be not added to the spell
      Spell `85948` Effect `Index: EFFECT_2 Name: 77` of script `spell_dk_festering_strike` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `86121` Effect `Index: EFFECT_0 Name: 2` of script `spell_warl_soul_swap` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `86121` did not pass Validate() function of script `spell_warl_soul_swap` - script will be not added to the spell
      Spell `86213` did not pass Validate() function of script `spell_warl_soul_swap_exhale` - script will be not added to the spell
      Spell `106935` Effect `Index: EFFECT_1 Name: 77` of script `spell_gen_clone` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `116694` Effect `Index: EFFECT_0 Name: 3` of script `spell_monk_surging_mist` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `116694` did not pass Validate() function of script `spell_monk_surging_mist` - script will be not added to the spell
      Spell `123456` Effect `Index: EFFECT_0 Target: 18` of script `spell_halion_summon_exit_portals` did not match dbc effect data - handler bound to hook `OnDestinationTargetSelect` of SpellScript won't be executed
      Spell `123456` Effect `Index: EFFECT_1 Target: 18` of script `spell_halion_summon_exit_portals` did not match dbc effect data - handler bound to hook `OnDestinationTargetSelect` of SpellScript won't be executed
      Spell `126240` Effect `Index: EFFECT_2 Name: 77` of script `spell_gen_clone` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `130736` Effect `Index: EFFECT_1 AuraName: 226` of script `spell_dk_soul_reaper` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed
      Spell `130736` Effect `Index: EFFECT_1 AuraName: 226` of script `spell_dk_soul_reaper` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed
      Spell `136757` Effect `Index: EFFECT_1 Name: 77` of script `spell_gen_clone` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed
      Spell `178368` Effect `Index: EFFECT_1 Name: 42` of script `spell_warr_heroic_leap_jump` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed
      Spell `178368` did not pass Validate() function of script `spell_warr_heroic_leap_jump` - script will be not added to the spell
      >> Validated 1455 scripts in 65 ms
      -----------------------------------------------------------------------------------------------
       
      May I get other version of client to extract dbc ? Or it`s fine just wait other day ?
      Thanks to watch.
    • By Venomless
      Hello everyone,

      I have been trying to figure out how to achieve something in Trinity using the databases. When you first create a character you spawn with a starter ability for example Cobra Shot. I would like to remove this ability and instead reward it when the player hits Level 3. How do I go about doing this? Or is it even possible? I managed to disable it when you start at first spawn by deleting the relevant record in "playercreateinfo_action" but as soon as I hit Level 2 the ability comes back.

      Any help would be greatly appreciated!

      Thanks in advance.

      Nathan.
    • By piccolodmq
      Hi there, could I get some help, in the topic. Just to get some backstory, I have a custom trinitycore 3.3.5a server with many custom models, zones, etc. I succesfully created custom graveyards in zones like Pandaria and Draenor (the ones from Kronixusa), following this tutorial.

      http://www.model-changing.net/tutorials ... graveyard/

      I have created graveyards for custom zones in Custom maps and in deserted zones like Hyjal that have no graveyards. 

      HOWEVER, I foudn out that none of the graveyards work in Northrend and if I die there, I will just get ported to westfall or barrens. I dont know how to fix this. I even tried to remake new custom gyards copying everything from the original custom graveyards of northrend using the tutorial above, but all I get when trying to use this command, .linkgrave X (X being the new graveyard ID) is the message ""CANNOT LINK TO NON EXISTING ZONE OR SUBZONE #INTERNAL ERROR"

      Thanks for you help!


    • By SCYTH3RX
      Hi guys, I´m computer scientist, I started studying trinity core 2 days ago, I want to develop, and fix a lot of things, specially spells, auras, and all the pvp system in general. I was looking for Ice Form, Glacial Spike, etc, at spell_mage.cpp, and I didn´t see any of those new mage spell in WoW Legion ,so I´m wondering if the current spell scripts are updated to Legion or I have to update it. Hope some of you guys can help me, thanks for reading
    • By AutoFX
      I greet you gave comends such as cd ~ /
        git clone git b 3.3.5: //github.com/TrinityCore/TrinityCore.git but it does not work I tried git clone git b 3.3.5: //github.com/TrinityCore/TrinityCore.git
        and so it entered the Komeda not work in putty trying to do this on Linux but Tables of your Komeda does not work I do not know how I give myself the trick ....