I think thats the right term, I want to create an encounter that will randomly generate hostiles to attack the PC and party or even random npc.
The best example would be during the Quest 3: Sweeping the Docks Clean
Having random groups of thugs popup and attack is more fun. As long as the quest is not complete, groups of thugs continue to appear to harass the player party.
like any scripting, it depends on the details of what you want,
here’s an idea though
Areas have heartbeat scripts. Journals have a state (or range of state). In any area that the party should encounter the threat, if the journal-state is TRUE, and a fitting chance is rolled by the RNG, create the creatures at a fitting distance from the party (or perhaps at any of several pre-placed waypoints).
basically, this is done in SoZ on the overland map (for plot-encounters and special-encounters). The OL-area HB-scripts check journal state if a plot-enc should be spawned, or they simply roll the RNG to see if a special-enc should spawn.
Â
it is non-trivial, it is a challenge, you’ll get intimate with scripts … but the events that trigger a spawn don’t have to be OnHeartbeat – an area’s OnClientEnter could be the trigger eg. And the condition doesn’t have to be journal-state, it could be party-possession of a particular item, etc etc
Â
ps. what I said above isn’t about what the toolset calls “encounters”. Those aren’t as flexible as CreateObject() – though you might not want/need that flexibility … etc
void main()
{
object oEnc = GetObjectByTag("tag_of_encountertrigger");
int iJournal = GetJournalEntry("tag_of_quest", GetFirstPC());
if (iJournal == 25) // enc will be active iff quest-state is @ 25
{
SetEncounterActive(TRUE, oEnc);
}
else
SetEncounterActive(FALSE, oEnc);
}
something like that can fire from the OnHeartbeat event of an area. First get your encounter-trigger to fire infinitely. Then compile that script and assign it to the area’s HB event-slot. Use the correct tag/state of your quest, and the correct tag of the enc-trigger. All things being equal … the script will check every 6 seconds for the PC’s current quest-state, and if it matches what you’ve set in the script, should toggle itself on/off
(note that a range of values can be checked against if need be)
Hmm, ironic, recently I’ve kept experiencing a bug(?) while playing where enemies keep respawning every time I re-enter an area or reload. Eg: the Sokol Keep undead in Pool of Radiance module, enemies in Fort Tremagne module. I don’t know if it’s an intentional effect or not.