Forum rules - please read before posting.

Randomised forest scene & PlayerStart logic based on inventory item

Hi Chris / AC wizards,
I’m building a “lost in the woods” gameplay sequence using multiple forest scenes. Here’s the desired behavior:

****Goal Recap:****
If the player does not have a specific inventory item:

  • Exiting one forest scene will send them to a random forest scene (could be the same one).
  • In that new scene, the player should spawn at a random PlayerStart, but not the same one they used last time.
  • If the player does have the item, they follow a specific sequence of forest exits and spawns, using the normal PlayerStart system (based on previous scene etc.).

I’m currently thinking of managing this with:

  • A Global Integer for LastPlayerStartID
  • A Local Integer for NextPlayerStartID
  • Some custom scripting on scene load to handle the randomisation logic

Before I go too far down this path, I wanted to check — is this the best approach? Or is there a more “AC-friendly” way to manage this kind of logic?

Thanks!

Comments

  • edited April 3

    Use Markers, not PlayerStarts - you'll need to manually teleport the Player to them rather than have AC place them there automatically.

    No need for scripting, and you only need one variable - which keeps track of the last exit used. This can just be an Integer that keeps track of the index, not ID - i.e. 0 = Left, 1 = Right, 2 = Down.

    When entering a scene, you can then use the Variable: Check random number to make a random value check. Set # of possible values to the number of exits, and check Prevent same value twice? and Save last value?. You can then link the result to the Variable above, so that it will never return the same result two times in a row.

    Depending on the result, you can then teleport the Player to the correct Marker.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.