edited July 2015 in ORK Scripting
Is there an easy way to do this? Without recompiling the source code?

Spawn the player procedurally?

And is there an easy way to trigger an event via script? Same process--procedurally-- maybe by putting the event on a prefab then spawning the prefab via script?
Post edited by gamingislove on
  • you can spawn a player anyway you want an add a combatant script to the player prefab but problem with that is that it dosent take every well with ork. you can spawn a player using makinom by calling a spawn player event from ork. which will give you more procedural spawning.... if you have makinom id suggest do it this way alot easier an save you headache.
    new website can be found here http://www.fore-loregames.com

    Follow the game Development on Twitter https://twitter.com/Fore_Lore_Games

    or check out the face book page here https://www.facebook.com/ForeLoreGames
  • As long as a player combatant is set (e.g. through the event system's Join Active Group step), you can spawn it like this:

    ORK.Game.PlayerHandler.SpawnPlayer(int spawnID);

    Spawns the player at the spawn point with ID spawnID.

    ORK.Game.PlayerHandler.SpawnPlayer(Vector3 position, bool setRotation, float yRotation, bool setScale, Vector3 scale);

    Spawns the player at the defined position and optionally sets the y-axis rotation and scale.
    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 June 2015
    Thanks to both of you. : ) I have Makinom, wt, but I just encouraged the person I'm trying to help to buy ORK Framework so I could help them. Fortunately they can program and recompile the source code if necessary but want to avoid that for now. To encourage them to buy Makinom too until I can give more help via the procedural stuff with ORK Framework, which they did buy---might be too much for them right now. : )

    Gil--that sounds like it will be a good solution. Let me try it. Learning as much as I can about procedural spawning and everything related in a crash course. It's very interesting.

    : D
    Post edited by Catacomber on
  • edited July 2015
    Am learning a little bit more about the script am working with that procedurally generates the world and spawns the player also via script.

    I added the ORK Framework to the game which is totally generated via script --the player is a prefab tagged Player.

    Now the GameManager of the script I'm using spawns the player prefab in a random spot. No need for me to set spawn points?

    Do I need spawn points in ORK if am spawning via a script randomly? I would guess no as all that is controlled by the GameManager script. And running the game I spawn.

    Does the player have to spawn at an ORK spawn point? Or can I just go with the script that spawns him at random points in a maze?

    I set the prefab up to have an Interaction Controller to interact with prefabs I hope to set up in the Game Manager Script.

    If the GameManager script does the work of spawning the player, do I need to spawn him using an event?

    Does the GameManager script have to refer to ORK and use ORK scripting to spawn the Player? Or just use an event to add him as a Combatant via Join Active Group?

    Not asking this in the best way but trying. : )

    This is all new to me but I have a feeling it will work.







    Post edited by Catacomber on
  • No, you don't need a spawn point - the 2nd function I posted spawns the combatant at the used position.

    Before spawning the player, there must be a combatant added to the player group (i.e. a player). You can either do that using the usual start event to just add a combatant to the active group, or also via script.

    E.g.:
    ORK.Game.ActiveGroup.Join(int id);
    Will let the combatant with index/ID id join the active player group. The combatant will use the start level defined in it's 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!
  • Thanks, Gil!
  • edited July 2015
    I used these namespaces and the script seems to work without errors.

    using ORKFramework;
    using ORKFramework.Behaviours;

    Thanks.
    Post edited by Catacomber on
  • edited July 2015
    Is there a script to remove the player from the active group? : ) I think I got him/her in there but now when the game ends want to remove him/her from the active group if possible.

    Or is there no harm in adding the player to the active group again and again whenever the player Presses Play?

    Thanks. : )
    Post edited by Catacomber on
  • You'll need the ORKFramework namespace in any case. ORKFramework.Behaviours is only needed when you're using ORK components in your code (but having unused namespaces in your script doesn't hurt anything).

    If the game end is returning to the main menu (e.g. through game over or exiting through menu) you don't need to remove the player, as everything is reset (also when starting a new game or loading a game).
    Otherwise, you can remove a combatant permanently using the Remove function of the group, can either be based on the combatant's ID or the combatant.
    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!
  • What is the Remove function? : ) Is it---

    ORK.Game.ActiveGroup.Remove(int id);

    : )

    Just in case I need to use it. Thanks very much for your help.
  • Check the API, it's got 2 more parameters :)
    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 July 2015
    Where is this API of which you speak? : ) I see a reference to the API in the tutorials but I don't know how to find that part of it that might be useful here. A gentle hint not to mention an outright nudge would be very helpful. : )

    Any help on what I need to type--those two more parameters? : )

    I'm lucky I can code Meow World in C#. : )

    Post edited by Catacomber on
  • GIL

    ORKFramework.Combatant.cs
    public GameObject Spawn(Vector3 position, bool setRotation, float yRotation, bool setScale, Vector3 scale)
    {
    this.DestroyPrefab();
    GameObject prefab = this.setting.GetPrefab(this, ref prefabIndex);
    if(prefab != null)
    {
    //this.GameObject = (GameObject)GameObject.Instantiate(prefab);

    // I want pass a game object name string to here, netPlayer(Clone) is a gameobject
    // has NetworkIdentity component , spawn by the NetworkManager component.

    this.GameObject = GameObject.Find("netPlayer(Clone)");
    if(this.GameObject == null)
    this.GameObject = (GameObject)GameObject.Instantiate(prefab);
    }

    this.PlaceAt(position, setRotation, yRotation, setScale, scale);
    return this.prefabInstance;
    }



    I try this now ORK can work on the "HAPI" Network, No other change.
    My question is can add a game name string here,
  • Yes, you can just change the name of the game object:
    this.GameObject.name = "whatever name you want";
    E.g. directly after instantiating it.
    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 July 2015
    Any help on where I can find those two parameters for the function to remove a combatant from the Active Group? : ) Not that familiar with the API. I did look at it but somehow can't find what I need.

    "Check the API, it's got 2 more parameters :)"

    Thanks.
    Post edited by Catacomber on
Sign In or Register to comment.