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!

Menu

Author Topic: [QUESTION] [WotLk] Setting NPC friendly to guildmember  (Read 1517 times)

bizzlesnaff

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 124
    • View Profile
[QUESTION] [WotLk] Setting NPC friendly to guildmember
« on: March 30, 2016, 03:03:01 am »
Well guys, the title isn't very useful I think :)
I work atm with some guildhouse scripts, playerhousing, try to combind both and add an open pvp to the whole area. I'll describe my idea now because I've no idea how to explain my problem:

On a custom map there are 4-5 guildareas. Every area is ownend by a different guild. So far, no problem thank to lordpsyan's guildhouse patch  :D
Now, every guildmember can spawn 1-2 guards in their area to protect the whole city. This guard need to be friendly to everyone of guild A, but aggressive to guild B,C...
I've honestly not a little idea how I can handle this. I also tried to find something with google but I don't know what I'm searhing for.

Maybe anyone here has an Idea what I mean and can help :) ?
Would be really great :D
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

bizzlesnaff

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 124
    • View Profile
Re: [QUESTION] [WotLk] Setting NPC friendly to guildmember
« Reply #1 on: April 01, 2016, 05:43:32 am »
Mighty push :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Amaroth

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 1219
    • View Profile
    • Amaroth's Tools
Re: [QUESTION] [WotLk] Setting NPC friendly to guildmember
« Reply #2 on: April 01, 2016, 10:07:43 am »
Solution via core scripting: write a method which will check player's reputations and guild he's present in. If he has some reputations which aren't his guilds, reduce them to -40000. If he is in guild but doesn't have that guild's reputation, raise his guild's reputation to 40000. Execute this method whenever player joins or leaves guild, and also whenever player lets say logs in, to make this really be reliable.

Will I write this for you? Nope. I can't code in C++ and I can't code in core. Consider this being just an idea.

A workaround would be giving players rep+ with their reputations and rep- with all other enemy reputations from a spell applied on an item, which would be for one use. Players would have such items in GB and would simply handle them to newbies. Problem is that you can't, obviously, really force players to actually use that item, so they can exploit this system a little bit. You may add some guild armor or whatever, which would need reputation in order to be used, by that way you would probably force players to really use reputation item.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
English YT tutorial channel. Check it out if you preffer videos over walls of text.:
https://www.youtube.com/AmarothEng

Want to support me for my releases and/or tutorials? You can send donation via Paypal to:
jantoms@seznam.cz

bizzlesnaff

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 124
    • View Profile
Re: [QUESTION] [WotLk] Setting NPC friendly to guildmember
« Reply #3 on: April 01, 2016, 05:03:57 pm »
Which "guild reputation" ? I don't know exactly what u mean.

I hope, that u don't write this for me :D I like to get it by myself.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

samgartell

  • Registred Member
  • Loreweaver
  • *****
  • Posts: 92
    • View Profile
Re: [QUESTION] [WotLk] Setting NPC friendly to guildmember
« Reply #4 on: April 02, 2016, 11:00:27 am »
I think he was referring to a guild reputation of your own creating, a new ID for each guild etc.

His idea for using an item to set those reputations is actually a brilliant idea though, and it could be achieved fairly easily, a way to circumvent the issue of people not using them and as a result having the ability to walk into Enemy AND Friendly cities would be to make the default for all factions Hated, so until they use the item, all cities are hostile.

Other fun but even easier to exploit ideas are the use of Tabards to set Reputation with an Equip effect, or a short quest-line of your design ending with the setting of reputation.

A quest could involve initiation, proving your loyalty to a Guild, or a more fantasy idea such as finding a hidden object that refers to a mysterious collective, and when tracked down, a position being offered possibly after a few more quests to prove loyalty.

Naturally, a guild master or Officer would have to approve the invitation, but that could be done with a few methods, like having the final quest ask you to speak to a high ranking member of the guild to acquire an item for the quest, and the quest reward being a tabard, which would prove they've completed the quest and set their reputation.

I know this isn't maybe the technical information you were hoping for, but I really do hope it helps in the long run!
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

bizzlesnaff

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 124
    • View Profile
Re: [QUESTION] [WotLk] Setting NPC friendly to guildmember
« Reply #5 on: April 03, 2016, 12:49:01 am »
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
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Ascathos

  • Moderators
  • Creator of Worlds
  • *****
  • Posts: 1129
    • View Profile
Re: [QUESTION] [WotLk] Setting NPC friendly to guildmember
« Reply #6 on: April 03, 2016, 01:13:21 am »
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: [Select]
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;
        }
    };
};

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.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

bizzlesnaff

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 124
    • View Profile
Re: [QUESTION] [WotLk] Setting NPC friendly to guildmember
« Reply #7 on: April 03, 2016, 06:14:29 am »
Man, that's great!  :)
Can't thank u enough ;)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »