This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Rochet2

Pages: 1 2 3 [4]
46
Miscellaneous / Re: [QUESTION] Unsheathe aura
« on: July 09, 2015, 10:59:47 pm »
Maybe try messing with Player::SetSheath?
Could be that sheathing cant be forced from server.

47
Miscellaneous / Re: [QUESTION] - Quest Bonus Objectives.
« on: July 09, 2015, 07:36:02 pm »
All the quest handling like how many objectives and when the quest is complete and what are the requirements to complete the quest and so on are decided by the core.
You just alter the system like stoneharry said.
Assuming the method isnt some flag for the client to bypass requirements ..
If it is, there is a chance that the client only is able to require all requirements or none.

The client probably has a limit for objectives, hence there are only so many fields in the database by default.
You should make some way to identify if an objective is optional by some extra column that is possibly boolean (1, 0) or similar.
Making whole new columns for bonus objectives all together might need more work and you might hit the max amount of objectives cap.
(not that I checked for any caps)

You can already name the objectives, so just adding the "(optional)" part to the end of the name is probably enough.

Think about what there is and what in it you can edit to make it work differently.

48
Serverside Modding / Re: [C++] Set PvP FFA when player enter map
« on: July 09, 2015, 03:31:43 pm »
Quote from: "bizzlesnaff"
So..the strange thing is, with your script I'm ffa flaged..except in orgrimmar, stormwind etc. :D

Its not so strange because that is how the FFA code works by default as well.
On FFA pvp realms the cities are not  FFA PVP either. And the stuff there is using the existing system.

.. I think.

If you want to disable the sanctuary stuff etc as well, setting the info to the pvpinfo should be enough before calling the update I think...

49
Serverside Modding / Re: [C++] Set PvP FFA when player enter map
« on: July 09, 2015, 12:11:03 pm »
As said on TC forums, this works for me on non custom maps.
Hmm .. I guess the naming of the event and such could be changed though ..

Code: [Select]
#include "ScriptPCH.h"

class Teleport : public BasicEvent
{
public:
    Teleport(Player* player) : _player(player)
    {
        player->m_Events.AddEvent(this, player->m_Events.CalculateTime(0));
    }

    bool Execute(uint64 /*time*/, uint32 /*diff*/)
    {
        printf("TIME EVENTn");
        _player->pvpInfo.IsInFFAPvPArea = true;
        _player->UpdatePvPState(true);
        return true;
    }

    Player* _player;
};

class OnMapEnter : public PlayerScript
{
public:
    OnMapEnter() : PlayerScript("OnMapEnter") { }

    void OnUpdateZone(Player* player, uint32 /*newZone*/, uint32 /*newArea*/) override
    {
        if (player->GetMapId() == 1)
        {
            printf("UPDATE ZONE!n");
            new Teleport(player);
        }
    }

    void OnMapChanged(Player * player) override
    {
        if (player->GetMapId() == 1)
        {
            printf("UPDATE MAP!n");
            new Teleport(player);
        }
    }
};

void AddSC_OnMapEnter()
{
    new OnMapEnter();
}

50
Not with the current functionality it seems.
You would need to respawn the object.

However these might interest you
https://github.com/TrinityCore/TrinityC ... -109640599
https://github.com/TrinityCore/TrinityC ... f39eb524d6

51
Serverside Modding / Re: [C++] Set PvP FFA when player enter map
« on: July 06, 2015, 03:47:53 pm »
Try using this hook instead.
https://github.com/TrinityCore/TrinityC ... #L766-L767

The FFA flags are updated on zone update, which might trigger when you start moving (makes you change the zone specific channels and stuff):
You still need the timed event since the hook triggers before the flag setting etc work is done by core normal code.

52
Serverside Modding / Re: [C++] Set PvP FFA when player enter map
« on: July 06, 2015, 12:42:26 pm »
Try use the override keyword.
In this case you happened to write the OnMapChanged hook wrong in the new script of yours as well.
Correct the hook name to OnMapChanged and it should start triggering again.

53
Serverside Modding / Re: [C++] Set PvP FFA when player enter map
« on: July 05, 2015, 08:23:06 am »
Hmm, dont see a reason for it to crash.
Only that it has a thread safety issue.

Removed some of the useless code:
Code: [Select]
#include "ScriptPCH.h"

enum Enums
{
    FIRST_TELEDELAY = 1000,
};

class Teleport : public BasicEvent
{
public:
    Teleport(Player* player) : _Plr(player) { }

    bool Execute(uint64 /*time*/, uint32 /*diff*/)
    {
        if (_Plr->GetMapId() == 9999)
        {
            printf("Executing timed eventn");
            _Plr->SetPvP(true);
            _Plr->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
        }

        return true;
    }
    Player* _Plr;
};

class OnMapEnter : public PlayerScript
{
public:
    OnMapEnter() : PlayerScript("OnMapEnter") { }

    void OnChangeMap(Player* player)
    {
        if (player->GetMapId() == 9999)
        {
            printf("Adding timed eventn");
            player->m_Events.AddEvent(new Teleport(player), player->m_Events.CalculateTime(FIRST_TELEDELAY));
        }
    }
};

void AddSC_OnMapEnter()
{
    new OnMapEnter();
}



Maybe you should try build in debug mode and or run it under a debugger?

