Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Nostale
You last visited: Today at 05:35

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Tutorial] How to add a Kill Counter

Discussion on [Tutorial] How to add a Kill Counter within the Nostale forum part of the MMORPGs category.

Reply
 
Old   #1
 
XV50's Avatar
 
elite*gold: 100
Join Date: Sep 2019
Posts: 389
Received Thanks: 174
[Tutorial] How to add a Kill Counter

Well, i got asked a lot by people to explain how to add a Kill Counter.

It's actually easy, and sad to see that most of the "Developer" doesn't even know how to write 7 lines of code.

What it will do:
- Safe killed Monster Amount in Database
- Display killed Monster in Database
- Handle Rewards for a certain Kill Count

1. Add a new Column in DB on Character called KillCount

> Go to DAL.EF > Character.cs and add
Code:
public int KillCount { get; set; }
> Go to OpenNos.Data > CharacterDTO.cs and add
Code:
public int KillCount { get; set; }
> Go to GameObject > Character.cs and add
Code:
KillCount = input.KillCount;
> Go to the Mapper and add (x2, ToCharacter and ToCharacterDTO)
Code:
output.KillCount = input.KillCount;
2. Add GenerateKillCountBonus
> Go to GameObject > Character.cs and add whereever u want
Code:
public void GenerateKillCountBonus()
{
   switch (KillCount)
   {
      //When Character killed 100 Monsters
      case 100:
      break;
   }
}
3. Implement the Generation
> Go to GenerateKillBonus, go to #region EXP, Reputation and Dignity in GenerateKillBonus and add on top of that region
Code:
#region Generate KillCount Bonus
                if (Hp > 0 && !monsterToAttack.BattleEntity.IsMateTrainer(monsterToAttack.MonsterVNum))
                {
                    switch (KillCount)
                    {
                        case 100:
                            GenerateKillCountBonus();
                            break;
                    }
                }
                #endregion
Increase the KillCounter where ever u want. Simple way to do it is on GenerateKillBonus, for each kill.

Code:
Session.Character.KillCount++;
Done. This implementation is fairly easy and safe to use. It's simple af.



You can also check by using if statement at the end instead of case. I like this one more.

Happy leech
XV50 is offline  
Thanks
1 User
Old 03/25/2021, 23:37   #2
 
elite*gold: 0
Join Date: Oct 2018
Posts: 257
Received Thanks: 207
I never used Opennos but... Tattoo ?
Apourtartt is offline  
Old 03/25/2021, 23:41   #3
 
XV50's Avatar
 
elite*gold: 100
Join Date: Sep 2019
Posts: 389
Received Thanks: 174
Was a typo cuz i copied it.
XV50 is offline  
Old 03/29/2021, 05:05   #4

 
Singleplayer™'s Avatar
 
elite*gold: 3
Join Date: Feb 2016
Posts: 1,291
Received Thanks: 321
nice to see that someone is still sharing stuff , but i am sure 90% of the "dev´s" here still need help for that simple stuff

maybe you should explain the logic/function of "input.KillCount" , the copy/pasters here dont need this but for the 1% which want to understand it would helps maybe
Singleplayer™ is offline  
Old 03/29/2021, 06:44   #5
 
XV50's Avatar
 
elite*gold: 100
Join Date: Sep 2019
Posts: 389
Received Thanks: 174
Quote:
Originally Posted by Singleplayer™ View Post
nice to see that someone is still sharing stuff , but i am sure 90% of the "dev´s" here still need help for that simple stuff

maybe you should explain the logic/function of "input.KillCount" , the copy/pasters here dont need this but for the 1% which want to understand it would helps maybe
input just safes to the db. Otherwise it'll reset each logout because it's only safed internally.
XV50 is offline  
Reply




All times are GMT +1. The time now is 05:36.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.