Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:
Ambiera Forum > CopperCube > Announcements and Showcase
From Patrol to Attack - CCB Template
Author Text

Registered User
2018-12-02 15:14:13

While I was working on my project I realized that I needed a simple behavior with patrol & attack action. Guards are patrolling and then, if player does something wrong, they start attacking.

As @tim12345 suggested I've made a new version that uses Behavior & Action file:

For this behavior to work you need:
1. Path with transparent object moving down that path (in a loop).
2. Enemy object with 'Game Actor with Health', 'On Proximity Do Something', this behavior (Enemy Patrol And Attack - Behavior) and accompanying action (Enemy Patrol And Attack - Action). Action should be placed in 'On Proximity Do Something'.

What does this behavior do:
1. Soldier will be patrolling (following the object that’s moving down the path) until player is within the proximity of Soldier 'On Proximity' behavior.
2. Once player reaches the required distance to the soldier (in this example soldier 'On Proximity' distance is more or less similar to the blue floor-box) soldier will start shooting at player (start acting according to your settings in 'Game Actor with Health' behavior).

This behavior and action are working with multiple enemies, you can even use Clone option. Only thing is that you should change 'Path/Object they follow if you want them to have different patrol-routes. Activation Radius of 'Game Actor with Health' is still relevant so it should be similar to 'On Proximity' Distance.

Also with this behavior enemy can actually follow anything: another soldier, any object that moves, maybe even player...

I’m no coder so if anyone feels he can upgrade/change this to a more functional behavior/action I would be very grateful if he would post his modifications here :)

I will work further on this since I don't really like native 'Game Actor with Health' behavior, the CC default attack movements are very strange. They make enemy seem uninterested in shooting or, with my modifications in this ccb, shoot like a mad-lad :)

2018-12-02 16:53:42

interesting, i would recommend creating your a.i. as an all-in-one behavior script file. they are easier to edit and manage, in my experience. and you can do tons more specific things using mathematics.

Registered User
2018-12-02 17:24:00

Cheers, I was just thinking about that. It would be easier and I could have everything in one place. I'm gonna try to work this out as a Behavior. Hopefully it won't be a complete fail, I'm not good at coding things :)

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Internation?l" (you are not logged in)




Forum Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]