Aller au contenu

Photo

Anyone figured out random encounters?


  • Veuillez vous connecter pour répondre
1 réponse à ce sujet

#1
sea-

sea-
  • Members
  • 264 messages
I know it's probably a long shot, but I'm trying to get random map encounters to work for a custom module with a custom map.  I looked at BioWare's own event handling code, and it's pretty complex, unnecessarily so for what I want to do (i.e. intercept the player when traveling if necessary, and take him/her to a location, then when the encounter is complete, resume traveling).

So far, I've learned that messing around with the 2DA files doesn't really help - even if the game refers to them (complete with custom terrain types etc.) it doesn't seem to know when to trigger encounters on its own.  Examining BioWare's code in a bit more detail, I actually can't find the section of it that seems to trigger the encounter itself - I can check for one okay (using WM_CheckRandomEncounter) but how to actually stop the existing travel, go to the new destination and resume, I'm not sure.

I'm not a scripting expert by any means so I'd appreciate if anyone has anything to help point me in the right direction.

Modifié par sea-, 19 juin 2012 - 05:50 .


#2
sea-

sea-
  • Members
  • 264 messages
Quick update to anyone following along,

I managed to get it working by intercepting the map travel event manually and substituting my own destination using the WorldMapStartTravelling() function - for example, WorldMapStartTravelling("random_area", "start_waypoint"). To make the player resume travel properly, you can use the WorldMapCompleteRandomEncounter() function. If you save the player's previous destination, it will automatically continue on without any fuss.

I set up plot flags to check whether or not the player should go to a random encounter (defined flags work fine, and are good because you can try multiple conditions with them, including whether the encounter is complete or not). I also used a plot flag to check if the player is on a random encounter - set to false and the player travels between areas normally, set to true and it instead triggers WorldMapCompleteRandomEncounter() to leave the random encounter location. You can reset it any time after the player is back in a "regular" location, maybe with an area script or something else.

I'm not 100% sure but it seems like using M2DAs for terrain types etc. are bugged. You can pretty easily set up your own random encounter system simply by using plot flags, but doing it using BioWare's own system seems out of the question because I couldn't get it to reliably take my M2DA info, and also couldn't figure out how to actually trigger a random encounter from the M2DAs. However, if you simply want a few preset plot encounters on the map, my approach works totally fine.

Modifié par sea-, 19 juin 2012 - 08:48 .