Download

Replacing Uscript States with c++?

I think that states were truly an awsome feature for gameplay coding in unrealscript.

Is there any way to create some kind of structure in c++ replacing the states of unrealscript ? What would i use ?

You can have a look at UT source code. If I remember correctly, they have C++ states for their weapon.

You can also have a look here : State · Design Patterns Revisited · Game Programming Patterns

They’re just Enums. You can use them for anything.

Thanks for all the information, i don’t want to write a chaotic boolean machine try code, Going for the enums for that.

There exist a design pattern that you can implement for this (and even blueprint it)

Basically You can create State class derived from a UObject, AActor or even make it a structure. Then create subclasses of the state class when you need them. Granted if your Pawn has 3 movement states then you’ll have to create 3 different C++ classes… or if you JUST implement the state in Blueprints then suddenly you are working similar to how UE3 states worked anyway.