Jump to content

Recommended Posts

Posted

Greetings!

 

I'm making a mission where the player is able to get random selected tasks via the radio menu.

 

When the player hits "Request tasking" I've set it to select flag random between 1-6 (or however many tasks there will be in the end). When flag 1 is selected by the random flag, task 1 begins, and so on.

 

As the player completes tasks, he/she is able to ask for a new task randomly selected. However, the chance of the same number/task beeing selected is quite big (and the tasks only activate once) I've found my self with a bit of a problem.

 

Now, what I would want is for a flag that has been selected to not be eligable the next time around. How would I do that? I feel like my brain has shut down.

 

Any help would be much appreciated!

Posted

Hmmm...

 

if flag 1 is true, start tasking and flag on 11 to signify tasking has started; when tasking is complete flag on 111..

 

if flag 1 is selected again, set ME to check if flag 11 is already true?

 

Then a condition for if flag 1 true AND flag 11 AND flag 111 is true, random selection again.

 

Basically repeat this for each of your tasks and I think it should keep checking until it finds one that hasn't been triggered yet?

 

Obviously the language isn't quite right there but that sounds like it should work in my head :lol:

Posted (edited)

I had this same problem recently with randomly spawning a random selection from a random number of units. My solution was more complicated due to the nature of my problem. Here is a simplified version if you only need to select one from a list at a time, but have it be repeatable later:

 

The example uses two items, but can be expanded or adjusted to any number of items. I liken it to rolling a die for a number and re-rolling if that number has come up before.

 

Definitions

Flag 1 := Condition to start the roll

Flag 2 := Rolling

Flag 3 := Choice

Flag 101 := Selection 1 Chosen

Flag 102 := Selection 2 Chosen

 

Triggers

Trigger 1 [Roll/Re-roll]

Switched Condition

IF:

Flag is True(1) //Set by an outside influence: Group Dead, Radio Menu, et al.

Flag is False (2) // Should only be true while a selection is occurring, will be false whenever a roll should happen

THEN:

Set Flag Random Value (3, from 1 to 2) //Adjust according to the amount of choices

Flag On (2) //Marker to indicate when a re-roll should occur

Trigger 2 [spawn First Group] //One trigger of this type per possible choice

Once

IF:

Flag Equals (3,1)

Flag is True (2)

Flag is False (101)

Then:

Spawn Group (Group 1) //Change to whatever action is wanted to be completed.

Flag On (101)

Flag Off (1) //Will be Reset next time you need to do the selection. Set False after successful selection to not roll again.

Flag Off (2) //Set Off so roll can happen next time

Trigger 3 [spawn Second Group]

Once

IF:

Flag Equals (3,2)

Flag is True (2)

Flag is False (102)

Then:

Spawn Group (Group 2)

Flag On (102)

Flag Off (1)

Flag Off (2)

Trigger 4 [Re-roll for First Group] //One Trigger of this type per possible choice

Switched Condition

IF:

Flag Equals (3,1)

Flag is True (2)

Flag is True (101)

Then:

Flag Off (2) //Initiate a Reroll

Trigger 5 [Reroll for Second Group]

Switched Condition

IF:

Flag Equals (3,2)

Flag is True (2)

Flag is True (102)

Then:

Flag Off (2)

 

Edit: For the "until all selected" part of your query, you'd want to add a counter or a prerequisite flag before everything above that will only start a roll if one or more of the selections is available. Otherwise, you can induce an infinite loop where it keeps rolling to find a choice that doesn't exist. Something like the following:

 

Definitions

Flag X := the condition that prevents the sequence of rolls and rerolls. X used instead of a number for notation.

 

Triggers

Trigger 1 [All Selections Chosen]

Once

IF:

Flag is True (101) //One flag check for each of the selected choices

Flag is True (102)

Then:

Flag on (X) //Flag is false unless there are no choices left, then it's true.

 

You would then add "Flag is False(X)" as a condition to "Trigger 1 [Roll/Reroll]" from the original set. Then it would only ever make a choice when it could possibly make a choice without getting stuck.

Edited by P5138
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...