Calling an heli?

Discussion in 'Rust Development' started by Rusty, Sep 28, 2015.

  1. How to call an heli using LUA?

    Thanks
     
  2. Wulf

    Wulf Community Admin

  3. Code:
    rust.RunServerCommand("heli.call")
    Doesnt work, doesnt work in rcon either, does work in game console, is there a rust.RunConsoleCommand? lol
    [DOUBLEPOST=1443481373][/DOUBLEPOST]there is a global.RunConsoleCommand but it gives me a not a table error when i call it.

    global.RunConsoleCommand("heli.call")

    attempt to index runcosolecommand a table value
     
    Last edited by a moderator: Sep 29, 2015
  4. Wulf

    Wulf Community Admin

    You're just making up functions. :p

    The rust.RunServerCommand is provided by Oxide, not Rust. You won't see anything returned when calling heli.call as far as I know.
     
  5. Then how do you do it :) ive been playing all day, i think this is the way to go

    Code:
    local entity = global.GameManager.server.CreateEntity.methodarray[0]:Invoke(nil,util.TableToArray({ "events/cargo_plane", new( UnityEngine.Vector3._type, nil ), new( UnityEngine.Quaternion._type, nil ) }))
    But i keep getting errors
     
  6. Wulf

    Wulf Community Admin

    That would be a cargo plane, not a heli, but you may be able to find a similar way. The command should work fine though for general calling.
     
  7. Yea i know if i can call the cargo i can call the heli, lua trully sucks but .cs is confusing for me..let me know if u can come up with something.
    [DOUBLEPOST=1443493065,1443482745][/DOUBLEPOST]Wulf: hook a brother up. :)
     
  8. Wulf

    Wulf Community Admin

    I'd recommend digging around in the DLL, it'd be the same thing I'd do.
     
  9. I don't not anything about LUA, but here's my C# code to spawn a helo, and have it first "visit" somebody (or at least, where they were). It's simple enough, I'm sure you can figure out the LUA;

    (This code is essentially just a cut and paste from the "heli.calltome" console command)
    Code:
        BasePlayer target = outlaws.SingleOrDefault(p => p.displayName.StartsWith(targetPartialName));
        BaseEntity entity = GameManager.server.CreateEntity("assets/bundled/prefabs/npc/patrol_helicopter/PatrolHelicopter.prefab", new Vector3(), new Quaternion(), true);
        if (entity != null)
        {
         entity.GetComponent<PatrolHelicopterAI>().SetInitialDestination(target.transform.position + new Vector3(0.0f, 10f, 0.0f), 0.25f);
         entity.Spawn(true);
        }