1. How do I spawn a Cargo plane with a set drop location?
    I've taken a look at Airdrop Control, and what he used to spawn a cargoplane to a position.
    Thats was what he used (in c# tough)
    Code:
                BaseEntity entity = GameManager.server.CreateEntity("events/cargo_plane", new Vector3(), new Quaternion());
                if (entity != null)
                {
                    var targetPos = new Vector3();
                    targetPos.x = Convert.ToSingle(arg.Args[0]);
                    targetPos.y = Convert.ToSingle(arg.Args[1]);
                    targetPos.z = Convert.ToSingle(arg.Args[2]);
                    dropPoint.Add(entity as CargoPlane, targetPos);
                    entity.Spawn(true);
                    dropPoint.Remove(entity as CargoPlane);

    Thats what I've come up with. Propably totally wrong...
    Code:
    global.GameManager.server.CreateEntity("events/cargo_plane", UnityEngine.Vector3.get_up(), UnityEngine.Quaternion())
    dropPoint:Add(CargoPlane, dropPos)
    entity:Spawn(true)
    dropPoint:Remove(CargoPlane)
    

    And i am getting an error here:
    Code:
    110 attempt to call field 'Quaternion' (a table value):
    ------ EDIT -------
    I found out for example that he set those dropPoint is set by him elsewhere ^^ but that does not change anything at that error
    Code:
    dropPoint = new Dictionary<CargoPlane, Vector3>();
     
    Last edited by a moderator: May 1, 2015
  2. The location where the crate is dropped is determined by the starting and ending position of the cargoplane. The crate will always spawn in the middle between the start and the end, so you would want to randomly get a starting location and then calculate the ending position based on the starting location and drop location. And the issue you're having with Quaternion there is because you're using it completely no wrong, if you'd want to create a new Quaternion you need to use the new() function.
    Code:
    new(UnityEngine.Quaternion._type, nil)