Jump to content
  • 0

Custom Zone (Random Race Display)


Question

Posted (edited)

Hello.

 

I created a custom zone. And I edited the charinfo, so when a player enters the zone his/her name will be "Unknown".

 

However, my problem is that the system damage message still displays the original name of the characters. (I guess becuase the changes in charinfo only affect the client and the server still recognize the character's origianl name).

 

My question is: what should I edit or change in order to have the system message display "unknown" instead of the original names?

 

I know i could create new system messsages (instead of $c1 done $s3 damge $c2 to unknown done $s3 damage to unknown) but I'd rather avoid this if theres a better way.

 

 

EDIT:

 

Does anybody have any suggestion, ideas how could I make  Random Race displayed in a specific zone for players?

 

Either in Charinfo, or some other working method would be great.

 

Thank you.

 

 

P.S: Im using High Five latest rev.

Edited by Horse

Recommended Posts

  • 0
Posted (edited)
getAntifeedTemplate() != null 

wherever it's needed, because it is null the majority of time, and not null only for events. As you use the packets both for events and regular, it needs a null check, until you initialize it with a default template and avoids to null it after the event as you currently do.

 

PS : easiest would be to initialize and get same template for everyone. That avoid your do/while loop for race, that avoid to generate shitloads amount of pointless templates, that avoid to get NPE checks. You initialize a static template and refers to it everytime you need it ; can't be null, single object, best performance.

 

First of all, thank you for the little explanation. For me who has just started to get into "coding and java"  a few weeks ago, these tiny explonations help me to understand a whole lot about how java works.

 

On topic: I've added the null checks. This solved the npe errors that i got when i entered the custom zone where I d like to apply the race change.

 

However, currently i get no errors at all, but once i recall or enter with a second char to the zone i see the original template.  (the name change works as it should along with the system message (unknown hit unknown for xxx damage) without the need to edit systemmessage.dat directly, which is a blessing.

 

I assume that something might be wrong with the createRandomAntifeedTemplate(). So, I'm still keep trying.

 

 

You mentioned to get a given/same template for everyone. Originally this was my idea as well, however due to the lack of my knowladge or experience with l2 java, I wasn't able to figure it out, how can I pick a certain template.

To my understanding, the antifeed method which I tried to adopt uses values of the classid to verify the temlate (if im not mistaken). But this is where I'm stuck, becuase I do not know how can I get  (a) certain template(s).

 

An exemple or hint like: getting the template of "orc fighter" for each class would be very helpful.    (I find exemples the best way to learn).

 

 

In any case, thank you for the help you've already provided, it sure is useful.

Edited by Horse
  • 0
Posted (edited)

Short but gold : almost everything exists already on sources. EVERYTHING. If you don't know how to make something, be sure it already exists, on a form or another. 99,9% of time.

 

Case of templates : when you login with your player, you're (logically, as you already understand the trick with edit race template) associated with a template. According to you, is that template generated with your player instance... Or is it preloaded from static XMLs, stored on static maps and simply "pulled out" on demand ? You already know than players use PcTemplate as type of template, a simple search over sources will get you :

  • (first search with "PcTemplate" keyword) CharTemplateTable holds PcTemplate on a Map<Integer, PcTemplate> internally named _templates, but publically accessible with getter getTemplate(int/ClassId) - so a CharTemplateTable.getInstance().getTemplate( will load you the given template.
  • (another search with "CharTemplateTable.getInstance().getTemplate(" keyword) CharTemplateTable.getInstance().getTemplate( is used 16 times over (aCis) sources : character creation packets (we don't care), and 5 uses on L2PcInstance. If you got an issue with templates those 5 occurences need to be checked and eventually overidden by your own event template. Because both templates exist, and the reference template is and stay the base template.

The fact than you edit the template at a moment M doesn't mean the template is now the one you gave. It stills reference to base template. If you don't say "I'm on an event, please keep the given template for all scenarios until I give another order" it simply uses the one registered. Exactly like player name.

Edited by Tryskell
  • 0
Posted (edited)

Short but gold : almost everything exists already on sources. EVERYTHING. If you don't know how to make something, be sure it already exists, on a form or another. 99,9% of time.

 

Case of templates : when you login with your player, you're (logically, as you already understand the trick with edit race template) associated with a template. According to you, is that template generated with your player instance... Or is it preloaded from static XMLs, stored on static maps and simply "pulled out" on demand ? You already know than players use PcTemplate as type of template, a simple search over sources will get you :

  • (first search with "PcTemplate" keyword) CharTemplateTable holds PcTemplate on a Map<Integer, PcTemplate> internally named _templates, but publically accessible with getter getTemplate(int/ClassId) - so a CharTemplateTable.getInstance().getTemplate( will load you the given template.
  • (another search with "CharTemplateTable.getInstance().getTemplate(" keyword) CharTemplateTable.getInstance().getTemplate( is used 16 times over (aCis) sources : character creation packets (we don't care), and 5 uses on L2PcInstance. If you got an issue with templates those 5 occurences need to be checked and eventually overidden by your own event template. Because both templates exist, and the reference template is and stay the base template.

The fact than you edit the template at a moment M doesn't mean the template is now the one you gave. It stills reference to base template. If you don't say "I'm on an event, please keep the given template for all scenarios until I give another order" it simply uses the one registered. Exactly like player name.

Thank you once more, for the detailed explanation. Once I get home, I'll take a closer look at the things you wrote.

 

"CharTemplateTable.getInstance().getTemplate(" keyword) CharTemplateTable.getInstance().getTemplate( ---->this far I got, and more or less understood it on my own. But i wasn't sure what holds the template's themselves since it's a bit different in hi5. But I'm beginning to understand how it works.  P.S In my case there is no charTemplateTable (newer hi5 versions have this stored in some other file i assume---most likely this will be the problem).

Edited by Horse
  • 0
Posted (edited)

Basically said, search wherever L2PcTemplate is used. I gave you exemples based on aCis / IL. L2PcTemplate still exists on latest L2J sources, so...

I cleaned up and changed the method of getAntiFeedTemplate(), I picked a specific template (elvenfighter) for starters. And it seems to be working fine.

 

All that's left is to make it pick random IDs from  my own random list with Rnd.

 

Thanks a lot, Tryskell.

 

 

 

P.S : This is just a slight cosmetic issue. When an other char enters or leaves the zone ( where i applied the custom template) by simply walking out and in (NO TELEPORT), the template changes only when the character gets hit or affected by skills or some action. (ofc when it is teleported it display the changed template, so you see the new template already.  I was just wondering if the template change could be seen automatically by simply walking inside the zone.

Since, most of the time this zone and zones alike will be accasabble by teleport, or will be used as event zones it isn't that much of an issue. But I'm curious if there is some kind of way to fix that.

Edited by Horse
  • 0
Posted

Sounds like missing broadcast. Are you using decayMe, spawnMe, broadcast? Thats the order, I guess, when you change class with gm command. Do the same.

  • 0
Posted

How is your zone onEnter / onExit ? If it's not yet handled here, it should. If it is, then it's like SweeTs said.

Yes. It wasn't handled there. Now it seems to be fine.

 

Thank you guys.

 

 

 

Topic can be locked.

Guest
This topic is now closed to further replies.


  • Posts

    • I would like to know about the Acis base of the data pack I use. The server source and server file could not find that information. I respectfully ask for the help of masters.🥲
    • discord - adver745645   https://t.me/adenala2   THERE ARE A LOT OF ADEN AT A VERY GOOD PRICE!!! HURRY  
    • Artificial Intelligence for all Chronicles. Developed in L2 HighFive branch since 2023 but it can be adapted to any project including Fand-C, aCis, Frozen, Scripts even compiled projects such as Lucera with some aditional cost.   Features:  1. Grouped of templates to create your own BOT (including skill, items, appearance, sex e.t.c.) 2. Bot can participate in Olympiad (+ any event with extra cost base on your event engine) 3. Bot walk nearby NPC to receive buff, receive equipment and teleport to any other area 4. Bot will accept party & clan invitation and follow party leader to wherever he go including teleport 6. Bot will trade player back dropped items from PK or fallen Raid Bosses after they visit a peace zone 7. Bot will open store and sell configurable item in configurable prices to players. 8. Bot will attack and cast spells in a realistic way. All classes are used including buffers, summoners, bishops e.t.c. 9. Buffer and bishops will cast buff to party members when player has no available or overriden buffs. 10. Bot will enchant their equipent and re-purchase upon failure. Their weapon will also switched between hero weapon and retail weapon when they need to. 11. Bot can move in complex map system and find monsters or players but they can also follow routes for specific paths using configurable XML if you want to.   Preview of some features: Olympiad Trade Store PvP   Example of a single configurable template in XML: https://pastebin.com/RXZVGCfA   Price: 270 Euro (Compiled) - 450 Euro (Source)    Contact Me Discord: https://discord.gg/gKAsAhJNuq MaxCheaters: https://maxcheaters.com/profile/243647-out-of-time/ Gmail: l2outoftime@gmail.com RCS Message: +30 698 740 8501  
    • Good day! Due to the increasing number of questions, "Do you provide services for the client?" - I decided to answer with a separate topic. I provide services for editing/modifying the client and individual files, namely: 1. Transfer/Creation/Editing locations, geodata.   2. All kinds of work with NPCs, including transfer, animation, adding effects to them and logos.   3. Actually, Transfer/Creation/Edit any EFFECTS, including Abnormal Effects.   4. Any work with weapons, armor, accessories and everything related to it.   5. Create or edit textures, including dynamic textures.   6. Creating a Lobby Screen, Lobby Char Selection (character selection window) and Lobby Char Creation (character creation window). What I don't do: 1. Coding in any form (except for CB).   I started publishing my work recently, here - YouTube And here - RuTube If required, I respect confidentiality. Any other questions? Welcome to Telegram or PM.
  • Topics

×
×
  • Create New...