• Hello Guest! Did you know that ProjectKorra has an official Discord server? A lot of discussion about the official server, development process, and community discussion happens over there. Feel free to join now by clicking the link below.

    Join the Discord Server

[Outdated] Tutorial: How to create an ability in ProjectKorra

Finn_Bueno_

Staff member
Plugin Developer
Verified Member
Uhm... Whats stopping a chi blocker from throwing daggers?
Being able to throw daggers makes sense... Airbenders setting people on fire doesnt make sense.

This only has a listener. I mean, you COULD make an ability based on this.... but it would be terrible (look at my very first abilities). To make an actual ability you need more than what finn has showed.
I could make a more advanced tutorial (possibly as a video).
 

Gold

Verified Member
I honestly think this could be evaluated to my fettuccine standards, perfect of course.
 

Matt

Verified Member
Ahh but thats where you are wrong... everyone can improve on what they currently know...
By all means! Yes, im just saying. There are some correct ways to start (better someone understands what they are doing then just doing it because it's what you've practiced)
 

RobagNetwork

Verified Member
Hello and thank you for the tutorial! It helped me become more familiar with the way ability addons are created!
However, I did find a few issues, but I'm probably at fault here.
I found three errors (I'm using Eclipse) in the code. I typed it by hand instead of copying the code, because I thought that'd be how I learned it all. I made a few adjustments for my ability, for I am venturing off to making something other than "Ignite". But I found a few errors while following your format. Here they are:
Code:
@EventHandler(priority = EventHandler.NORMAL)
When I type in this exactly, Eclipse proceeds to notify me: "NORMAL cannot be resolved or is not a field". I kind of ignored it at first. But then I came across another error:
Code:
Entity entity = GeneralMethods.getTargetEntity(player, 7, new ArrayList<Entity>);
Eclipse notifies me:
"Multiple markers at this line
- The method getTargetEntity(Player, int, ArrayList<Entity>) is undefined for the type
GeneralMethods
- Syntax error, insert "( )" to complete Expression"
So I click on getTargetEntity and figure it may have changed, and I saw that it could've been formatted as getTargetedEntity instead, which I selected as a quick fix. (Not sure if this was correct or not).
And I don't know why it told me I had a syntax error; it looked fine to me. But I inserted another parenthesis in there and the error went away o_O
The final error I had was on this line:
Code:
GeneralMethods.damageEntity(player, entity, 1);
My error notification was: "The method damageEntity(Player, Entity, double, String) in the type GeneralMethods is not applicable for the arguments (Player, Entity, int)" and there were four quick fixes about adding arguments to match damageEntity. I didn't know what to do here so I left it alone.
I thought maybe it would still work and maybe these were minor errors but when I attempted to load the ability jar file on my test server, it failed to load. Here is the error report:
My ability is called Pyrokinesis.
Code:
[19:30:38] [Server thread/INFO]: [ProjectKorra] Enabling ProjectKorra v1.8.0 BETA 5
[19:30:39] [Server thread/WARN]: java.lang.NoSuchMethodException: me.robagio.korra.pyrokinesis.PyrokinesisInformation.<init>()
[19:30:39] [Server thread/WARN]:     at java.lang.Class.getConstructor0(Unknown Source)
[19:30:39] [Server thread/WARN]:     at java.lang.Class.getConstructor(Unknown Source)
[19:30:39] [Server thread/WARN]:     at com.projectkorra.projectkorra.util.AbilityLoader.load(AbilityLoader.java:88)
[19:30:39] [Server thread/WARN]:     at com.projectkorra.projectkorra.ability.AbilityModuleManager.<init>(AbilityModuleManager.java:74)
[19:30:39] [Server thread/WARN]:     at com.projectkorra.projectkorra.ProjectKorra.onEnable(ProjectKorra.java:56)
[19:30:39] [Server thread/WARN]:     at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321)
[19:30:39] [Server thread/WARN]:     at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335)
[19:30:39] [Server thread/WARN]:     at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405)
[19:30:39] [Server thread/WARN]:     at org.bukkit.craftbukkit.v1_8_R2.CraftServer.loadPlugin(CraftServer.java:356)
[19:30:39] [Server thread/WARN]:     at org.bukkit.craftbukkit.v1_8_R2.CraftServer.enablePlugins(CraftServer.java:316)
[19:30:39] [Server thread/WARN]:     at net.minecraft.server.v1_8_R2.MinecraftServer.r(MinecraftServer.java:416)
[19:30:39] [Server thread/WARN]:     at net.minecraft.server.v1_8_R2.MinecraftServer.k(MinecraftServer.java:382)
[19:30:39] [Server thread/WARN]:     at net.minecraft.server.v1_8_R2.MinecraftServer.a(MinecraftServer.java:337)
[19:30:39] [Server thread/WARN]:     at net.minecraft.server.v1_8_R2.DedicatedServer.init(DedicatedServer.java:257)
[19:30:39] [Server thread/WARN]:     at net.minecraft.server.v1_8_R2.MinecraftServer.run(MinecraftServer.java:522)
[19:30:39] [Server thread/WARN]:     at java.lang.Thread.run(Unknown Source)
[19:30:39] [Server thread/WARN]: [ProjectKorra] Unknown cause
[19:30:39] [Server thread/WARN]: [ProjectKorra] The JAR file Pyrokinesis.jar failed to load

If you could supply me with some kind of aid in this matter, please do =D
-
But overall, thanks for the tutorial. This helped me a lot despite the few errors.
 

