Forum > Serverside Modding
[QUESTION]script for creature like scourge skydarkener
(1/3) > >>
MR. Farrare:
is there a way to make a creature script like the script in scourge sky darkener in dk quest line that shoot an invisble target far away srry for my english :lol:
stoneharry:
Yes. There is a invisible display ID - spawn a creature with that, give it the untargetable flags on the bitmask, and then have your npc cast a spell on it.
MR. Farrare:
i know and i did that but i want the npc to shoot far far far out of range npc and out of aggro too like the sky darkener he shooot the sky darkener target even if it out off aggro range and thx for the reply mate
stoneharry:
--- Quote from: "raeef" ---i know and i did that but i want the npc to shoot far far far out of range npc and out of aggro too like the sky darkener he shooot the sky darkener target even if it out off aggro range and thx for the reply mate --- End quote ---
You can cast at GPS coordinates of unlimited range, if you send the necessary packets.
A code snippet for a command I added:
--- Code: ---bool ChatHandler::HandleCastAOECommand(const char *args, WorldSession *m_session) { Unit *u = getSelectedUnit(m_session, false); if(!u) u = m_session->GetPlayer(); uint32 spell = 0; uint32 triggered = 0; float x,y,z = 0.0f; if( sscanf(args, "%u %f %f %f %u", &spell, &x, &y, &z, &triggered) != 5) if(sscanf(args, "%u %u", &spell, &triggered) != 2) return false; if(x == y) { if(u = getSelectedUnit(m_session, false)) { x = u->GetPositionX(); y = u->GetPositionY(); z = u->GetPositionZ(); } else return false; } SpellEntry* sp = dbcSpell.LookupEntryForced(spell); if(!sp) { SystemMessage(m_session, "Invalid spell %u", spell); return true; } m_session->GetPlayer()->CastSpellAoF(x,y,z ,sp, triggered >= 1 ? true : false); BlueSystemMessage(m_session, "Casted aoe spell %u.", spell, GetSelectedUnitName(u)); sGMLog.writefromsession(m_session, "Casted aoe spell %u.", spell, GetSelectedUnitName(u)); return true; }
--- End code ---
Then the primary function we are relying on:
--- Code: ---void Unit::CastSpellAoF(float x, float y, float z, SpellEntry* Sp, bool triggered) { if(Sp == NULL) return;
SpellCastTargets targets; targets.m_destX = x; targets.m_destY = y; targets.m_destZ = z; targets.m_targetMask = TARGET_FLAG_DEST_LOCATION; Spell* newSpell = sSpellFactoryMgr.NewSpell(this, Sp, triggered, 0); newSpell->prepare(&targets); } --- End code ---
Using this I can cast spell ID 11 onto any coordinate position basically, for example.
MR. Farrare:
:? man im new at this i only colored some npc and did a new land but im not good in server dev i see its no sql and i use a repack a mangos one so can you help me plz
Navigation
[0] Message Index
[#] Next page
|