Forum rules - please read before posting.

Set-Up suggestions/tips for static 2.5D and 3D mix

edited January 2017 in Technical Q&A
I wanted to come here to get quick round of suggestions.
1. The game I'm working on starts off with a fixed, static town screen(think King's Quest)  in which the character can't move and he must use the cursor to mouse over a hotspot to 'talk to a person', 'visit a home', 'shop at the market'. The perspective is first person, and again, the scene is static; the play is restricted from moving and can only use the mouse to make selections.
2. After leaving town, the field is 3D, just like in Mount and Blade or an old school JRP. It is meant to be overhead like Mount and Blade or an Old School style JRP. There are random encounters which impede progress, but essentially, I switch from 2.5D/first person to 3D/third person upon load scene.
3. My random encounter is a fixed 2.5D screen, but as of now, I do not have the combat system hooked up to Adventure Creator. The only reason I would have to hook the scene up to adventure creator is because I have persistent game objects, like Gold(currency) to be acquired during the battle and then upon leaving the scene, added to the adventure creator inventory. Does anyone know if I must make this an adventure creator scene, or a way to add/subtract an item from adventure creator inventory using a non-adventure creator scene? I assume it's not possible.


My biggest question in regarding this design doc is: how do I account for changing point of view and changing from point and click at some points in the game? And how can I utilize my battle system with adventure creator --- as in, my variables I need to carry to the next scene, such as experience, or money earned during battle?


The screens below capture the design direction of the game camera and controller-wise:
image
A first person town/interior screen that is point and click/disallows player movement.




image
See the man on the horse and the 3D world view?



And here, below, is the way battle scenes will look. I'm not working with 2D sprites at any point, just to be clear. Mine is using 3D models with a fixed camera in some places.
image

