Check condition and fire encounter only if true - Is this possible?
#1
Posté 31 mai 2013 - 09:42
#2
Posté 01 juin 2013 - 12:37
<code>
void main() {
object oPC = GetEnteringObject();
if (GetRacialType(oPC) == RACIAL_TYPE_DWARF)
SetEncounterActive(TRUE);
}
</code>
But the trickier bit will be checking the faction. You probably will want the script to get a member of the territory's faction (maybe one with a nice unique tag so it's easy) to do the hostility check. I don't believe you can get the faction of the encounter as such.
GetObjectByTag and then GetIsEnemy would probably do it.
#3
Posté 01 juin 2013 - 01:27
#4
Posté 01 juin 2013 - 02:07
#5
Posté 01 juin 2013 - 12:05
RemarksFrom Victor Morales:
I have tried the SetEncounterActive function to spawn creatures at different times of the day. For example, I only wanted the undead in a cemetery to spawn if it was nighttime.
If the encounter active flag is set to FALSE to begin with (in the encounter GUI window when the encounter is created) then the SetEncounterActive function will spawn them properly the first time. It seems that the creatures are set to spawn before the OnEnter event is checked for validity. In addition, once the active flag is set it won't revert until the next time the encounter is triggered.
So I would have undead that would spawn at night properly, but once they spawned - if the time changed to day they would spawn at least one more time during daylight hours. Then the trigger would work properly again.
I tried to make it reset the active flag to active OnEnter, then the creatures would spawn, and to reset it to inactive OnExit. However, that didn't work either and the behavior stayed the same.
You can draw a trigger around the encounter and call this function from OnEnter of that trigger instead as a workaround.
So it may work properly (or appear to), but will likely glitch for second and successive PCs entering it.
#6
Posté 01 juin 2013 - 12:49
Your statement was that it would only be active for the next use, which is not the case... but your suggestion is the right workaround for multi-shot triggers.
I knew I had read something about that but didn't find it last night.
#7
Posté 01 juin 2013 - 08:51
#8
Posté 02 juin 2013 - 03:08
If if spawns for to large of a range that way. Make a custom faction for the encounters and then adjust its reaction to the PC as needed.
#9
Posté 02 juin 2013 - 09:37
#10
Posté 03 juin 2013 - 01:08
#11
Posté 03 juin 2013 - 06:46
#12
Posté 03 juin 2013 - 07:33
From : Maxam - Introduction To Encounters
Faction
Like creatures, encounters have a faction. It is important to note that the faction of the encounter in no way determines or changes the faction of the creatures spawned. It only controls whether or not the encounter will spawn when a PC or other creature walks over it.
In order for the encounter to trigger properly the player must be hostile to the faction of the trigger - the creatures spawned could be hostile, neutral or even friendly. For this reason most triggers will be set to the 'Hostile' faction.
Its worth noting that encounters set to the standard npc factions, (commoner, merchant and defender,) don't seem to trigger for npc's that are hostile to these factions, they only trigger for PC's and members of their party. However using a custom faction on the encounter, set up with similar likes and dislikes, should work as expected.
So for example you could set a number of encounters, with a faction of 'Commoner', around a village. When triggered, these encounters would spawn groups of guards to deal with the attackers. These encounters will not be triggered when players wander around the village unless the players have been attacking villagers, thus becoming hostile to the villagers ('Commoner') faction.
#13
Posté 04 juin 2013 - 05:59
#14
Posté 06 juin 2013 - 11:50
#15
Posté 07 juin 2013 - 12:43
#16
Posté 07 juin 2013 - 01:17
And yes, you could add something like this to his OnPhysicalAttacked:
object oEncounter = GetNearestObjectByTag("encounter_tag_here");
SetEncounterActive(TRUE, oEncounter);
Modifié par Squatting Monk, 07 juin 2013 - 01:41 .
#17
Posté 07 juin 2013 - 05:22
#18
Posté 07 juin 2013 - 09:45





Retour en haut







