Forum > Serverside Modding

[QUESTION] [WotLk] Setting NPC friendly to guildmember

<< < (2/2)

bizzlesnaff:
Yes, u're right :D That's not exactly the information I need :)
I'm missing the one information: Which command can I use.
So if two players with the same guild are meet in an ffa area, how it is possible to create an script update or whatever so that they get the same faction. And what is the right syntax? Something like:
If (player->GetInCombat)
{
    If (playerGuildID == victimGuildID)
       {
            player->SetFaction 35
        }
}

Man..I whis my english would be better, so I can tell you guys exactly what's my problem :D
If have many ideas, how to handle my problem, but I have no idea how to bring it down to a code :P

Ascathos:
Make it a playerscript. You can check for being within a FFA zone iirc.


EDIT:
This is an incredibly raw and rough setup. This is how it could look like.


--- Code: ---enum GuildHousesPvP
{
    GUILDHOUSEPVPMAPID = 1, // MapId
};


class TestScript : public PlayerScript
{
public:
    TestScript() : PlayerScript("Test_Script") { }

    struct Test_Script_Guards : public PlayerScript
    {
        void OnMapChanged(Player* player) override ///@TODO: Maybe MapScript OnMapUpdate is more effective here ? Would be ugly because you'd have to get every player on map.... meh.
        {
            if (player->GetMapId() == GUILDHOUSEPVPMAPID && player->GetGuildId() != 0) // Note: NULL is 0, just NULL is commonly used for strings (Readability)
                /*Set faction for NPC GUIDs to whatever is approperiate. Handle it by getting the guids of guards.*/

            return;

        }
    };
};

class TestScriptGuild : public GuildScript ///@TODO: If OnMapUpdate is used, this can be entirely removed.
{
public:
    TestScriptGuild() : GuildScript("Test_Script_Guild") { }

    struct Test_Script_Guild : public GuildScript
    {
        void OnGuildRemoveMember(Guild* /*guild*/, Player* player, bool /*isDisbanding*/, bool /*isKicked*/) override
        {
            if (player->GetMapId() == GUILDHOUSEPVPMAPID)
                player->RepopAtGraveyard(); // Or whatever. Maybe tele to a location depending on faction.
                                                                  // However, first, player is kicked out if he is removed from guild (and on map). Do not allow player joining the map without guild in the first place and we are good.

            return;
        }
    };
};
--- End code ---

This is more raw than fresh beef just butchered. Probably not 100% working as intended, it is just a general pointer what COULD be done.

bizzlesnaff:
Man, that's great!  :)
Can't thank u enough ;)

Navigation

[0] Message Index

[*] Previous page

Go to full version