Aller au contenu

Photo

Solved: How do I change area variables? (was What's the best way to track the number of times PC enters an area?)


3 réponses à ce sujet

#1
PavelNovotny

PavelNovotny
  • Members
  • 344 messages
Should I use EVENT_TYPE_AREALOAD_PRELOADEXIT and increment a variable every time they go in? Or is there a better way?

Thanks!

Modifié par PavelNovotny, 02 avril 2010 - 02:01 .


#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
That seems like the easiest way to me. If you don't need access to the information in other areas, then I'd store it in a local variable on the area, like AREA_COUNTER_1. If you do need that information in other areas it's a bit tricker. If there's a maximum number you care about, a series of plot flags would work.

#3
PavelNovotny

PavelNovotny
  • Members
  • 344 messages
Am I allowed to use SetLocalInt with an area? The format says SetLocalInt (oObject, etc.). Do I refer to the area as an object?

If not how do I change the value of the area variable AREA_COUNTER_1?

Modifié par PavelNovotny, 02 avril 2010 - 12:35 .


#4
PavelNovotny

PavelNovotny
  • Members
  • 344 messages
OK - I tried this within the area script and it compiled, so hopefully it is using OBJECT_SELF as the area. I'll try it out in game and see if it works.

//Add 1 to the counter tracking how many times the PC has entered the area
int nCount = GetLocalInt(OBJECT_SELF, AREA_COUNTER_1);

nCount = nCount + 1;
SetLocalInt(OBJECT_SELF, AREA_COUNTER_1, nCount);


Edit: Yup, looks like it does recognize OBJECT_SELF as the area.

Modifié par PavelNovotny, 02 avril 2010 - 02:01 .