Aller au contenu

Photo

(Solved) HeroicStats tracking


  • Veuillez vous connecter pour répondre
1 réponse à ce sujet

#1
jsd313

jsd313
  • Members
  • 184 messages
I have edited the heroicStats and Party stats to fit my mod but I now want to track 2 new things. Both new items show up in the GUI in game and I have added the below code into stats_core_h.

[dascript]
const int HERO_STAT_ARENA_WINS = 2040;
const int HERO_STAT_ARENA_LOSES = 2041;

////////////////////////////////////////////////////////////////////////////////
// ARENA WINS AND LOSES
////////////////////////////////////////////////////////////////////////////////
// Handles number of arena wins
void STATS_HandleArenaWins(object oHero, object oTarget);
void STATS_HandleArenaWins(object oHero, object oTarget)
{
    float fOld = GetCreatureProperty(oHero, HERO_STAT_ARENA_WINS);
    float fNew = fOld + 1.0;
    SetCreatureProperty(oHero, HERO_STAT_ARENA_WINS, fNew);
}
// Handles number of arena loses
void STATS_HandleArenaLoses(object oHero, object oTarget);
void STATS_HandleArenaLoses(object oHero, object oTarget)
{
    float fOld = GetCreatureProperty(oHero, HERO_STAT_ARENA_LOSES);
    float fNew = fOld + 1.0;
    SetCreatureProperty(oHero, HERO_STAT_ARENA_LOSES, fNew);
}
[/dascript]

I have 2 ways I can think of to get the win or lose information, I just need to know how to get it relayed to the stats script to have it update the GUI like it does for kills and damage. I'll post my losing event from my module script, then my winning event sent from the area scripts. Any helping plugging this together would be greatly appreciated, thanks.

[dascript]
case EVENT_TYPE_SET_GAME_MODE:
        {
            int nGameMode = GetEventInteger(ev, 0);
            if ( nGameMode == GM_DEAD )
             {                
               DoAreaTransition("arena", "respawn");
               nEventHandled = TRUE;
            }
            break;
        }
[/dascript]

[dascript]
case EVENT_TYPE_TEAM_DESTROYED:
         {
           if (WR_GetPlotFlag(PLT_WARDENS_REWARDS, WIN_HOC) == FALSE)
          {
           WR_SetPlotFlag(PLT_WARDENS_REWARDS, WIN_HOC, TRUE);
          }
            DoAreaTransition("arena", "arena_select");
             break;
         }
[/dascript]

Modifié par jsd313, 18 avril 2010 - 12:52 .


#2
jsd313

jsd313
  • Members
  • 184 messages
Ok I was making it harder than it needed to be, happens :)
Only need the constants defined in stats_core_h, no other code there. Can probably  just define those constants in the module script, I'll have to check that. 

Then make each script look like this.

module script for when party wipes

[dascript]
case EVENT_TYPE_SET_GAME_MODE:
        {
            int nGameMode = GetEventInteger(ev, 0);
            if ( nGameMode == GM_DEAD )
             {               
               object oHero = GetHero();
               float fOld = GetCreatureProperty(oHero, HERO_STAT_ARENA_LOSES);
               float fNew = fOld + 1.0f;
               SetCreatureProperty(oHero, HERO_STAT_ARENA_LOSES, fNew);
               #ifdef DEBUG
               STATS_LogTrace("Arena Loses = " +ToString(fNew));
               #endif
              
               DoAreaTransition("arena", "respawn");
            }
            break;
        }
[/dascript]

and then the area script for when party wins

[dascript]
case EVENT_TYPE_TEAM_DESTROYED:
         {           
           object oHero = GetHero();
           float fOld = GetCreatureProperty(oHero, HERO_STAT_ARENA_WINS);
           float fNew = fOld + 1.0f;
           SetCreatureProperty(oHero, HERO_STAT_ARENA_WINS, fNew);
           #ifdef DEBUG
           STATS_LogTrace("Arena Wins = " +ToString(fNew));
           #endif  
                      
           DoAreaTransition("arena", "arena_select");

           break;
         }
[/dascript]

Modifié par jsd313, 18 avril 2010 - 12:54 .