Alex1234 asked if I could explain how I set up the summonable critters in a previous demo video
, so here's a quick and dirty tutorial on one way to go about doing it. I think I hit all the main steps here, but lemme know if I left something out. I made this a few months ago now and the memory is a little rusty.
1. Make the Summon
2. Set up/Edit Battle Object
3. Set up Ability Event
4. Set up Status Effect
5. Set up Ability
6. Optional - Set up/Edit Battle End1. Make the Prefab and Combatant for your Summon
Because I have a weird fascination with jacket wearing rabbits in my demo, it too shall be used for the summonable creature.
*Make a new prefab for the creature you want to summon (including any animator or side scripts you need for your party members to normally function. The controller, OBJ vars, and Script components in the screen shot are required for my game, for example.)
*Make a new Tag type and set it to Summoned (so you can always reference these guys specifically later)
*In ORK, make a new combatant using this prefab (using whatever battle settings you normally use). Basically set it up like you would any normal party member. If your party members are AI controlled, give it some AI love. If they have unique abilities and classes, set those up too. 2. Set up/Edit Battle Object
Now you'll need to edit your battle object to allow for extra guys appearing on the field, otherwise they can spawn all over the place when they join (probably not what you want). If you have multiple battle objects across multiple scenes, these will also all need to be edited (unless you're using a prefab to control them all...which I do highly suggest for when stuff like this happens)
*Add additional ally spots to the Battle Object (as many as you might EVER need). For my setup, I'm working under the assumption that each of my three party members could summon an extra guy, so the maximum total number of guys ever on the field will be 6 (3 party members, 3 summons).
*Arrange the extra ally spots so they'll look decent with both the largest and smallest possible summon (otherwise you might run into really weird clipping issues later). 3. Set up the Ability Battle Event
Now you need to set up the actual event to handle the summon.
*Back in ORK, make a new battle event.
*Set up the start of the event as you would normally for any of your other casting type spells. In my example, I'm using a random camera position and 2 spawned particle prefabs - sometimes the camera will zoom in on the caster, and then play the casting and summon particle effects.
*Next add a Join Battle step. (Note - the Random step before the join battle is there for if you want to summon a wide variety of different creatures, like in my specific case. If you only ever want to summon one specific thing, just attach the calculate/spawn steps directly to the Join Battle). Set the level and class settings to whatever makes sense for your game.
*Rotate your new critter to look at the enemies (actor "All Allies" rotating to target "All Enemies", or use Look at Enemies). Otherwise your summon may be facing somewhere random.
*Finish up the event with your normal casting-type set up. For my example, that includes a wait step and cleaning up all the spawned particle prefabs.
*Save the event. Half way there!4. Set up Status Effect
For my specific case, I wanted each party member to be able to spawn only ONE guy for the battle and that's it. So to do that, we need to set up a small status effect requirement that the ability will check for later.
*In ORK, head over to Status Effects and make yourself a new one. (I use the underscore naming convention as a way to differentiate hidden statuses that are used for upkeep type purposes like this. You can name it whatever you want.)
*Set the status to Hidden.
*Set the Effect End to "End with Battle".
*Set the Notification to 'Own Notification" and then do anything fancy you want here, like displaying special summoning text.5. Set up the Summon Ability
Alright, now it's time to finally make the actual ability.
*In ORK, make a new Ability, with Target type Self, and whatever normal casting settings that you use for your game.
*Check the "Animate" box and add a new Battle Event. Attach the event you made in step 3 here (setting up and adding any prefabs or audio clips you need to run your specific event). Note - mine's Battle Event 1, and not 0, since I also use a generic "casting" type event for each spell ability that handles some animations and other random things, which is what's hogging up the other slot. Doesn't matter - just make sure your event is attached in here somewhere.
*Under Requirements, check "Use Requirements" and add a Status Requirement. Select the summoned status effect you made in step four and make sure that "Is Applied" is unchecked. Basically we want the ability to only be usable IF this effect hasn't been applied, eg, the party member hasn't summoned anything yet this battle.
*Set up whatever your use costs are.
*Under User Changes, add the Status Effect from step 4. Now whenever the summon is successfully cast, the user will have that effect applied, blocking him from summoning anything else during the battle.6. Optional - Set up/Edit Battle End
If you're battling in another scene, walk away, you're done. Anything you summoned into that scene will be cleaned up as normal when you load back into your stored scene. If you're NOT battling in a different scene, you're going to need to clean up summoned critter or he might hang around after the battle is over. Like in my case, my battle arena exists in the same scene as where the player normally walks around, so I need to make sure to clean up anything extra things I spawn into the scene. There's probably a fully ORK way to do this, but as I already have a lot of custom scripts running during my battle end, I just stuck it there.
*Open up your battle end event and make a new Call Function step. Place it around where you normally Destroy Combatants (and yeah, this didn't destroy my summons, just the normal guys, so I had to do this extra bit).
*Make a new C# script, paste this code in, and attach it to your player prefab (working under the assumption that you're not destroying your player in Destroy Combatants. Otherwise, attach it to something else that makes sense for your setup).
public void RemoveSummonedCreatures()
summonedCreatures = GameObject.FindGameObjectsWithTag ("Summoned");
for( var i = 0; i < summonedCreatures.Length; i++)
*In the event, call this script from Object: Actor, Actor: Player Group. In my specific case, the RemoveSummonedCreatures call happens during the ResetCurrentPosition function, which is why that's displayed on the screenshot.
*Update all battle end events you might have with this.