(IN PROGRESS) Party reward script

Please post suggestions and questions about Alangara in this forum.
Post Reply
User avatar
tarashon
Posts: 857
Joined: Sun Jan 11, 2015 6:27 pm

(IN PROGRESS) Party reward script

Post by tarashon » Thu Feb 26, 2015 4:44 pm

To transfer severel quest from single NPC reward to party reward i need a script that does following...


A: only Works if partymember dont have item X
and is in same area as PC talking to npc.

B: takes itemY from intire party
Gives XP xxx to intire party
Gives GOLD xxx to intire party.
Gives itemX to intire party

In short the script i need to fix various quests to party settings.

/tara

Somnium
Site Admin
Posts: 173
Joined: Sat Jan 10, 2015 5:34 pm

Re: Need this script ASAP

Post by Somnium » Thu Feb 26, 2015 8:07 pm

I suggest a variant, where we give out the quest item to the entire party - then I won't have to rework the entire quest script framework ;) I'll catch you on Skype.
Somnium (a.k.a. Seeker)

Balkoth
Posts: 188
Joined: Mon Feb 23, 2015 1:55 pm

Re: Need this script ASAP

Post by Balkoth » Thu Feb 26, 2015 8:17 pm

I just PMed this code to tarashon if you want to look it over, Somnium.

Code: Select all

void main()
{
    // Set up objects for the person turning in their quest and for the loop
    object oPC = GetPCSpeaker(), oPlayer;

    // Get the first faction member in the PC's party (PC-only)
    oPlayer = GetFirstFactionMember(oPC, TRUE);
    while (GetIsObjectValid(oPlayer))
    {
        // If they don't have the quest token AND they're in the same area as the person turning in the quest
        if (GetItemPossessedBy(oPlayer, "questtoken") == OBJECT_INVALID && GetArea(oPC) == GetArea(oPlayer))
        {
            // Destroy the quest item and then give them gold, XP, and the quest token
            DestroyObject(GetItemPossessedBy(oPlayer, "questitem"));
            GiveGoldToCreature(oPlayer, 10000);
            GiveXPToCreature(oPlayer, 2000);
            SetItemCursedFlag(CreateItemOnObject("questtoken", oPlayer), TRUE);
        }

        // Get the next faction member in the PC's party (PC-only)
        oPlayer = GetNextFactionMember(oPC, TRUE);
    }
}

User avatar
tarashon
Posts: 857
Joined: Sun Jan 11, 2015 6:27 pm

Re: Need this script ASAP

Post by tarashon » Thu Feb 26, 2015 8:30 pm

Thanks alot MagicalMaster :)

Just talked to Seeker though and he explained me that basically "looping" over player items like that creates some massive lagspikes. Instead we will go for a version that checks for questgem/quest database completed ( whatever ) and gives those who are in party and same area the needed bossdrop directly.

So basically allmost all, if not all, quests requirering 1 item from one "named" will be Group completeable withinn this weekend depending on when Seeker can make the script - he is making it so it works together with the overall quest system that shall - over time - remove questgems intirely.

So really sorry if your time was wasted. In my defense I had hoped to have this done before tonite but that will not be possible i'm afraid...

/tara

Balkoth
Posts: 188
Joined: Mon Feb 23, 2015 1:55 pm

Re: Need this script ASAP

Post by Balkoth » Thu Feb 26, 2015 8:40 pm

tarashon wrote:So really sorry if your time was wasted.
It took like 10 minutes of time once I saw it, not a huge deal.
tarashon wrote:Just talked to Seeker though and he explained me that basically "looping" over player items like that creates some massive lagspikes. Instead we will go for a version that checks for questgem/quest database completed ( whatever ) and gives those who are in party and same area the needed bossdrop directly.
This part confuses me, though -- yeah, something like GetItemPossessedBy is basically looping through player items and if players are carrying a ton of items it could potentially cause issues (you'd need a LOT of items, though), but how are you planning on removing the quest item from players WITHOUT effectively looping through the player's items?
tarashon wrote:he is making it so it works together with the overall quest system that shall - over time - remove questgems intirely.
I was wondering why you weren't tracking information on a single token or using a database, but figured it really wasn't a big enough deal to worry about ;)

Somnium
Site Admin
Posts: 173
Joined: Sat Jan 10, 2015 5:34 pm

Re: Need this script ASAP

Post by Somnium » Fri Feb 27, 2015 6:42 am

Balkoth wrote: This part confuses me, though -- yeah, something like GetItemPossessedBy is basically looping through player items and if players are carrying a ton of items it could potentially cause issues (you'd need a LOT of items, though), but how are you planning on removing the quest item from players WITHOUT effectively looping through the player's items?
It's a matter of scale. While it is indeed impossible to avoid looping through player items when removing a quest item, I prefer looping through a single player's inventory in a single script, over looping through all party member inventories in a single script. Especially since we might later wish to support taking a specific number of quest items instead of only one.

Also, the script requested above wouldn't really solve the problem, since currently the party will typically only be rewarded a single quest item. Hence the script above would typically still only reward a single player, but would now iterate over every party member's inventory in order to do so.

We will probably go for more of an "instancing" approach: Every party member in the same area as the "boss" being killed, will receive their own copy of the quest item, which they can then hand over to the quest giver at their leasure.
Balkoth wrote: I was wondering why you weren't tracking information on a single token or using a database, but figured it really wasn't a big enough deal to worry about ;)
The quest system replacing the quest gem system, was introduced a few weeks before Alangara closed down back in the day, so we were still in the process of migrating the existing quests. As Tarashon mentioned, the end goal is to migrate all quests to use the new quest system instead of the quest gem system :)
Somnium (a.k.a. Seeker)

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests