Greetings,

I've been trying without any success to create a simple dialogue cinematic. The tutorial "Cinematic field scene introduction" makes total sense and I've had a lot of success doing variations of that type of cinematic. But when I comes to something involving a combatant, hostile or otherwise, I'm not doing well at all :) I think I need it explained to me in simple terms.

I need to do quite a few semi-complex cinematic scenes but thought I would start out really simple. All I'm trying to do at the moment is spawn an NPC, have him walk to a waypoint via a Change Position Step, Rotate to the player and pop up a simple dialogue.

My Event Settings step has 2 waypoints added, which are also in my scene. Same as the cinematic tutorial. I was trying to use the Start Combatant Spawner step to spawn my NPC. I have a GameObject with the Event Interaction component and a Combatant Spawner component on it as well. The Combatant Spawner is set to Start Type none. I was thinking the Start Combant Spawner step would start the spawner, spawn my NPC, then I could use the waypoints to have him Change Position to them and thus "talk" to my player. I hope that makes sense :) Also, I tried adding a Search Objects step to try and get a hold of the combatant and have him Change Position but no luck there either.

Also, no matter the Start Type of the Combatant Spawner, I get the following error:

NullReferenceException: Object reference not set to an instance of an object
ORKFramework.Behaviours.CombatantSpawner+d__a.MoveNext ()
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
ORKFramework.Behaviours.CombatantSpawner:StartEvent(GameObject)
ORKFramework.Behaviours.CombatantSpawner:StartFromEvent()
ORKFramework.Events.Steps.StartCombatantSpawnerStep:Execute(BaseEvent)
ORKFramework.Events.GameEvent:ExecuteNextStep()
ORKFramework.Events.BaseEvent:StartEvent()
ORKFramework.Events.GameEvent:StartEvent(IEventStarter, GameObject)
ORKFramework.Behaviours.d__2:MoveNext()
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)

So I know I have something messed up :)

So when the Help for the Start Combatant Spawner says "The selected object must have a correctly set up 'Combatant Spawner' component attached", what does that entail?

Anyway, I really need to work this out :) I need to be able to have dialogues, start battles and other cinematics and am getting nowhere fast.

One last question, I'm doing this in a Game Event. Is that a problem?