54
Serverside Modding / Re: [C++] Set PvP FFA when player enter map
« on: July 04, 2015, 09:02:32 pm »
Most likely (did not check) the player enter map hook runs before updatezone function is called for the player.
In that function call the pvp flags are set again.

Incase you want to have the pvp flag on even though the player changes zones, you might want to use the update zone hook.

For the timed event, See how BasicEvent is used.

It goes about like this:

Code: [Select]
class MyEvent : public BasicEvent
{
MyEvent(Player* player) : player {}
    bool Execute(uint32, uin64)
{
// my code to do on timed event
return true;
}
Player* player;
};

player->m_events->ScheduleEvent(new MyEvent(player), player->m_events->CalculateTime(0));

Wrote that from memory so dont expect it to work without edits.

55
Serverside Modding / Re: [C++] Set PvP FFA when player enter map
« on: July 04, 2015, 04:27:26 pm »
OnPlayerEnterMap is not a hook.

If you look in ScriptMgr.cpp you see that OnPlayerEnterMap triggers the hook OnMapChanged, which is what you should be using as well.
C++ has this great new keyword "override" and I recommend using it.
It makes sure the function actually overrides a virtual function like it is supposed to.


Code: [Select]
#include "ScriptPCH.h"

class OnMapEnter : public PlayerScript
{
public:
    OnMapEnter() : PlayerScript("OnMapEnter") { }

    void OnMapChanged(Player* player) override
    {
        if (player->GetMapId() == 9999)
            player->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
    }

};

void AddSC_OnMapEnter()
{
    new OnMapEnter();
}

By adding prints Kaev meant that you should add code that outputs something to the worldserver console or elsewhere so you can see that the code actually runs.
For example
Code: [Select]
printf("Does this appear in console?n");

If the code above still does not work, it might be that the flags are reverted back after the hook runs.
Many hooks actually execute BEFORE the event actually happens.
You can make a function trigger after the event by using a timed event with 0 as the delay so it will execute "as soon as possible".

56
Miscellaneous / Re: Morph while keeping armor?
« on: July 03, 2015, 04:56:28 pm »
Maybe try or see my DressNPCs patch?
rochet2.github.io/Dress%20NPCs.html
I cant post links yet so .. uh .. right.

It is based on abusing mirror image packet and allows making NPCs of any race with any equipment.
However same method can be used on players.

57
Serverside Modding / Re: [C++] Command crashes on usage
« on: July 02, 2015, 11:48:45 pm »
Maybe this helps?

Code: [Select]
static bool HandleNewCommand(ChatHandler* handler, char const* args)
{
    // get world session
    WorldSession* session = handler->GetSession();
    // make sure it exists. It doesnt if this command is called from the console
    if (!session)
        return false;

    // get the player that invoked this command
    Player* player = session->GetPlayer();
    if (!player)
        return false;

    // get the player's target and make sure its a player
    Player* target = player->GetSelectedPlayer();
    if (!target)
        return false;

    // make a database query with the account ID
    // dont use strings to identify things :) And you can get the name from auth database by the account id anyways if needed
    QueryResult result = CharacterDatabase.PQuery("SELECT `info` FROM `characterinfo` WHERE `accountid` = %u", target->GetSession()->GetAccountId());

    if (!result) // always make sure a row was returned before actually using it
    {
        handler->SendSysMessage("Info: no info");
    }
    else
    {
        // get the info string from the query. the selected values are indexed starting from 0, so info is at position 0
        std::string info = result->Fetch()[0].GetString();
        handler->PSendSysMessage("Info: %s", info.c_str()); // using c_str() to convert the std::string into const char* which is what PSendSysMessage, printf and other need.
    }

    // command succeeded, return true to not show syntax info or error message
    return true;
}


Usually wrong database queries call abort and close the server. Better get those database types and columns right.

58
Serverside Modding / Re: [QUESTION] Morphing item
« on: July 02, 2015, 10:18:53 pm »
You either need to use a spell or a script.

Spell would nicely take use of the aura system incase the player has multiple morphs. Lets say he has your trinket and noggenfogger, the spell system would probably be able to restore the other when the other wears out and maybe take into account other things.

If you apply the morph on equip (or on spell cast) and then the player morphs to something else (noggenfogger) it might be a hassle to try to restore the morph from the trinket after that without checking all the time for the correct displayid.

What core do you use for the server?

Mangos based cores (mangos, cmangos, trinitycore.. ) do not have an "on equip" hook in their C++ scripting API. Unsure about arcemu ?_?
This means that you would need to modify the core to add such a hook.
A workaround for this could be .. yet again .. using a spell.
By using a spell on use for the item you can script the spell to do what you want in C++.
You can use the same spell for all items you create since you can script it to do different things according to the item entry or other data.

Did I mention a spell yet? :3

Quote from: "bizzlesnaff"
No that's not possible. But i thought u try to morph the player when the item is worn...maybe it is an translation mistake by me...worn means damaged so in wow the item is shown "red". trinkets, rings, back, neck etc. can never lose durability.
by worn he probably meant that he wanted the morph to be visible when the item is equipped/weared.

59
Random / Re: Become lootable on death?
« on: June 28, 2015, 10:58:46 am »
You can probably hack that into the insignia loot code.
When you click that ingame, make it send a loot table with the player's gear.

Here is one way:
https://youtu.be/8cSs4KtbeDI?t=118
But I guess having it without any additional object would be possible as well.

/me waves

Pages: 1 2 3 [4]