1. In a python plugin it's possible to do something like this;

    Code:
    # reference the other plugin
    self.HumanNPC = plugins.Find("HumanNPC")
    # call the other plugins method, and return its type
    humanPlayer=self.HumanNPC.CreateNPC(pos,quat,key)
    # use its type in my plugin....
    humanPlayer.info.invulnerability=False
    humanPlayer.info.hostile=True
    However in C# the type which is defined in the other plugin is not available... Is there some way to include the other plugins types? ...as

    Code:
    using Oxide.Plugins.HumanNPC;
    doesn't seem to work
     
  2. Wulf

    Wulf Community Admin

  3. So if I was writing the other plugin myself, then I could expose those values using Dictionary values.. as per the Oxide API. But in this case the plugin is 3rd party. I guess I can modify the plugin to expose a bunch of attributes as a Dict and pass it back and forth, but it seems odd you can do it in python, but not in C#
     
  4. Wulf

    Wulf Community Admin

    You'd need to call the other plugin's methods, not a dictionary or variable in it. You can see examples of this in my Slack, Babel, or other API-type plugins. In C#, you should be using [PluginReference], you can't just add it as a using statement.
     
  5. I have a reference to HumanNPC using [PluginReference] like so;

    Code:
    [PluginReference] Plugin HumanNPC;
    However if I try to use the type from that, like this;

    Code:
                HumanNPC.HumanPlayer humanPlayer=HumanNPC.Call("CreateNPC",
    player.transform.position,
    player.transform.rotation);
    I get an error;
    Code:
    [07/05/2016 23:21:31] [Oxide] 23:21 [Error] MightyDeathmatch.cs(905,4): error CS0118: `Oxide.Plugins.MightyDeathmatch.HumanNPC' is a `field' but a `type' was expected
    which kind of makes sense.

    The original plugin doesn't contain any method to set for example the invulnerability of the NPC as a method..
     
  6. Wulf

    Wulf Community Admin

    You wouldn't be able to get a callback as far as I know unless the other plugin's method returned something.
     
  7. The other plugins method returns an object;
    Code:
    public HumanPlayer CreateNPC(Vector3 position, Quaternion currentRot, string name = "NPC", ulong clone = 0)
    However trying to use that object is impossible if my plugin doesn't import the type somehow

    Code:
     humanPlayer.info.invulnerability=False; [07/05/2016 23:50:41] [Oxide] 23:50 [Error] MightyDeathmatch.cs(914,16): error CS1061: Type `object' does not contain a definition for `info' and no extension method `info' of type `object' could be found. Are you missing an assembly reference?
    
    Anyway... so I'll customise the HumanNPC plugin to expose a method which accesses that variable..