Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video tuto ? #172

Open
kevld opened this issue Dec 22, 2021 · 3 comments
Open

Video tuto ? #172

kevld opened this issue Dec 22, 2021 · 3 comments
Assignees
Labels

Comments

@kevld
Copy link

kevld commented Dec 22, 2021

Hello @npruehs ,
Your plugin is very interesting and usefull, I discover it few days ago and I am testing it.
Is there an existing video which explains how to use the plugin ?
I think there is something I don't understand with AI units and AI players. My units are moving but I'm unable to make them attack other units (I double check gameplay tags but maybe I miss something)

@npruehs
Copy link
Owner

npruehs commented Dec 23, 2021

Hey @kevld !

Unfortunately, a video tutorial is on my todo list, but I didn't find the time to create some yet.

Do your units belong to different players, and are these players in different teams?

@npruehs npruehs self-assigned this Dec 23, 2021
@kevld
Copy link
Author

kevld commented Dec 26, 2021

Hi @npruehs, thanks for answering me :)

Here is what I did
I created 2 player start points (inherited from RTSPlayerStart). One for p1, the second for AI (p1 in team 0, AI in team 1)
image

After that in the level blueprint, i did this :
When I hit "H" key (for debug purpose of course), a unit spawns and i transfer ownership to the first player. This part works
image
I tried to do the same for the AI when I hit "J" but it's not working :
image
I tried several things, including this (also tried with other player indexes):
image
With same result
I think it is in this part that there is something I miss (probably even UE4 basics...)

When I Test it, I am able to move my unit, and not able to move enemy unit. this is OK. But my unit is not attacking, The issue order passed is always a move order, even if I right click on the enemy unit
Here is a demo :
https://youtu.be/Xmav8TjJbqk
The first unit to spawn is "my" unit
The second one is the AI's unit

Here is my character's components (the character inherits from the UE4's Character class) :
image
Gameplay tags on RTSGameplayTags component :
image
Gameplay tags on RTSHealth component :
image
Gameplay tags on the RTSAttack component :
image

I tried to add the Relationship.Hostile tag but it did not help

The main problem is located between the keyboard and the chair... I'm pretty sure I miss something basic

@npruehs
Copy link
Owner

npruehs commented Mar 6, 2022

Get Player Controller with player index 0 works for you, and returns a valid player controller, because it's a built-in helper function that just takes an index returns a player controller - as expected.

Get AI Controller takes an actor as argument, and is supposed to be passed a pawn controlled by an AI controller. This has originally been built by the engine team for getting the AI controller of a bot in Unreal Tournament. Thus, your attempt in passing a player start and getting its AI controller failed.

The same is true for accessing the player controller with index 1 and passing it to Get AI Controller: Player controllers and AI controllers are mutually exclusive - in fact, they both extend the same base class: Controller. Thus, in fact, even if any of your attempts to get an AIController had been successful, casting the result to your player controller blueprint is deemed to fail.

I recommend reading up on the engine basics, more specifically, its game framework: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Framework/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants