"Duplicating" (copying) logic to another state ? (without re-writing it )

Hello,

I have a somewhat complex logic for an AI warrior, and his other state will be almost the same, with one module script changed only.

I would like to be able to “copy” his existing logic into another state and make the small change.
I can not find how this is done.

Currently I am re-writing his new state from scratch.

This is not critical, but I will be doing it many times in the future (about 12 warriors, 3-4 states each), so it would help to copy if possible.

Thanks in advance!
Dimitris

there is a small number on the and controllers, change the number to affect the state those bricks are in.
to copy from 1 to other object, select object with no bricks hold shift select objects with the bricks, then head down to menu object head to game, select copy logic bricks.

That is nice, thanks,

but unfortunately it does not work. I want to copy logic in the same object, from state 1 to state 2. Not between different objects.

EDIT: = Sorry, my fault = It works, but it is not what I need.

I was working on a addon that does this ,but it doesn’t work in all cases. I haven’t figured out how to solve the issues. Kinda threw in the towel, since I’ve been playing around with other game engines.

Edit:

OK, I played around with it a little more for you. If you want to see the issues with it, hook up one sensor and one actuator to two controllers. It will make duplicates of the sensors and actuators. Here’s the addon improved_logic_state_to_states1.zip (6.32 KB)
if you wanna play around with it. It only works with BGE and not UPBGE, since there has been updates to the logic.

Settings:

To: This is the state that you want to copy the logic to.
From: This is the state that you want to copy the logic from.
Active / All: Copies all the logic in the state or just the “active” logic in the state.
Copy to State: Copies the logic to the “To” state.

I just adding the “Active / All” today. Before it would copy all logic within the state ,but this lets you “choose” which logic within the state that you want copy, by making the logic you don’t want inactive(unchecked).

Thanks a lot, I will definitely give it a try