Aller au contenu

Photo

Rewards Scripts


  • Veuillez vous connecter pour répondre
10 réponses à ce sujet

#1
Sonmeister

Sonmeister
  • Members
  • 167 messages
I'm looking for some examples of reward scripts that anyone might have or know about.  I have found a couple but am trying to work out some bugs in my script.  I've been setting some plot flags and my rewards are not being given even though the quest moves on to the next stage.  I thought maybe if I do some scripts instead it will work better?  Anyway, just experimenting like the rest of you.

#2
PavelNovotny

PavelNovotny
  • Members
  • 344 messages
Are you talking about rewards that you set up through the rewards.xls m2da?



Or are you giving the piece an item through a plot flag and a script with an AddItemToInventory or something like that?



You should post your script - it would be easier for us to figure out what the problem is that way.

#3
Craig Graff

Craig Graff
  • Members
  • 608 messages
You need to call WR_SetPlotFlag with the nCallScript parameter set to TRUE if you want the reward to be given. You also have to either have the default plot script attached or a custom plot script that falls through to plot_core.
Otherwise you would need to duplicate the code in plot_core, specifically the call to RewardDistibuteByPlotFlag(strPlot, nFlag), a function from sys_rewards_h.

Modifié par Craig Graff, 16 avril 2010 - 09:38 .


#4
Sonmeister

Sonmeister
  • Members
  • 167 messages
I want to give my player an XP award of 3000 for killing a dragon that is flagged as the reward KILL_DRAGON in rewards.xls that I created and changed to rewards.2da for my module.

#5
Proleric

Proleric
  • Members
  • 2 350 messages
What I'd do is set a plot flag in the death event of the creature script.

#6
Sonmeister

Sonmeister
  • Members
  • 167 messages
Can you show me an example script of that?

#7
BillHoyt

BillHoyt
  • Members
  • 109 messages
If you just want to award 3000xp, I don't think you need to put that in a script. Open your plot (e.g. KILL_THE_DRAGON) and on the flag that notes the death of the dragon (e.g. DRAGON_STEW), select reward BEC_PC_JOINS_GREY_WARDENS in the third column.  That should award 3000xp when set to TRUE.

Then enter the following in your AREA script:

#include "events_h"
#include "wrappers_h"
#include "plt_kill_the_dragon"


void main()
{
    event ev = GetCurrentEvent();
    int nEventType = GetEventType(ev);

    switch(nEventType)
    {
        case EVENT_TYPE_TEAM_DESTROYED:
        {
            if(GetEventInteger(ev,0) == 1)
            {
                WR_SetPlotFlag(PLT_KILL_THE_DRAGON, DRAGON_STEW, TRUE);
            }
            break;
        }
    }
    HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);
}

Just make sure your dragon is a member of team "1"  (in general attributes right below its tag) and that should do it.

#8
Sonmeister

Sonmeister
  • Members
  • 167 messages
I have this script you posted already and I tried the rest of what you suggested before, even creating my own M2DA. The reward just doesn't seem to work. My three quest flags update on que. But my reward doesn't seem to come through. Maybe one of my plot assist flags isn't correct? I'll keep plugging away.



I would still like to see an example of a reward script if anyone has one?

#9
Proleric

Proleric
  • Members
  • 2 350 messages
Here's a subset of our creature script. It still uses a plot flag and the rewards 2DA. After we wrote it, one of the Bioware devs commented that the Team Destroyed event used by BillHoyt is more elegant, if only because it allows you to put both team and individual kills in the same place.
// Crown of Creation - Creature Event Script
//
// Adaram 24-Jan-2010
// Modified by Proleric 09-Feb-2010
//

#include "utility_h"
#include "coc_h"

void main()
{
// keep track of whether the event has been handled

int    bEventHandled = FALSE;
event  ev            = GetCurrentEvent();
object oCreature     = OBJECT_SELF;

switch(GetEventType(ev))
  {
        // ---------------------------------------------------------------------
        // EVENT_TYPE_DYING - Received on the creature getting the killing blow
        // ---------------------------------------------------------------------
        // - Plot flags are set for certain creatures.
        case EVENT_TYPE_DYING:
        {
            object oKiller = GetEventObject(ev, 0);

            // Dispense death rewards.
            if (IsObjectValid(oKiller) && IsPartyMember(oKiller))
            {
//Custom code
              string sCreature = GetTag(oCreature);

              if (sCreature == "coccr_deceit")
                WR_SetPlotFlag(PLT_COCPT_DECEIT, COC_DECEIT_DEAD, TRUE, TRUE);
             }
             break;
        }
  }

// if this event wasn't handled by this script fall through to the core script
if(!bEventHandled)
  {
    HandleEvent(ev, RESOURCE_SCRIPT_CREATURE_CORE);
  }
}
If you want to see how rewards are allocated by WR_SetPlotFlag, it's in wrappers_h, but it seems easier to do all this through the rewards table.

#10
BillHoyt

BillHoyt
  • Members
  • 109 messages
If you want to add XP directly without worrying about 2DAs at all, download the DADBDATA for Sunjammer's Deep Roads Courier (http://social.biowar...m/project/2583/) and follow his leader. In his script "sj_fedex_message" Sunjammer adds experience directly to the player upon quest completion via a custom function.

It's a very straightforward approach that ought to avoid any issues with the plot missing awards.

 

Modifié par BillHoyt, 18 avril 2010 - 02:48 .


#11
Sonmeister

Sonmeister
  • Members
  • 167 messages
I downloaded Sunjammer's fedex file last night, haven't looked at it yet, but will...

Edited:

I've been looking at the scripts.  I haven't tried to incorporate it yet since I'm still having trouble with the plots and flags (my other post).  I lean more towards the artistic side (visual and story telling), so the programming is taking some time for me to understand.  I'm thinking I need to write some really simple reward scripts from what I'm learning and try them out until I can get them to work and build up from there.  I appreciate any and all help I've been getting! 

I've been reading scripts breaking them down line by line to get a better understanding of how to write my own.  Copying and pastings is much easier but not as satisfying.

Modifié par Sonmeister, 21 avril 2010 - 12:36 .