Aller au contenu

Photo

What's the diff between SetObjectActive and WR_SetObjectActive?


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

#1
PavelNovotny

PavelNovotny
  • Members
  • 344 messages
I am having trouble with WR_SetObjectActive and was wondering if I am using the wrong one.

#2
Mengtzu

Mengtzu
  • Members
  • 258 messages
You can open up wrappers_h to see what the difference is. As the name suggests, the WR functions are usually wrappers around the conventional function anyway.



WR_SetObjectActive seems to do some logging and is more robust with animations/vfx. Personally I've never had any troubles with SetObjectActive, but I can't see any particular trouble points in WR_SetObjectActive either. What exactly are the problems you're having?

#3
PavelNovotny

PavelNovotny
  • Members
  • 344 messages
WR_SetObjectActive doesn't turn off the object - it leaves it there. SetObjectActive is turning off the object so you can't see it.

#4
Mengtzu

Mengtzu
  • Members
  • 258 messages
Weird. There's a SetObjectActive call right there in the function, which should fire unless the object is already in the state you requested. You should be OK to just use SetObjectActive itself though - that's all I've ever used.

#5
Craig Graff

Craig Graff
  • Members
  • 608 messages
They do exactly the same thing except that WR_SetObjectActive adds the default appear and disappear animations and VFX for the appearance type, signals EVENT_TYPE_OBJECT_ACTIVE to the object being affected (if it is set active), and logs some debug information (only on versions oft the game internal to BioWare).

Any chance you can post you script somewhere?

Modifié par Craig Graff, 30 mars 2010 - 02:58 .


#6
PavelNovotny

PavelNovotny
  • Members
  • 344 messages
Sure thing - none of my WR_SetObjectActive scripts were working, but as soon as I set them all to SetObjectActive they worked fine. Here's one example:

//::///////////////////////////////////////////////
//:: 00pav_trig_enter_bcave
//:: Script for the Enter Bear Cave trigger
//:://////////////////////////////////////////////
/*
Trigger events
*/
//:://////////////////////////////////////////////

#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"

#include "plot_h"

#include "plt_00pav_gb_main20"

void SetLocalVarOnTeam(object oCreature, string sTriggerTeamVar, string sVarToSetOnCreatures, int nValue)
{
int nTeam = GetLocalInt(OBJECT_SELF, sTriggerTeamVar);

if(IsFollower(oCreature) && nTeam > 0)
{
Log_Trace(LOG_CHANNEL_SYSTEMS, "trigger_core.SetLocalVarOnTeam", "Setting local var [" + sVarToSetOnCreatures + "]" + " on team: " + IntToString(nTeam));
// make sure it's done only once
SetLocalInt(OBJECT_SELF, sVarToSetOnCreatures, -1);
object [] arTeam = GetTeam(nTeam);
int nSize = GetArraySize(arTeam);
int i;
object oCurrent;
for(i = 0; i
{
oCurrent = arTeam[i];
if(GetLocalInt(oCurrent, sVarToSetOnCreatures) == 0)
SetLocalInt(oCurrent, sVarToSetOnCreatures, 1);
}
}
}

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

Log_Events("", ev);

switch(nEventType)
{
////////////////////////////////////////////////////////////////////////
// Sent by engine when trigger spawns into the game. Occurs once,
// regardless of save games.
////////////////////////////////////////////////////////////////////////
case EVENT_TYPE_SPAWN:
{
break;
}
////////////////////////////////////////////////////////////////////////
// Sent by engine when a creature enters the trigger
////////////////////////////////////////////////////////////////////////
case EVENT_TYPE_ENTER:
{
if(!GetObjectActive(OBJECT_SELF))
{
Log_Trace(LOG_CHANNEL_SYSTEMS, "trigger_core.EVENT_TYPE_ENTER", "Trigger inactive");
return;
}

object oCreature = GetEventCreator(ev);
string sAT_WP = GetLocalString(OBJECT_SELF, TRIGGER_AT_DEST_TAG);
string sAT_Area = GetLocalString(OBJECT_SELF, TRIGGER_AT_DEST_AREA_TAG);
object oPC = GetMainControlled();

int nTeam = GetLocalInt(OBJECT_SELF,TRIGGER_ENCOUNTER_TEAM);

object oBear = GetObjectByTag("00pav_gb_xroad_bear");
object oSienna = GetObjectByTag("00pav_gb_xroad_sienna");

// If Bear enters the trigger after being defeated deactivate him.
if (oBear == oCreature)
{
if (WR_GetPlotFlag(PLT_00PAV_GB_MAIN20, MAIN2_DEFEAT_BEAR))
{
WR_SetObjectActive(oBear, FALSE);
}
}

// If Sienna enters the trigger after Bear is defeated deactivate him.
if (oSienna == oCreature)
{
if (WR_GetPlotFlag(PLT_00PAV_GB_MAIN20, MAIN2_DEFEAT_BEAR))
{
WR_SetObjectActive(oSienna, FALSE);
}
}


// Activating team-help system on a team of creatures
SetLocalVarOnTeam(oCreature, TRIGGER_ACTIVATE_TEAM_HELP, AI_HELP_TEAM_STATUS, 1);


// Activate a team to be stationary (AI system) - soft
SetLocalVarOnTeam(oCreature, TRIGGER_ACTIVATE_TEAM_STATIONARY_SOFT, AI_FLAG_STATIONARY, 1);

// Activate a team to be stationary (AI system) - hard
SetLocalVarOnTeam(oCreature, TRIGGER_ACTIVATE_TEAM_STATIONARY_HARD, AI_FLAG_STATIONARY, 2);

break;
}

////////////////////////////////////////////////////////////////////////
// Sent by engine when creature exits the trigger
////////////////////////////////////////////////////////////////////////
case EVENT_TYPE_EXIT:
{
object oCreature = GetEventCreator(ev);

break;
}

}
}


The same problem happened if I used it in Plot scripts or placeable scripts. The WR_ version doesn't ever seem to work for me, but take away the WR_ and everything works fine.

One other difference - I was using FALSE and TRUE with the WR_ version ( I think that's what the help said to use), and changed it to 0 or 1 for the non WR_ version. Maybe WR_ doesn't work with TRUE and FALSE?

Modifié par PavelNovotny, 30 mars 2010 - 05:21 .