I have been thinking in a way of a more dinamic boss battles and i’m thinking ways to the boss give orders to his minions if certain conditions are meet. My idea is for a necromancer controlling his minions.
For example, if someone cast spells as wizard / sorcerer (With a certain delay or it may cause a spam…) make a SpeakString for the boss shouting " Attack the caster fools!!" then change the target of specified minions to the caster. The condition can be diferent just making an example.
My question is, does a npc using SpeakString trigger OnPlayerChat events? If not, the only way I can think is by seting a local variable in the area amd have those minions be controlled depending on the variables set there. Like SetLocalInt(oArea,“AttackCaster”,1) and have the minion read that variable with a delay… May be too complex.
You could do this by setting listening patterns on your minions and then having the boss shout to them. That’s what the functionality is for. Look in the general onspawn script. And maybe the lexicon for OnConversation etc.
Or if you know the minion objects you could send them userdefined events with SignalEvent() to control what they do.
Not a script. Spell ID - for actual spells - is simply their matching row in spells.2da. But you’re right you can obtain all spell data this way, including its impact script.
When a spell is cast on a creature, this spell’s impact script tells the target who did what to it, i.e. fireball:
Target can react to this situation in its own OnSpellCastAt (one place for all spell events), which for standard creatures defaults to nw_c2_defaultb.
Standard reaction is: “Spell harmful? DetermineCombatRound()”. You can put your own script in its place. Something like this:
// OnSpellCastAt event handler
void main()
{
int iCaster = GetLastSpellCaster();
int iSpell = GetLastSpell();
int iHarmful = GetLastSpellHarmful();
if(iSpell >= 0)
{
// this is a normal spell
ExecuteScript("nw_c2_defaultb", OBJECT_SELF);
return;
}
// spell is a "signal" - your code here
}