what about the path nodes name to put in StartNodeVar and EndNodeVar, how do you put those nodes into a variable
You are welcome pal. :-)
To be clear. You don't put the nodes as is in the variables, you put the names of the nodes either by doing a 'ccbSetCopperCubeVariable(varname, value)' or by using the action 'Set or change a variable'.
So if you wanna move a character to a node named "chair", you either do a ccbSetCopperCubeVariable("end_node", "chair") or a 'Set or change a variable' -> VariableName = 'end_node' , operation = 'Set (=)' , ValueType = 'Value' , Value = 'chair'
Thanks, though I can't take the credit. I made it with ChatGPT.
:-/
And honestly, why don't I create an enemy action or behavior from there? Well, for one thing, it didn't occur to me, haha. For another, there are many types of enemies that work differently: soldiers who take cover, zombies, blind monsters that react to sound, paranormal entities, a math teacher, etc.
Need help making a specific enemy? I can’t promise anything, and I’m busy with an asset pack, but I can try to give you a hand.
:-)
The problem is that there are many types of enemy soldier AI, and depending on the game’s structure and setting, they’ll function in one way or another. A soldier from *DOOM* (1993) or the first *Medal of Honor* isn’t the same as a soldier from *Call of Duty* or *Arma 3*. Even within the same game, you can have soldiers that behave differently. For example: in the first *Half-Life*, you have the marines and the Black Ops.
As I said, I’m not promising anything, but if you’re working on a game, I can try to help you create a soldier-type enemy. I’ll need at least an idea of how you expect them to function. Think of them more like a state machine or something like that, where depending on certain conditions being met, internal functions are activated or not. In other words, something like, “If I don’t see the enemy, then I patrol,” and things like that. Do you have something designed or more or less in mind?
technically, when the enemy soldiers see the player they move to a random waypoint in that area and start firing at player, when the player runs, they chase after him, i want to play hit animations when they are hit 2, preferably 2 random hit anims, but they shouldnt always play hit anims when hit, it should be probability, when they are hit, they don't attack, but after playing hit animation, they continue attacking, if you need other info you can ask please ? :)
Well, the good news is that what you want isn't rocket science. Now, that doesn't make it easy.
Warning: Wall of nerdy text below. XD
Let's see, you're going to need a few extra things. To start, you need the NPC to be able to see the player. I don't know if you have anything set up for that.
If you don't have a vision system, a fairly simple way to do it is by combining a billboard with the 'near something' behavior (or whatever it's called; I have Coppercube in Spanish) that reacts to the player entering. Make that billboard a child of the NPC's mesh. When the player enters the billboard's area, send a raycast from the NPC to the player.
Why like this? The billboard's area is to detect if the player is within the NPC's field of view, and the raycast is to ensure that the player isn't behind an object like a wall.
From here: if the player is visible (within the billboard area and within raycast range), you'd need to choose a waypoint to send the NPC to. I wouldn't recommend a random waypoint because: A) the NPC could move to the other side of the map, or B) the NPC could choose the waypoint where the player is. If possible, I recommend using waypoints with names like 'cover1', 'cover2', and so on,
placed in corners or behind objects like low walls or boxes. This way, you can loop through these 'cover' waypoints and calculate the distance to find the closest one to the NPC and send them there using 'NPC pathfinding'.
Then, when the player moves out of view (beyond the billboard box mentioned earlier), you can calculate the distance between the player and all the waypoints to find the closest one. Once you have it, send any enemies currently fighting to that waypoint. If they see the player again, everything will repeat; otherwise, they'll wait for the player to appear. If you want them to keep chasing the player, you'll need to loop the distance calculation between waypoints and the player.
For the hit animations, Coppercube uses the 'AI actor' component by default, which I use in the 'NPC Pathfinding' to make Greta move from one point to another in the game. This same behavior has slots with names like 'ActionActivate' and 'ActionWhenHit'. What I suggest you try is having two behaviors for the NPC. The 'AI Game Actor' and a 'Do every x time' statement: In the first, we'll detect, for example, if the player has shot the NPC and change the value of a variable, IDK let's call it: 'NPC_state', to, say, 2. Then, in the 'Do every x time' statement, we'll check if 'NPC_state' is 2, and if so, generate a random number, for example, from 1 to 3. If it's 1, we'll play the 'Wounded' animation.
The system could be something like this: Each soldier NPC would have its own 'NPC_state' defining its current state. 0 could be 'idle' or 'waiting', 1 'attacking' (when it has spotted the player), 2 'taking damage', and 3 'dead'. In the 'AI Game Actor' statement or the the billboard, you change the NPC's state.
And with the 'Do every x time' statement, you compare the states and activate their corresponding consequences within the game.
There are forums on the Coppercube website where you could get extra help; I don't know if you've checked them out, by the way. Do you know how to program? You don't need to be an expert. I just need to know how I can best help you.