EventScripts with SAI or C++

I tried to implement eventscripts with sai and c++.

https://github.com/joschiwald/TrinityCore/commit/bf87c27ff08a95dec36d2b437d494964d85654b5

https://github.com/joschiwald/TrinityCore/commit/dc447e81da619cda4b45f47fcfbf759c69b75e6f

https://github.com/joschiwald/TrinityCore/commit/7e42da1647ef081ee10cc6e2fe5b402dade19fd8

example scripts (summon creature with no delay):

http://www.trinitycore.org/f/pastebin/kkiclphti7o/

any opinions about this?

Really great you are implementing this!

Looked that script looks as pretty good start (actually I con’t know how much needs to be done, since can’t understand what is missing, looks pretty covered up). Great initiative btw, this was needed so much. I hope some main dev will look upon this soon.

IIRC event_scripts table will be dropped, and event_scripts needs to be converted to SAI, but SAI ATM don’t supports events, maybe Nay or Subv can answer better.

http://www.trinitycore.info/Smart_scripts_tc2#source_type_2

Interesting…

As a suggestion, I’d say store the triggerer’s map pointer, and handle all summoning actions with that, (if me/go doesn’t exist)

with this patch the old functionality can be dropped, we need only a table that holds eventid and scriptname, as every sai or c++ script

we can also get rid of the hole table but it needs an event filter in each c++ script if we broadcast the event to each script

To clarify @joschiwald talks about table for c++ only, the event SAI is implemented where smart_scripts stay. (got asked more than once, so decided to say it, I hope I got it correct anyway).

@Subv: there is always a baseobject except the pointer becomes invalid (should not happen) or it’s a player (not implemented), for gameobject events it’s the gob itself and for spell events it’s the target (target can be focusobject) or the caster if there is no target

we can save the baseobject as worldobject instead of me and go, there is set only one, either me or go

added commit, now it should work with many actions

it needs only something to handle delay (column used in old table) but i have no idea how can do this

also added example scripts in first post

Think the delay can be handled by timedactionlist. There was a delay column for every deprecated *_scripts table and there is no other possibility with SAI now, afaik.

Why keep the event_scripts table? Why not create a source type of EVENT?

– Brian

@Brian please read comment #6 it’s the same like areatrigger_scripts or spell_script_names

what do you mean with “source type of EVENT”?

He means of creating:

SMART_SCRIPT_TYPE_CREATURE 0 SMART_SCRIPT_TYPE_GAMEOBJECT 1 SMART_SCRIPT_TYPE_AREATRIGGER 2 http://www.trinitycore.info/images/Unused.png SMART_SCRIPT_TYPE_EVENT 3 http://www.trinitycore.info/images/Unused.png SMART_SCRIPT_TYPE_GOSSIP 4 http://www.trinitycore.info/images/Unused.png SMART_SCRIPT_TYPE_QUEST 5 http://www.trinitycore.info/images/Unused.png SMART_SCRIPT_TYPE_SPELL 6 http://www.trinitycore.info/images/Unused.png SMART_SCRIPT_TYPE_TRANSPORT 7 http://www.trinitycore.info/images/Unused.png SMART_SCRIPT_TYPE_INSTANCE 8 SMART_SCRIPT_TYPE_TIMED_ACTIONLIST 9

When red the code I tought you did that.

@Trista: right