RobagNetwork

Verified Member
Code:
@EventHandler(priority = EventHandler.NORMAL)
When I type in this exactly, Eclipse proceeds to notify me: "NORMAL cannot be resolved or is not a field". I kind of ignored it at first.
I looked this part up, and found a page talking about EventPriority. It seemed this was what I was looking for, so I put it into my code as "public EventPriority NORMAL;" and it had no errors. Is this what I'm looking for?
My error notification was: "The method damageEntity(Player, Entity, double, String) in the type GeneralMethods is not applicable for the arguments (Player, Entity, int)" and there were four quick fixes about adding arguments to match damageEntity. I didn't know what to do here so I left it alone.
I decided to add an Element argument to this method so I ended up with "GeneralMethods.damageEntity(player, entity, 1, Element.Fire.toString());"
I now have no errors.
So I saved, exported, and uploaded to my test server. I get the same error code as aforementioned.
 

Simplicitee

Staff member
Plugin Developer
Verified Member
Code:
@EventHandler(priority = EventHandler.NORMAL)
When I type in this exactly, Eclipse proceeds to notify me: "NORMAL cannot be resolved or is not a field". I kind of ignored it at first. But then I came across another error:
EventHandler.NORMAL should be EventPriority.NORMAL
[ODE]Entity entity = GeneralMethods.getTargetEntity(player, 7, new ArrayList<Entity>);[/ODE]Eclipse notifies me:
"Multiple markers at this line
- The method getTargetEntity(Player, int, ArrayList<Entity>) is undefined for the type
GeneralMethods
- Syntax error, insert "( )" to complete Expression"
So I click on getTargetEntity and figure it may have changed, and I saw that it could've been formatted as getTargetedEntity instead, which I selected as a quick fix. (Not sure if this was correct or not).
And I don't know why it told me I had a syntax error; it looked fine to me. But I inserted another parenthesis in there and the error went away o_O
new ArrayList<Entity>() should be that last part
Code:
GeneralMethods.damageEntity(player, entity, 1);
My error notification was: "The method damageEntity(Player, Entity, double, String) in the type GeneralMethods is not applicable for the arguments (Player, Entity, int)" and there were four quick fixes about adding arguments to match damageEntity. I didn't know what to do here so I left it alone.
I thought maybe it would still work and maybe these were minor errors but when I attempted to load the ability jar file on my test server, it failed to load. Here is the error report:
It gives you the answer, the method should be like GeneralMethods.damageEntity(player, entity, 1, "insertabilitynamehere");
 

RobagNetwork

Verified Member
EventHandler.NORMAL should be EventPriority.NORMAL

new ArrayList<Entity>() should be that last part

It gives you the answer, the method should be like GeneralMethods.damageEntity(player, entity, 1, "insertabilitynamehere");
Thank you! This really helped.
 

P0W3RK1D

Verified Member
what i would do is dont start Major coding right away (IF YOUR NOT AN EXPERIENCED CODE, FOR THOES OF U WHO ARE MASTER CODE PRO DONT WORRY BOUT THIS COMMENT) , if u can just find an easy, simple looking skill and then just tamper with its code, change simple thinkgs like its distance or its particles.
then once uve done the simple thinkgs like changing its name or description go onto bigger things like changing the blocks that it uses or somthing.
basicly: get a good feel for the layout of the move and what part of the code does and or controls what part of the move.
THEN once ur experinced or atleast familiar with this you should try to do bigger things.
Start small - Then go larger
 

Sorin

Verified Member
what i would do is dont start Major coding right away (IF YOUR NOT AN EXPERIENCED CODE, FOR THOES OF U WHO ARE MASTER CODE PRO DONT WORRY BOUT THIS COMMENT) , if u can just find an easy, simple looking skill and then just tamper with its code, change simple thinkgs like its distance or its particles.
then once uve done the simple thinkgs like changing its name or description go onto bigger things like changing the blocks that it uses or somthing.
basicly: get a good feel for the layout of the move and what part of the code does and or controls what part of the move.
THEN once ur experinced or atleast familiar with this you should try to do bigger things.
Start small - Then go larger
so tamper with moves people worked hard on, claim their work as your own, copy and paste into your other codes/moves, and your good? No, that is not how coding works, you can look at peoples code, if it is open source, or they give you permission, but i wouldn't tamper with it, and/or use it in your work without their permission, for any of you wanting to do this, just don't.
 

RobagNetwork

Verified Member
what i would do is dont start Major coding right away (IF YOUR NOT AN EXPERIENCED CODE, FOR THOES OF U WHO ARE MASTER CODE PRO DONT WORRY BOUT THIS COMMENT) , if u can just find an easy, simple looking skill and then just tamper with its code, change simple thinkgs like its distance or its particles.
then once uve done the simple thinkgs like changing its name or description go onto bigger things like changing the blocks that it uses or somthing.
basicly: get a good feel for the layout of the move and what part of the code does and or controls what part of the move.
THEN once ur experinced or atleast familiar with this you should try to do bigger things.
Start small - Then go larger
so tamper with moves people worked hard on, claim their work as your own, copy and paste into your other codes/moves, and your good? No, that is not how coding works, you can look at peoples code, if it is open source, or they give you permission, but i wouldn't tamper with it, and/or use it in your work without their permission, for any of you wanting to do this, just don't.
I think tampering with it would be ok if you have permission, as long as it's only for educational purposes and you're not uploading it anywhere. It would help to get a feel of the way this works.
 
Top