A small part of me dies every time I see npcs[int].
Let's not even get down to all those missing getters & setters.
|
Here is a very simple system for handling an irregular attack cycle, giving a boss potential mechanics, for this example, Here is the rotation.
Reason you should add this: Bossing on RSPS's can be very plain, and this can spice it up a bit
This is all in NPCHandler.java
At the top declare
This will be used to hold the attackRotation and let the server know which attack the cycle is on.Code:public static short attackRotation = 0;
If you want it to be for a boss that has one instance, use this. If you want it to have more then one, In the Player class declareinstead.Code:public short attackRotation = 0;
Now go to NPCHandler and go to the handlespecialeffects() method
In this example
The reason the numbers 0-8 are written backwards is if they were not, it occurred in game where the entire cycle would rotate every time the NPC using the rotation attacked, so that is why it is in an abnormal order.Code:if (npcs[i].npcType == Your npc ID) { attackRotation++; switch (attackRotation) { case 8: attackRotation++; break; case 7: attackRotation++; break; case 6: attackRotation++; break; case 5: attackRotation++; break; case 4: attackRotation++; break case 3: if(Misc.random(5) == 4){ attackRotation = 5; } attackRotation++; break; case 2: attackRotation++; break; case 1: attackRotation++; break; case 0: attackRotation++; break; case 9: attackRotation = 0; break; } }
You will have to add attacks for each part, as I won't be doing that for you.
i was really tired when I wrote this, but I believe that all I was missing in here (it's not actually missing in the code, just forgot to cp) is another bracket at the end
this works fine otherwise, what is the issue with forcechats? Nex is quite a 'vocal' npc as I would call it and says a lot. If you mean to write it differently, if you use a different thing to [i] it can cause strange glitches
The methods to do with corruption are to do with attacks I made for nex, and this isn't me giving a nex code, it's more the basic idea of how it works, so people can generate their own attacks within each case.
I'm not speaking of the actual functionality here, I'm just talking about the code. Ignore my initial post as formatting kinda ruined it and I can see why you didn't fully understand it.
What I mean is the direct accessing of variables - you should always be using getters and setters. Not to mention these variable names are just terrible. And of course that huge loop of npcs.. It's just depressing. Completely defeating the purpose of java - OOP. Applying none of it in here basically.
Sir, I don't know what the hell you've done with it now, but whatever this is:
is wrong.Code:if (npcs[i].npcType == Your npc ID) { attackRotation++; switch (attackRotation) { case 8: attackRotation++; break; case 7: attackRotation++; break; case 6: attackRotation++; break; case 5: attackRotation++; break; case 4: attackRotation++; break case 3: if(Misc.random(5) == 4){ attackRotation = 5; } attackRotation++; break; case 2: attackRotation++; break; case 1: attackRotation++; break; case 0: attackRotation++; break; case 9: attackRotation = 0; break; } }
Long story short, this is not a tutorial, nor is it really a snippet. Not entirely sure why you chose this topic to even demonstrate how to do it; the only way beginners would be able to learn from it is if there was full code of an example effect in front of them; they won't know what the hell to do with a switch case that contains odd looking repetitive code.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |