Coyote™ Posted March 18, 2010 Posted March 18, 2010 Well here's something funny I decided to make.. It's really nothing special, it just came to my mind and I thought to make it.. Plus that a guy made a similar request, soo.. Anyway. It is an item, with which you can change your name color. The choice is random (for example it may choose red, or green, or blue, etc.). Everything is configurable though, so you don't have to worry. There is a risk option too, in which nothing happens, so the user will be kinda unlucky xD Here you are. http://pastebin.com/2ab0xYti PS: If you have activated any events in your server, I would suggest you to add a few checks at the java file. There may be a misunderstanding between the name colors, if there are custom name colors at your events. Good Night.
CrazyDeagle Posted March 19, 2010 Posted March 19, 2010 Thanks you coyote this add is real good :D Good work ^^
Setekh Posted March 19, 2010 Posted March 19, 2010 cool dude.. you mind shits a lot of imagination ^^ 1 thing.. u got a lot of boolean algebra operation involving Rnd... with kinda no point >< can i give you some advice? XD
Ass4s1n Posted March 19, 2010 Posted March 19, 2010 Use switch instead of all those if's... Like switch (Rnd.get(4)) case 0: activeChar.getAppearance().setNameColor(Config.NCI_COLOR_1); activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 3)); activeChar.sendMessage("You are quite lucky, so your name color has changed. Have Fun!"); playable.destroyItem("Consume", item.getObjectId(), 1, null, false); break; P.S. Rnd.get(4) is not from 1-4, but from 0-4. You may have a unhandled value or not changing color.. :D
Loren Posted March 19, 2010 Posted March 19, 2010 cool seems nice i will try it thx coyote! u really must get +1 for your job! thx again!
Coyote™ Posted March 19, 2010 Author Posted March 19, 2010 Use switch instead of all those if's... Like switch (Rnd.get(4)) case 0: activeChar.getAppearance().setNameColor(Config.NCI_COLOR_1); activeChar.broadcastPacket(new SocialAction(activeChar.getObjectId(), 3)); activeChar.sendMessage("You are quite lucky, so your name color has changed. Have Fun!"); playable.destroyItem("Consume", item.getObjectId(), 1, null, false); break; P.S. Rnd.get(4) is not from 1-4, but from 0-4. You may have a unhandled value or not changing color.. :D nah, it's simple. Just Rnd.get(3) ;] and include case 0. Anyway, remade!
Ass4s1n Posted March 19, 2010 Posted March 19, 2010 I saw 1 more thing. How exactly are you calculating the 3rd case? I don't see anywhere something that handles the risk thingie.. EDIT: W/e im just dumb.
Coyote™ Posted March 19, 2010 Author Posted March 19, 2010 I saw 1 more thing. How exactly are you calculating the 3rd case? I don't see anywhere something that handles the risk thingie.. Well, the risk is nothing serious. There is just no name color for the player, which means that he purchased it with no reason.
Expini Posted May 4, 2010 Posted May 4, 2010 i did include that code to l2jserver but i have some bug of code at line _itemHandler.registerItemHandler(new NameColorItem()); how i can handler register NameColorItem in GameServer.Java with l2jserver if here not support for l2jserver i am sorry to post here if somebody can help for that line please tell me too thank you :D this is a good cod need keep up
+cs.tribal Posted May 4, 2010 Posted May 4, 2010 hahaha! Nice code!But one question! The the color name will still the same when the players log out and log in again?
mikrosgiwrgakis.com Posted May 6, 2010 Posted May 6, 2010 Coyote i test your code in Interlude l2jServer and i add the code perfectly without errors...i join in game to test it and i press on item and my char uses /socialvictory and in chat says "You are quite lucky, so your name color has changed. Have fun!" but my name color it doenst change...so it didnt work... any solutions? ps: i test it and with admin char and with normal char and the results its the same on both characters. EDIT: well no much time was passed from the time i added the code in my server and as i tell you i test it and it didnt work but when i use/remove a weapon/armor/skill then the color shows up... any solutions? please answer...thanks
Coyote™ Posted May 7, 2010 Author Posted May 7, 2010 Coyote i test your code in Interlude l2jServer and i add the code perfectly without errors...i join in game to test it and i press on item and my char uses /socialvictory and in chat says "You are quite lucky, so your name color has changed. Have fun!" but my name color it doenst change...so it didnt work... any solutions? ps: i test it and with admin char and with normal char and the results its the same on both characters. EDIT: well no much time was passed from the time i added the code in my server and as i tell you i test it and it didnt work but when i use/remove a weapon/armor/skill then the color shows up... any solutions? please answer...thanks It works perfectly, your character just needs a change on his appearance/inv so that you can see the colour.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now