How to cast a spell into a certain hook instead of complete the whole hook cycle

To elaborate: I’m trying to cast a dummy spell that has a green cursor, now this spell cannot be casted from the player pov, it has to be cast from an npc that the player will gossip with and only after that it’ll be possible to cast the spell; but my issue is that i cannot find a method to cast a spell into extent of oncast, since player->castspell just finishes the whole cast cycle and just aftercast it.

So again to highlight - How to cast a spell and keep oncast hook on, like how ingame cast is handled (player cast a spell → cursor changes into a green circle → player execute on a location) instead of player->castspell that automatically does it all and skip the cursor part.