Hi, i’ve started skripting DS, and the first thing i want to ask you, how to make Kohcrome to use same abilities after 500ms?
Now i’m trying to make it, like this
kohcromeevents = diff + 500;
events.Update(kohcromeevents);
while (uint32 eventId = events.ExecuteEvent())
ExecuteEvent(eventId);
So, diff is for Morchok, diff + 500 for Kohcrome, but he keeps punching only.
The second thing, how to share HP between 2 npc’s?
// Evade or Respawn
void Reset()
{
tDo = 20000; // Reset timer
cCount = 1; // Start from 1
}
// Timed events
void UpdateAI(const uint32 diff)
{
// Timed say
if (tDo <= diff)
{
switch (cCount)
{
default:
case 1:
//Do Something
cCount++;
break;
case 2:
//Do something
cCount++;
break;
case 3:
//Do something
cCount = 1; //Reset to 1
break;
}
tDo = 20000; //Reset the timer
}
else
{
tDo -= diff;
}
}
Just an Example…
Im using Event System, so events is
void ExecuteEvent(uint32 eventId) OVERRIDE
{
switch (eventId)
{
case EVENT_STOMP:
DoCastAOE(SPELL_STOMP);
events.ScheduleEvent(EVENT_STOMP, StompTimer);
break;
case EVENT_CRUSH:
DoCastVictim(SPELL_CRUSH);
events.ScheduleEvent(EVENT_CRUSH, CrushTimer);
break;
case EVENT_VORTEX:
DoCast(me, SPELL_VORTEX);
events.ScheduleEvent(EVENT_VORTEX, VortexTimer);
break;
}
}
then, calling them using
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
ExecuteEvent(eventId);
Aaaah, okay… Try this:
EventMap _events; //This is in the Class!
void Reset() OVERRIDE
{
_events.Reset();
}
void UpdateAI(uint32 diff) OVERRIDE
{
_events.Update(diff);
switch (_events.ExecuteEvent())
{
case EVENT_STOMP:
DoCastAOE(SPELL_STOMP);
_events.ScheduleEvent(EVENT_STOMP, StompTimer);
break;
case EVENT_CRUSH:
DoCastVictim(SPELL_CRUSH);
_events.ScheduleEvent(EVENT_CRUSH, CrushTimer);
break;
case EVENT_VORTEX:
DoCast(me, SPELL_VORTEX);
_events.ScheduleEvent(EVENT_VORTEX, VortexTimer);
break;
default:
break;
}
}