Is it possible to spawn characters in player's team with vector3 variables from a script component?
I've been trying iterating combatants in the current group and, for each combatant, getting a variable from a component, storing it into a variable and trying to pass it to a "Spawn Combatant node".
The main idea avoiding introducing spawners is to use this event in some other scenes, but i don't know if it possible not to use them.

Here's my failed try:

General view of the nodes:
image

The actual component that holds the position of a combatant:
image

And, node by node, that would be the order:

Select Combatant:
image

Select Selected Data:
image

Field To Variable:
image

Spawn Combatant:
image

I call this event in the start event, after adding combatants to the team in other event:
image

And i think it doesn't find the component of combatants, because, when starting the game, i obtain the "faied" dialogue.

But the actual component is in the combatant's prefab and i have tried accessing a combatant prefab's component before, so i dont't know where the fail is:
image

For sure I have made several mistakes, but, is it possible spawning combatants as npcs to talk to them in the map this way?
  • edited March 2022
    Since you already have custom scripting involved, you could simply add a function to the component to spawn the combatant at the position - this can be done like this:
    combatant.Object.Spawn(position, false, 0, false, Vector3.zero);

    Use a Call Function node to call the function and the combatant spawns there.

    Edit: The Field To Variable node stores the value of a field, but you entered the name of a function instead. The field's name is spawnPosition in your component :)
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.