Best methodology for selecting between different persistent states

SinequanonSinequanon Member Posts: 35
edited November -1 in Working with GS (Mac)
Sorry for the abstract title, but I think you'll know what I mean when I explain:

Say I have an actor, and that actor can carry one of several guns. I have a game attribute that the actor and the gun are both watching to determine which gun he's carrying.

So say I have a shotgun (0) and a machine gun (1), and my game attribute is an index called weapon.

both my shotgun and machine gun actor are watching game.weapon, with a rule that says:

When game.weapon != 0, Destroy

and separately

When game.weapon != 1, Destroy

Likewise, my character actor is looking for:

When game.weapon = 0, spawn actor: shotgun,
otherwise when game.weapon = 1, spawn actor: machine gun

My question is what is the best general method that you all use to make sure code like this runs smoothly? I'm sure you've encountered a lot of problems with any sort of system like this: spawning multiple of a gun, actors missing the trigger to change states, and so on. Is there a good tutorial or general method for handling this, especially for much larger systems (actors using up to 10 different states, for instance)?
Sign In or Register to comment.