Comments

  • You could make use of the new scene attributes feature to have your scene set itself up in different ways according to its type, e.g. set to Point And Click for the town, 2.5D for the map etc.  See Section 7.6 of the Manual for more.

    All of AC's variables and settings can be accessed via script.  It would be quite simple to add/subtract currency to an AC inventory item.  Right-click on the item's Quantity on start field in the Inventory Manager (temporarily enable Carry on start? if it's not showing) and you'll be able to copy the API reference to it to the text buffer, e.g.:

    AC.KickStarter.runtimeInventory.GetItem (3).count

    You can then use that in a custom script to read/write the amount of an inventory currently being held (assuming it is held by the player).

    The same can be done with AC's Global Variables.  See the scripting guide for more.
  • I'm sorry, but I'm not sure if I understand how to use Scene Attributes correctly even after reading the manual. I will give an exact example of what I'm doing, and make sure it's what you recommended I do:
    1. In Scene One, under the [AC Game Editor Scene] tab, I use CameraA on startup, and my Starting CutScene.cs Constrains the Player and also a 2 second dialog popup. 
    Under my [AC Game Editor Settings ] tab, I do not provide an action list, and I am using First Person.

    2. In Scene Two, the Starting Cutscene.cs reverts the player back to freely moving. I use CameraB now. In the [AC Game Editor Settings], I now have Direct Control using Legacy animation.

    I would like to start by switching from first person control to direct control between the two scenes. I think I may know how to do what you're saying, but can I have an example of how it's supposed to be done?

    Thank you so much.
  • edited January 2017
    UPDATE: This is what I've done. It might not have been the best idea. You tell me. I made 2 Player prefabs.
    Scene 1, start/on load cutscene -> Switch Hero 0 ->Engine Manage Systems: Movement First Person -> Player Constrain true
    Scene 2 start/on load cutscene ->Camera Switch (new cam) -> Switch Hero 1-> Engine Manage Systems:Movement  Direct -> Player Constrain false


    Basically, are there problems that could arise from this?



    Older, original post.
    Just an aside: I still want to know how to use the scene editor, but couldn't I just achieve everything I wanted by using the Switch Player feature? I am assuming that this just changes the player model/rig/set-up, but the Player character still only has one inventory, and associated information. In other words, the only real change is that I have a HeroA and a HeroB, prefab, but they are the same person as far as AC is concerned? It's not the same as if I a warrior and he has an ax and a bow, and then I swap to a mage, who has a staff in his inventory. It's that HeroA and HeroB, regardless of which one, both are the same, so that if I have 440 coins with HeroA, and swap to HeroB and ean 100 coins, then swap back to HeroA, it reflects that I have 540 coins?

    The problem I'm having, after reading the manual regarding player swapping, is that it seems AC handles, with an action, the ability to let players share an inventory. If I define a custom variable, I'll call it strength, for A, does it derive and also correspond to B?
  • edited January 2017
    Variables are separate from inventory - AC does not consider a variable's state as tied to a particular player, so changing it while Player A is active will also have it "changed" while Player B is active.

    Bear in mind that AC also allows for the use of local player prefabs. If a Player object is present in the scene file itself, then that Player will be used instead of the "default" Player prefab in the Settings Manager for the duration of that scene. Therefore, you could avoid the need to switch players by simply having the correct Player placed locally in each scene.

    Using the Engine: Manage systems and Player: Constrain Actions to change gameplay between scenes is perfectly valid.
  • That answers the question on how to manage different controls and players in scenes. I have things set-up for the time being by calling the prefab player per scene, not a local player as of yet. I'm using that manage systems/switch control type/constraining or unconstraining of player accordingly. While we're on the topic, does a local player follow same situation as described when you said:

    "AC does not consider a variable's state as tied to a particular player, so changing it while Player A is active will also have it "changed" while Player B is active." So if I have player A and player B and then, a local player in one scene, would that state be tied to the player - being that it is not global? If I gain 100 gold in a scene on a LOCAL player, will it treat the same as a global player prefab?
  • edited January 2017
    Unless you keep a separate Gold global variable for each Player, they will all share the same variable. That's why they're called global variables. Scenes or objects are not tied to them, they exists permanently during the duration of the program and can be accessed freely from any other object, in any scene. So scene changing or unloading/destroying of objects doesn't affect them. As I said at first, if you want each player to have its own gold count you'll need a separate global variable for each of players. Then when the time comes you'll have to select which variable to set/change depending on the active player. 
  • edited February 2017
    If gold is recorded as a global variable, then yes - it will affect all player prefabs.  If you want gold to be recorded per-player, then you have two options:
    1. As @Alverik suggests, create a separate Global variable for each player
    2. Have separate inventories for each player, and store gold as an inventory item
  • Thank you, Alverik. I thought this initially, because I know about Global Variables. Since a Local Player was mentioned by Chris as a means to avoid switching scenes, I wondered then if the Local Player could also tap into the custom variables established for a prefab version of a Player, those ones that are specified in the AC Editor for the prefab player. I've never used local players, but I might for the battle selection. I still don't have it hooked up to AC yet. Anyway, from the response, it sounds like no matter what, I can expect both a Player specified in the AC editor and one that is created locally- in the scene - to have the same access to a custom global variable.
  • edited February 2017
    That is correct.  Global variables and Players are separate systems, and do not affect one another.
  • Some help on how I am setting up my random encounter trigger:

    I have 4 Trigger Boxes, levels 1 through 4.

    I wanted to check for the player movement to be true (I thought, Input Check Horizontal?), and do a random Random.Range so that on a certain number of steps, the player enters battle. I know how to do this simply without AC, but I'm not quite sure the easiest and most intuitive way to do it with AC.

    Example: Player steps into trigger box 1 and initiates battle after 45 steps. The battlefield is a desert. Later, the Player steps into box 2 and initiates battle after 38 steps. Box two battlefield is a snowy mountain.

    Do you think I have to start controlling the encounters with Global Variables, or should I set up my own scene manager and not use AC triggers? Not even sure if I need Global variables if I just want to set up encounters every so many steps the player is in one of the encounter trigger boxes. I do want to learn how to do it with AC so any help would be appreciated.
  • It's really up to you - there's no requirement for you to do it in AC, and if you know how to do it without AC, I would say that's the better option.

    Even with AC, you're going to have to resort to a custom script to detect if the player is moving or not.  Rather than checking for the Input, it's better to check for the player's charState variable:

    if (AC.KickStarter.player.charState == AC.CharState.Moving)
    {
     // Player is moving
    }



  •     public int encounter;





        //
     Use this for initialization

        void Start () {

        

        }

        

        // Update is called once per frame

        void Update () {



            encounter = Random.Range (1, 2500);



        



            if (AC.KickStarter.player.charState == AC.CharState.Move) {

                    if (encounter <= 40){

                    Application.LoadLevel ("BattleTemplate");

                    }

                    

            }

    This worked great when attached to the player. Thanks very much! I will re-arrange things to deal with the triggers. If anyone still wants to put in their two cents about how to do random encounters via action list/triggers, I am still curious.

  • I have another specific question. I have an AC Trigger. In the game, I have an empty object with 4 different scripts. On the empty object, the scripts are not enabled. When I go through ACTrigger1, I want to enable Triggerscript1.cs
    I've tried different things to turn the corresponding script on the object, but I don't think I am doing it correctly. I've tried send message, for example, and making custom functions in my script called CallScript1(), CallScript2(), ect...
    But I can't seem to figure out how to call the commands. Maybe because I'm writing the wrong commands and the Trigger Action List is not recognizing the function.

    Any advice here from anyone? Since I am using an AC Player, in an AC Scene, and I want to make use of AC triggers, I would like to use custom code to make the trigger turn on the correct script found within the scene on the empty game object, upon detection of the player.
  • You'll have to create a custom action that takes that object, then in the script you'll have to get a reference for each of the scripts. That way you can use _triggerscript1reference.enabled = true (or false) as needed.

    By the way, always delete unity callbacks/events if you are not using them, as they may incur a slight overhead if they are in a script -cause they get called even if they're empty. (Specially true for Update() events, or so I've heard in the forums).
  • edited February 2017
    A tutorial for custom Actions can be found here.  Alternatively, you can use the Object: Send message Action to invoke functions in another script.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.