1. Dark_Atlantis

    Dark_Atlantis Naked Wanderer

    Hello everyone,
    I recently started my work on my very first plugin (yesterday to say so), and I am wondering from where you guys know how to get certain attribute informations? Like DamageEvents damage ammount, owner, damagesource, etc.
    Most of my knowledge comes from available plugins where I see certain informations.
    For example, is there a way to check if a damaged block (or entity) is inside a crest zone? I want to work on a warTime like plugin, but instead of kicking the attacker only to nullify the damage done and actually simply make the whole attack not work.
    At the moment, hitting a block outside of crest zone allows the attacker to gain material without damaging the block. I want it so, that blocks outside of crests are free to kill and salvage, but blocks inside crests zone obey the no-damage rule.
    I really hope you understand what I was typing here and can help me out with some good advices for either question.
     
  2. Scorpyon

    Scorpyon Shack Builder Plugin Developer

    The library is a good resource for most of this stuff:
    http://docs.oxidemod.org/rok/

    Alternatively if there's a specific hook or way to do something, just ask here in the forums. :)
    --- Double Post Merged, Jul 8, 2015 ---
    There's a couple of ways of doing what you're looking at there, but none of them particularly simple.
    I'm currently working on something similar and will post what I come up with when it's done.
     
  3. Dark_Atlantis

    Dark_Atlantis Naked Wanderer

    Thanks so far, but I was not asking for the oxide API, rather how you guys find out things like "deathEvent.KillingDamage.DamageSource.Owner.DisplayName". I mean, i found the hooks and so on on the API site, but I do not know what I can access through (PlayerEvent e) or (CubeDamageEvent e). So to speak, what comes behind all these little dots ^^
     
  4. Scorpyon

    Scorpyon Shack Builder Plugin Developer

    There are two ways that I do this.
    The first is to decompile the C# Assembly file using a program like .dotPeek (which is free). And then to locate the source code for what methods / variables are available for things like CubeDamageEvent, etc.

    The second is to use Visual Studio, create a new project for creating plugins and download the github Oxide Library and include it as a reference to your project.
    What this means is that VS will then let you use intellisense when using stuff like Player, Events, etc and will pop up a list of available methods and variables etc as you are typing.
    Its a little more complicated to set up than using a decompiler but a damn sight faster when actually coding.
    --- Double Post Merged, Jul 8, 2015 ---
    If you need any help with how to do either of the above at all, let me know.
     
  5. Dark_Atlantis

    Dark_Atlantis Naked Wanderer

  6. SweetLouHD

    SweetLouHD Shack Builder Plugin Developer

    so you dig down the individual methods and you can open the decompiled source to see what functions, args, etc.
    --- Double Post Merged, Jul 8, 2015 ---
    i recommend using the search at the top for keywords
     
  7. Scorpyon

    Scorpyon Shack Builder Plugin Developer

    As Lou said above.
    Use the search box to locate the file that has the class you want to find out about.
    Then scan through that file for any public methods. You should be able to use those.
    I haven't come across one that specifies being in a crest area yet myself
     
  8. SweetLouHD

    SweetLouHD Shack Builder Plugin Developer

    I would start looking at Salvage for crest area. thats just me.
     
  9. Dark_Atlantis

    Dark_Atlantis Naked Wanderer

    Worked it out so far,
    Code (Text):
    if(e.Damage.DamageTypes == XXXXX) {
    but I'm stuck on how I can ask now for using the enum on DamageType.Salvage.
    --- Double Post Merged, Jul 8, 2015 ---
    Is that possible like that?
    Code (Text):
    if(e.Damage.DamageTypes == CodeHatch.Damaging.DamageType.Salvage)
    Or is that a very bad coding?
     
  10. Scorpyon

    Scorpyon Shack Builder Plugin Developer

    You should be able to just use:
    Code (Text):

                if (e.Damage.DamageTypes == DamageType.Salvage)
     
    from a coding perspective.
    Though I don't know whether this check will work in game (when you try and salveage) or not - I haven't tried it in code yet, but it compiles fine.
     
  11. Dark_Atlantis

    Dark_Atlantis Naked Wanderer

    Well, both my questions are answered. Yes it works now, I could work over it to make it cleaner and then publish it if someone is interested. I will try to use your code instead, but at the moment it works fine ^^.
     
  12. Scorpyon

    Scorpyon Shack Builder Plugin Developer

    Awesome!
    Well, my code above doesn't change anything, simply removes some unnecessary bits at the front that you don't need to include (assuming you've included the "using" statements for them)
     
  13. penelipydick

    penelipydick Naked Wanderer

    Could you please explain how to reference the Oxide Library so that i can use intellisense to view usable variables and hooks ?
     
  14. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Google: "visual studio referencing a dll"

    It's the same for any project essentially. Oxide.Core.dll, Oxide.Core.CSharp.dll, and the other Oxide DLLs and common dependencies for the game are what you'd want to use, which you can find in the latest Oxide download or on our GitHub repo.
     
  15. penelipydick

    penelipydick Naked Wanderer

    Okay so i have the referenced the dll file but i still cant see available hooks and variables also im getting script errors could you maybe suggest something im not doing correct or not doing at all I am new to oxide development but i would like to develop plugins for reign of kings. i am very comfortable in c# i just need some starting tips. Any help would be very appreciated :D upload_2017-3-11_0-59-1.png
     
  16. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Hooks aren't something provided via IntelliSense, but the Docs link at the top has most of those. The red underline for ReignOfKingsPlugin is because of the missing reference to Oxide.Core.CSharp.dll.
     
  17. Austinv900

    Austinv900 Shack Builder Plugin Developer

    I wonder if Visual Studios has a way of pulling hooks from a config file. That would be interesting to look into