Thanks! :D

  • Using a combatant spawner for this might not be the best solution. I'd suggest setting up a game object (either in the scene or as a prefab that's spawned by the event) with your enemy's prefab and an Add Combatant component to add the combatant to it.

    If the game object is already present or spawned by the event, it's easier to use it in the event and make it move somewhere. Having the combatant added to the object would take care of the animations when moving (in case you're using the auto move animations).
    Also, if the combatant is using auto start battle settings, it might be best to first have him in a faction friendly with the player, otherwise it might trigger a battle that you don't want :)
    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!
  • edited October 2015
    Alright, I follow to a degree :)

    I think I can get that to work with some of my combatants. One thing I'm not sure how to work around is I'm using ORK to 'create' some of my other combatants.

    I have a generic prefab that has all the Equipment Viewers etc. on it and when I create the combatant in the ORK Editor, I set it's gear etc. with the starter gear settings. Then I use a spawner to spawn the combatant in the scene, be it an enemy, NPC, Shopkeeper and so on.

    So, technically, I don't have an enemy prefab to add to a game object in that respect. Can I use a combatant spawn step or something ( if there is such a thing :) ) to create the combatant entity itself in the event? I don't know if I'm asking that correctly?? :)

    EDIT: Also, for clarification, what's difference between a combatant added with an Add Combatant component and an actual monster that walks around the scene. I do get something moving around the scene (if I look in scene view during play mode), but it's not the actual combatant that I created in ORK.
    Post edited by Squeaker on
  • Well, you can also use the combatant spawner, but you'll need to find the spawned game object of the combatant to use it in the event. You can do this by either using the Re-Find Objects step if you've added the combatant as an actor (since he can only be found after being spawned) or a Search Objects step to store it in a found objects list.

    There's no difference for the combatant between Add Combatant and spawning it (e.g. Combatant Spawner). When using Add Combatant, the combatant will be added to the game object, while spawning will spawn the combatant's prefab and add it to it.
    I.e. if you have a game object in your scene that should be a combatant, use Add Combatant (component or event step), otherwise use the combatant spawner to spawn it's game object into the scene.
    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!
  • edited October 2015
    Great. Thank you for the suggestions and clarifications. I'll give those a shot :)

    Would I spawn the combatant spawner from a prefab in the event or just use an existing spawner in the scene and find the spawned combatant? Not sure which would be the best way to go.
    Post edited by Squeaker on
  • edited October 2015
    Just use an existing spawner (e.g. set to start type None) and use the Start Combatant Spawner step. You'll need to find the spawned combatant's game object anyway when using a combatant spawner, so no need to use an additional prefab here :)
    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!
  • edited October 2015
    Awesome! Thanks so much for the help on this. I'll give those suggestions a shot. I just have to get around it. that's all :)

    One more thing: Does the spawner need to part of the GameObject that has the Event Interaction component on it? I don't have ORK open at the moment but I think the Start Combatant Spawner has some help about have the spawner on the game object or maybe I'm mistaken. In any even, do I need to do anything special with the spawner for the event to find it?
    Post edited by Squeaker on
  • No, the combatant spawner can be any object in the scene, as long as you're able to use it as an actor in the event (e.g. through searching for it or by referencing it in the event interaction's inspector).
    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!
  • edited October 2015
    Okay, so I created a combatant spawner set the start type to None. I added an Actor in the Event Settings and set the Type to Object, enabled Use Scene Object. The spawner object in the scene is referenced in the Event's inspector.

    My second node in the event is a Start Combatant Spawner node: Object: Actor, Actor: Scene Object.


    But I'm getting this error when the scene loads:
    NullReferenceException: Object reference not set to an instance of an object
    ORKFramework.Behaviours.CombatantSpawner+d__a.MoveNext ()
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    ORKFramework.Behaviours.CombatantSpawner:StartEvent(GameObject)
    ORKFramework.Behaviours.CombatantSpawner:StartFromEvent()
    ORKFramework.Events.Steps.StartCombatantSpawnerStep:Execute(BaseEvent)
    ORKFramework.Events.GameEvent:ExecuteNextStep()
    ORKFramework.Events.BaseEvent:StartEvent()

    So I'm not sure where I'm messing up :)
    Post edited by Squeaker on
  • Did a quick test and it's working fine on my end. What settings did you change on the combatant spawner (from the default settings)?
    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!
  • I'm not exactly sure what you may need so here's a list of the Inspector settings for my Combatant Spawner:

    Start Settings
    Use Scene ID: disabled
    Start Type: None

    Orientation (Player)
    Front: enabled
    Back: enabled
    Left: enabled
    Right: enabled

    Spawn at Object 0: which is a waypoint GameObject in the scene and in the event both.

    Battle Settings
    Battle Type: Turn Based
    Battle Object: none
    Use Nearest Battle: disabled

    Combatant Settings
    Remember Combatants: enabled
    Spawn Random: disabled

    Faction: Player (it's an NPC)
    Combatant: Bob The Construction Worker (test subject :) )

    Level Settings
    Set Level: Default

    Class Level Settings
    Set Class Level: Default

    Spawn Settings
    Quantity: 1
    Random Rotation: disabled
    Set Scale: disabled

    Respawn Settings
    Respawn: disabled

    Move AI Settings: all disabled

    No waypoints added

    All defaults here down, no variable conditions, auto destroy is enabled.

    The Combatant Spawner is added to the Event Interaction object as Actor 2

    I hope that gives you the information you need :)


  • Tested with the same settings, worked fine here.
    I'll need a small Unity test project where this is happening to look into it further.
    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!
  • edited October 2015
    I disabled my Event in the scene and the spawner is not throwing any errors. I'll just email you my event. That may be where the culprit is :)

    I added a couple of screen captures of the event and spawner settings in scene as well. I can still send a small project if my email doesn't help. Thank you!
    Post edited by Squeaker on
  • Was able to reproduce this with a small piece of information - your event interaction is set to Autostart. This can result (in some constelations) in the event spawning the combatants before it's set up in it's own start function.
    You can solve that for now by e.g. using a small Start After time setting (like 0.1) or adding a small wait step before the Start Combatant Spawner step.
    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!
  • Thank you so much! I added the small wait step and it worked perfectly. Thanks man :)
Sign In or Register to comment.