How to trigger a rule only once?
stefdelec
Member, PRO Posts: 146
Hi,
I am making a gameword, and I want the letter to spawn according to the letter around. One letter per actor. So I made several rules. But letter are keeping changing after the first time they spawn/appear. How can I be sure that when a letter spawn and a letter is assigned to an actor, it doesn't change afterward.
I think there is something I have not understood with rule and change behavior.
For example:
If x= 0 => change attribute to true,
otherwise change attribute to false.
Let say during the game for a reason, x is changing to another number than 0, it will trigger "otherwise". Am I right?
Basically, I want the rule to be triggered only once, when it appears. And that all. Should I put a boolean "rule triggered"?
Comments
Yes just create a self attribute and use it as a lockout.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Tks.
I have done it, and I don't understand at all but it keeps not working.
I have included a boolean.
If letter assigned false=> trigger rule.
[
Inside the rule, I said if parameter 1 =>assign a letter And change attribute boolean letter assigned/
otherwise 'rule if parameter 2'=> assign a letter And change attribute boolean letter assigned/
otherwise assign a letter And change attribute boolean letter assigned.
]
(assign a letter in 3 different manners).
So it shouldn't be changing again or do I have a logic error.
I'm confused what rule do you only want to fire once. The main rule or the rule in the otherwise section?
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Any of these which assign a letter.
When letter is assigned, don't change it! :-)
The 3 parameters:
According to these 3 parameters, it assign a letter to the actor, and it doesn't change even if "voyels" consomne"...etc changes.
That doesn't help me as I don't know your code or overall game logic. Post a screen shot of the code your talking about.
Here is how I would do it. Create a self attribute in the actor or actors call it lockout.
Rule
If all
Condition you have that fires the rule. Self.lockout is false
Behaviors that are in the rule.
Change attribute self.false to true
Otherwise
Rule
If all
Self.lockout is false
All the code you have in otherwise inside this rule.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I m not sure it gonna help.... :-)
I am sending a new screenshot as this one is not good.
Yes, it is what I have done, (I think) but it is keeping changing.
I would abandon the idea of using otherwise and do it all as straight conditional logic.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Ok. I ll do.
Using otherwise can be tricky. Your logic will be easier to control without the otherwise kicking in.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS