[DRAFT] Scripts/Scarlet Enclave: Gift Of The Harvester#23114
Conversation
| @@ -0,0 +1,3 @@ | |||
| INSERT INTO `spell_script_names` VALUES | |||
| (52479, 'spell_gift_of_the_harvester'); | |||
| UPDATE `gameobject_template` SET `Data3`=0,`AIName`='',`ScriptName`='gift_of_the_harvesterAI' WHERE `entry`=190769; | |||
There was a problem hiding this comment.
Because spell will be casted early, but animation is missing.
There was a problem hiding this comment.
Animations are not implemented for al most all gobs type, better to keep the original value and wait for a generic solution.
There was a problem hiding this comment.
Just as a footnote: Aokromes always used to tell me that gameobject_template.Data* are sniffed data and should not be changed.
There was a problem hiding this comment.
Here the sequence used by the gob (and probably any trap) https://gist.github.com/Killyana/05753c48ad36b49905924f4ed1811cca
01:59:23 - the gob is summoned
01:59:24 - the spell 52479 is cast by the gob
01:59:24 - SMSG_GAMEOBJECT_CUSTOM_ANIM
01:59:26 - SMSG_GAMEOBJECT_DESPAWN_ANIM
01:59:26 - SMSG_DESTROY_OBJECT
We have already an issue #23109 about this.
So no need to change the data or use extra code to activate the gob animation.
-- Faction must be updated
UPDATE `gameobject_template_addon` SET `faction`=1610 WHERE `entry`=190769;There was a problem hiding this comment.
Well, then I am going to revert gob changes (spell script is still welcome I believe).
Signed-off-by: Sorikoff <[email protected]>
|
|
||
| void HandleScriptEffect(SpellEffIndex /*effIndex*/) | ||
| { | ||
| uint32 spellId = urand(0, 1) ? SPELL_MINER_GHOUL_TRANSFORM : SPELL_MINER_GHOST_TRANSFORM; |
There was a problem hiding this comment.
use the random uint32 picker, not urand
There was a problem hiding this comment.
btw why the hell is RAND inside CreatureAIImpl.h ??
There was a problem hiding this comment.
yep
@Keader the concept is: if there is a helper designed to do something, use it
|
Maybe set the PR as draft if it's not complete yet. You might want to include a crashlog in Debug mode too to let others see what's causing the crash |
| _scheduler.Schedule(2s, [this](TaskContext /*context*/) | ||
| { | ||
| me->SendCustomAnim(0); | ||
| me->CastSpell(nullptr, SPELL_GIFT_OF_THE_HARVESTER, true); |
There was a problem hiding this comment.
"me" cant be nullptr or schedule not even will be executed.
weird because 52479 Gift of the Harvester has conditions in DB, so implicit target need handle with this.
You debuged it already?
There was a problem hiding this comment.
missing _scheduler.CancellAll on death/removefromworld maybe?
There was a problem hiding this comment.
You think this might be the reason of crashes?
There was a problem hiding this comment.
maybe it is needed? (before scheduler) should avoid crash (i think)
_scheduler.SetValidator([this] { return me != nullptr; });Looks like when TaskSchedule is running, object is despawned already.
So, looks like 2 sec time is wrong, or object need more time before despawn.
There was a problem hiding this comment.
It's not "me" being null, look at stack frame 17
There was a problem hiding this comment.
me = caster
and caster is null at this point: https://gist.github.com/Sorikoff/3d1ed6ee2e5573198fb99c8c1ebaf940#file-gistfile1-txt-L17
So while this schedule is executing, object (me/caster) despawn.
Or objects still use a little trigger creature to cast spells?
There was a problem hiding this comment.
#17 0x0000555557b81f42 in WorldObject::CastSpell (this=0x7fff82615c00, target=0x0, spellId=52479
"this" is "me" and it's not null
There was a problem hiding this comment.
ok... but why caster is null in #2?
if i remember right, all objects use a world trigger to cast spells, idk if is current behavior still.
There was a problem hiding this comment.
Maybe it's a bug when the caster is a gameobject
|
@Shauren Taskscheduler work like "assync basic events" right? |
|
@Keader TaskScheduler can execute both synchronously and asynchronously, it depends which method is used to schedule the task |
this is 0x7fff82615c00 so it's not null. The null is deep down the callstack, probably some GetCaster() calls expecting the caster to still be there. Debugging it should show it. |
|
EventMap can have same behavior? |
|
both, eventmap and taskscheduler rely on Unit::Update, if its not called, both do nothing. |
|
any followup on this @Sorikoff ? did you find the cause of the crash Edit: check the comment at #23114 (comment) Please set this PR as draft until all issues has been solved |
| void HandleScriptEffect(SpellEffIndex /*effIndex*/) | ||
| { | ||
| uint32 spellId = RAND(SPELL_MINER_GHOUL_TRANSFORM, SPELL_MINER_GHOST_TRANSFORM); | ||
| GetCaster()->CastSpell(GetHitUnit(), spellId, true); |
There was a problem hiding this comment.
GetCaster() returns Unit* so ofc it will return NULL when the caster is a GameObject
Try GetGObjCaster() instead (and NULL check it too)
After that set a breakpoint here and debug it to ensure everything works as expected
There was a problem hiding this comment.
Works like a charm now. Thanks a lot!
|
I will continue later on. |
|
Hi, is this PR closed now ? |
|
Yep. More generic fixes are needed. |
Changes proposed:
Data3value (spell casted in this case).Target branch(es): 3.3.5
Tests performed: Does build. Could work-in-game.
Known issues and TODO list: (add/remove lines as needed)
this(WorldObject*) becomes NULL-ed for some reason.https://gist.github.com/Sorikoff/3d1ed6ee2e5573198fb99c8c1ebaf940
TrinityCore/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
Line 904 in a1dec9b