Jump to content

[Share]Name Color Item (Random Choice).


Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 1 month later...

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...