1. I'm trying to make a plugin where "OnUserInput" would spawn an entity at a players feet. Ideally, I'd like it to be one or the other. Is it possible to have two (or more) separate strings that can do this? Or am I missing a simple line?

    At the moment my line shows;

    Code:
            string treeEnt = "assets/bundled/prefabs/autospawn/resource/v2_temp_beachforest_small/douglas_fir_d.prefab";
            string treeEnt2 = "assets/bundled/prefabs/autospawn/resource/v2_arctic_forest/douglas_fir_a_snow.prefab";
    Code:
    BaseEntity baseEntity = GameManager.server.CreateEntity(treeEnt, player.transform.position + (player.modelState.ducked ? Vector3.up * -0.0f : Vector3.up * -0.0f) + player.eyes.HeadForward());
    This just returns errors.

    I'm still quite new to C# so slowly getting there, and any advice would be greatly appreciated!
     
  2. Wulf

    Wulf Community Admin

    What are the errors exactly? If you want it to be random, you'd need to add a bit of code to randomly pick which string to use.
     
  3. Code:
    Operator `||' cannot be applied to operands of type `string' and `string'
    Probably on the complete wrong area of what I need! Haha.
     
  4. Wulf

    Wulf Community Admin

    The || would be if you are checking something about the strings, not to randomly pick one. Ie. if they are empty or null, don't match something, etc.
     
  5. How would I randomize?
     
  6. Wulf

    Wulf Community Admin

    Search for "C# random", should help a bit.
     
  7. Thanks mate!