Aller au contenu

Photo

Create encounter or make it active through a convo


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

#1
andysks

andysks
  • Members
  • 1 651 messages
Hi all, I have this area, where the PC passes through, reaches the end, and on his way out I want him to trigger an encounter. How do I make it so that the encounter won't fire on his way in, but only on his way out after he did what he did on the end of the area?
Can you create an encounter from a convo, or from another trigger OnEnter event? Or make an inactive active like that?

Thanks!

Modifié par andysks, 31 octobre 2013 - 05:47 .


#2
Tchos

Tchos
  • Members
  • 5 063 messages
I haven't used one, but you should be able to just set the encounter property Active to "false", and later use SetEncounterActive() to make it active.

#3
andysks

andysks
  • Members
  • 1 651 messages
Ah there is such a thing?

#4
Tchos

Tchos
  • Members
  • 5 063 messages
The encounter's "Active" property is on the trigger. For SetEncounterActive(), you'll need to write a script that uses that command.

#5
andysks

andysks
  • Members
  • 1 651 messages
Done it. Thanks for the info. One time I should sit and read/search all the functions :).

#6
kamal_

kamal_
  • Members
  • 5 254 messages
If you want to drive yourself crazy, you can use vectors and vector math to detect which direction an object is entering a trigger from. Not recommended unless you understand vector math and are comfortable writing scripts.

tchos method is vastly simpler.

#7
andysks

andysks
  • Members
  • 1 651 messages
I have a basic understanding of vector math, but writing scripts is not my thing :D. Tchos' thing worked though. I wish though the encounters were a bit simpler in this game. I mean with all these spawn once and auto reset and so on.

#8
PJ156

PJ156
  • Members
  • 2 985 messages
I don't know about firing an encounter of a convo but you can spawn critters which is much the same thing, and it allows a thinking player to prepare/scout.

PJ

#9
andysks

andysks
  • Members
  • 1 651 messages
I actually meant, make it active through a convo, so that on your way back you fire it. Just the work a generic trigger does with the onenter SetEncounterActive thing. In any case, since I still am unbelievably bad in writting scripts, Lilac's did it for me. It doesn't have encounter option, but trap. I just changed some object names and the function and it worked.

#10
Dann-J

Dann-J
  • Members
  • 3 161 messages
This is the sort of thing I did in my first module (Dragonglade), when I was starting to learn scripting. A particular conversation triggered an encounter trigger in another area, so when you returned there you found some wandering lizard men waiting for you.

Hiding the encounter trigger script in a conversation, and spawning things in another area entirely, prevents the player from noticing that tell-tale pause when you trigger an encounter trigger by walking though it. As soon as I see the game suddenly slow down like that, I know an encounter has just spawned somewhere nearby.

If you put encounter triggers you intend to only trigger via script in unwalkable areas, you don't even need to set them to inactive. I usually hide tiny encounter triggers inside of walkmesh clippers where nothing could possibly walk through them.

#11
andysks

andysks
  • Members
  • 1 651 messages
So, what your script did was triggering the encounter without anyone walking on it? This is a nice system, I don't need if statements of the client enter like that. For example if you are suppose to encounter someone only when X is done, you just make it with your system... I like it. This of course, if I actually understood correctly what you said :D.

#12
Dann-J

Dann-J
  • Members
  • 3 161 messages
Exactly. TriggerEncounter() allows you to trigger them remotely. It's more reliable than walking through a trigger. Glitches in the game engine can sometimes cause you to jump ahead and bypass triggers entirely - not good if they're meant to spawn something plot-specific that could break the game if they don't show up.

I use that function extensively for wandering creatures that appear only at certain times of day. I spawn a random assortment of nocturnal creatures in a forest, for instance, and add them to a group so I can destroy them again in the morning (and replace them with the day-shift). Isle of Shrines used an older version of the day/night spawning scripts, spawning barracuda in the shallow waters during the day (which you can kill, cook and eat), and sea-zombies at night (who wanted to eat YOU).

Modifié par DannJ, 01 novembre 2013 - 03:07 .


#13
andysks

andysks
  • Members
  • 1 651 messages
So this is the jump the game does sometimes. And I was always like... wait... what? But kidding aside, I will try this system... I guess it's what is used in the OC as well, when Grobnar finds the Wenderkazoo and then orcs attack.

#14
ColorsFade

ColorsFade
  • Members
  • 1 270 messages
There are so many solutions to this problem, it is interesting to see how others solve this. 

When it comes to spawning encounters, I try and use something other than floor trigger, for reasons DannJ mentioned (reliability, mainly). I have got to the point where every Area contains a customized OnClientEnter script for that area, and spawns almost all creatures. 

For anything that needs to spawn after the initial zone-in, I use other custom scripts, and the trigger is either a conversation node, a door opening, or the death of a specific creature (I seem to spawn a lot of stuff on the death of one thing or another...). 

Now, triggering conversations themselves.... I have places where I want the player to engage in a conversation no matter what, and I haven't found a better tool than a floor speak trigger. What I do, however, is I write a custom script for the OnEnter part of the trigger. This script then checks several conditions before it makes a call to DoSpeakTrigger().Typically this is some kind of journal check, to ensure the story is in the proper place for the conversation to begin. If any of those conditions fails, the script exits, and the trigger doesn't run the conversation. 

With your encounter, andysks, you could do the same thing. You could have the encounter check a journal entry or whatever, and if things are correct, spawn the encounter. But as DannJ recommends, something triggering the encounter other than a floor trigger would be better. 

Modifié par ColorsFade, 01 novembre 2013 - 05:02 .


#15
bealzebub

bealzebub
  • Members
  • 352 messages
I had the same problem a few years back and Knightmare made this for me.

// ga_trigger_encounter
// By Knightmare - Nov. 13, 2009
// Enter the Tag of the encounter trigger for sEncounterTag
void main(string sEncounterTag)
{
object oPC = GetPCSpeaker();
object oEncounter = GetNearestObjectByTag(sEncounterTag, oPC, 1);
SetEncounterActive(TRUE, oEncounter);
TriggerEncounter(oEncounter, oPC, ENCOUNTER_CALC_FROM_FACTION, -1.0);
}


put the encounter in an unwalkable spot and use this script in a conversation. It works like a charm.

#16
andysks

andysks
  • Members
  • 1 651 messages
Small scripts, my kinds of scripts :D. Thanks Bealzebub!