YesNoOk
avatar

Limiting a varset to a specific state? (Read 7572 times)

Started by ade2004, December 07, 2021, 01:20:23 pm
Share this topic:
Limiting a varset to a specific state?
#1  December 07, 2021, 01:20:23 pm
  • avatar
  • ***
Hello guys. I was wondering if its possible for a variable to be created only in a specific state.(not in common1 but.a different state file)

I have a varset in common1.cns and I want the variable to be created only in a specific state, is that possible?

State 0 VarSet
Triggerall = stateno = XXXX
V = XX
value = X

I tried the above but it doesn't work.
Re: Limiting a varset to a specific state?
#2  December 07, 2021, 09:43:28 pm
  • ****
    • crepa.neocities.org
In common1 it's not recommended, unless you're working in a full game.
You can add a VarSet in the state itself, or in statedef -3.
Something like this:

[State 1000, VarSet]
type = VarSet
trigger1 = !Time
var(10) = 1

or

[State -3, VarSet]
type = VarSet
trigger1 = StateNo = 1000
trigger1 = !Time
var(10) = 1
Re: Limiting a varset to a specific state?
#3  December 08, 2021, 02:31:41 am
  • avatar
  • ***
Thanks for the reply. Yeah It's for a full game. I would prefer it to be in common1.

The latter code did not work...
Re: Limiting a varset to a specific state?
#4  December 08, 2021, 03:46:49 am
  • ****
    • crepa.neocities.org
Oh wait, I got it wrong the first time I read your post. So you want a var to be modified only at a specific state?

In Statedef -2:

[State -2, VarSet]
type = VarSet
trigger1 = var(10) != 0
trigger1 = StateNo != 1000
var(10) = 0

This will set the var to 0 instantly whenever the character is not in the desired state. Change it to your needs.
Re: Limiting a varset to a specific state?
#5  December 08, 2021, 06:03:23 pm
  • avatar
  • ***