Modcraft - The community dedicated to quality WoW modding!

Wrath of the Lich King Modding => Serverside Modding => Topic started by: MR. Farrare on June 04, 2013, 02:25:03 am

Title: [QUESTION]script for creature like scourge skydarkener
Post by: MR. Farrare on June 04, 2013, 02:25:03 am
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:
Title: Re: [QUESTION]script for creature like scourge skydarkener
Post by: stoneharry on June 04, 2013, 03:42:24 pm
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.
Title: Re: [QUESTION]script for creature like scourge skydarkener
Post by: MR. Farrare on June 05, 2013, 02:00:21 am
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
Title: Re: [QUESTION]script for creature like scourge skydarkener
Post by: stoneharry on June 05, 2013, 08:39:33 am
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

You can cast at GPS coordinates of unlimited range, if you send the necessary packets.

A code snippet for a command I added:
Code: [Select]
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;
}

Then the primary function we are relying on:

Code: [Select]
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);
}

Using this I can cast spell ID 11 onto any coordinate position basically, for example.
Title: Re: [QUESTION]script for creature like scourge skydarkener
Post by: MR. Farrare on June 05, 2013, 03:08:11 pm
:? 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
Title: Re: [QUESTION]script for creature like scourge skydarkener
Post by: osler on June 06, 2013, 09:40:30 am
First stop using repacks. They limit ALOT your customization and bug fixing.
I recommend you moving to Trinity since mangos community is almost dead. If you want Lua coding for serverside scripts you can install Eluna (don´t go for Arcemu unless you have alot of spare time and a big dev team which can fix it)
Heare you have a Trinity compiling guide http://collab.kpsn.org/display/tc/How-to_Win (http://collab.kpsn.org/display/tc/How-to_Win" onclick="window.open(this.href);return false;)
And an Eluna installation guide https://www.youtube.com/watch?v=JRm9ZfZnsIE (https://www.youtube.com/watch?v=JRm9ZfZnsIE" onclick="window.open(this.href);return false;)
Title: Re: [QUESTION]script for creature like scourge skydarkener
Post by: MR. Farrare on June 06, 2013, 10:49:14 am
i did it the compile now im comming eluna :twisted:
Title: Re: [QUESTION]script for creature like scourge skydarkener
Post by: MR. Farrare on June 07, 2013, 08:27:21 am
Quote from: "osler"
First stop using repacks. They limit ALOT your customization and bug fixing.
I recommend you moving to Trinity since mangos community is almost dead. If you want Lua coding for serverside scripts you can install Eluna (don´t go for Arcemu unless you have alot of spare time and a big dev team which can fix it)
Heare you have a Trinity compiling guide http://collab.kpsn.org/display/tc/How-to_Win (http://collab.kpsn.org/display/tc/How-to_Win" onclick="window.open(this.href);return false;)
And an Eluna installation guide https://www.youtube.com/watch?v=JRm9ZfZnsIE (https://www.youtube.com/watch?v=JRm9ZfZnsIE" onclick="window.open(this.href);return false;)

i did every thing compiled trinity and eluna but how to create this lua code and put it in game
Title: Re: [QUESTION]script for creature like scourge skydarkener
Post by: osler on June 07, 2013, 11:38:54 am
Create a folder named "scripts" where your .exe´s hve been created. Then create a .lua file there and it will be ingame. In order to make Eluna read it without restarting world server you must type ingame ".reload eluna"
For more information visit Eluna wiki: http://nomsoftware.com/wiki/doku.php?id=eluna (http://nomsoftware.com/wiki/doku.php?id=eluna" onclick="window.open(this.href);return false;)
Title: Re: [QUESTION]script for creature like scourge skydarkener
Post by: MR. Farrare on June 07, 2013, 02:33:22 pm
Quote from: "osler"
Create a folder named "scripts" where your .exe´s hve been created. Then create a .lua file there and it will be ingame. In order to make Eluna read it without restarting world server you must type ingame ".reload eluna"
For more information visit Eluna wiki: http://nomsoftware.com/wiki/doku.php?id=eluna (http://nomsoftware.com/wiki/doku.php?id=eluna" onclick="window.open(this.href);return false;)

ty
Title: Re: [QUESTION]script for creature like scourge skydarkener
Post by: MR. Farrare on June 08, 2013, 06:40:29 pm
Quote from: "osler"
Create a folder named "scripts" where your .exe´s hve been created. Then create a .lua file there and it will be ingame. In order to make Eluna read it without restarting world server you must type ingame ".reload eluna"
For more information visit Eluna wiki: http://nomsoftware.com/wiki/doku.php?id=eluna (http://nomsoftware.com/wiki/doku.php?id=eluna" onclick="window.open(this.href);return false;)

man i did every thing eluna and the core but how to put this script in game plz :cry:
Title: Re: [QUESTION]script for creature like scourge skydarkener
Post by: osler on June 08, 2013, 10:31:25 pm
Create a folder called scripts in the folder where the binaries (world and auth) and place the scripts there
Title: Re: [QUESTION]script for creature like scourge skydarkener
Post by: MR. Farrare on June 09, 2013, 02:34:26 pm
Quote from: "osler"
Create a folder called scripts in the folder where the binaries (world and auth) and place the scripts there

i have a script folder and i have dawnloaded some script from ac-web that work but  what im asking is hot work whith this stonnharry did what i copythat to a notepad and then edit it whith notpad ++ but then what how can i can make an npc like the scourge darkener in game i know the sql part but the script what i will do that is the qustion srry for my english and i hope you help (and i mean what i change in the script were i put the ids of the spell and npc that it will target it and distance) and i ment can rewrite the code of stone harry whith the spell id 11 and npc id 100000 that what the spell will target and the distance anywere plz and thx and srry for your time :|