This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [TUTORIAL] [TrinityCore] Hunger Script  (Read 6309 times)

Blackplayer27

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 52
    • View Profile
    • http://home.pf-control.de/
[TUTORIAL] [TrinityCore] Hunger Script
« on: February 10, 2012, 12:14:11 pm »
Hello,
a frind and i script a very nice hunger Script for Trinity. The script draws from every 2 hours, 10 HP, but you can change this in the Script.

But you most set the HP.Reg on 0 for the Script.

--The text in german--
[spoiler:3p7rkjpr]Hallo zusammen,
Ein freund und ich haben zusammen einen kleinen Script geschrieben der den Hunger im Rollenspiel da stellen sollte. Der Script ist zwar nicht perfekt aber trozdem etwas. Er zieht jeden Spieler alle 2 Stunden 10 HP ab und da das HP sich nicht regeneriert müssen die Spieler in etwas essen um ihr HP wiederherzustellen.

Wenn ihr euch fragt wieso es nur 10 HP sind, auf unsern Server haben alle spieler nur 180 HP das bedeutet der Char überlebt 32 Stunden ohne Essen danach stirbt er an verhungerung.

Der Script tickt nur wenn der Char online und wenn dieser Reloggt oder ähnliches startet er nicht von neu sondern fängt dort wieder an wo er war. Aber wenn der Server restartet werden leider alle Timer zurück gesetzt.

(Falls jemand mag kann er meinen Deutschen Text vielleicht ins Englische übersetzen. Da mein Englisch so schlecht ist das ich nicht alles selbst übersetzen kann >.<)[/spoiler:3p7rkjpr]


Hi folks,
a friend of mine and me wrote together a little script which should imitate apetite in roleplaying.
The script isn't perfect but nonetheless worth something.
It reduces the player's health for 10HP every 2 hours, and as the HP doesn't regenerate itself, the player eventually has to eat something.

If you ask yourself why it is only 10 HP: on our servers, players have only 180 HP what means that the player survives 32 hours without eating,after that time he dies on starving.

The script is only active when the Character is online, if he reloggs or sth. like that, the script doesn't start counting anew but continues where it stopped.
If the server restarts , all timer get sadly resetted.



[center:3p7rkjpr]worldserver.conf[/center:3p7rkjpr]
Find:
Quote
Rate.Health            = 1

Replace it with:
Quote
Rate.Health            = 0

[center:3p7rkjpr]Word.cpp[/center:3p7rkjpr]
Quote
   m_timers[WUPDATE_CORPSES].SetInterval(20 * MINUTE * IN_MILLISECONDS);
                                                            //erase corpses every 20 minutes
    m_timers[WUPDATE_CLEANDB].SetInterval(m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]*MINUTE*IN_MILLISECONDS);
                                                            // clean logs table every 14 days by default
    m_timers[WUPDATE_AUTOBROADCAST].SetInterval(getIntConfig(CONFIG_AUTOBROADCAST_INTERVAL));
+   m_timers[WUPDATE_DAMAGEPLAYER].SetInterval(2 * HOUR * IN_MILLISECONDS);
    m_timers[WUPDATE_DELETECHARS].SetInterval(DAY*IN_MILLISECONDS); // check for chars to delete every day
Quote
       LoginDatabase.Execute(stmt);
    }

+      if (m_timers[WUPDATE_DAMAGEPLAYER].Passed())
+   {
+      for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
+      {
+         Unit* target = itr->second->GetPlayer();
+           target->DealDamage(target, 10);
+      }
+      m_timers[WUPDATE_DAMAGEPLAYER].Reset();
+   }


    /// <li> Clean logs table


[center:3p7rkjpr]Word.h[/center:3p7rkjpr]
Quote
    WUPDATE_MAILBOXQUEUE,
     WUPDATE_DELETECHARS,
     WUPDATE_PINGDB,
+   WUPDATE_DAMAGEPLAYER,
     WUPDATE_COUNT
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Steff

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 4551
    • View Profile
Re: [TUTORIAL] [TrinityCore] Hunger Script
« Reply #1 on: February 13, 2012, 12:37:52 am »
[spoiler:1bq1p1jr]Ihr wisst aber schon das man bis über 3 wochen nichts essen muss um zu überleben :) Trinken ist da was anders :)[/spoiler:1bq1p1jr]

Actually did you know that you can eat nothing for up to 3 weeks without starving :) Drinking is something else :)

And please english ;)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Please mark as solved if solved.
Don't ask if you could ask a question... JUST ask the Question.
You can send me also offline messages. I will answer if I get online.
Skype: project.modcraft
Discord: steff#6954

Eluo

  • Moderators
  • Creator of Worlds
  • *****
  • Posts: 509
    • View Profile
Re: [TUTORIAL] [TrinityCore] Hunger Script
« Reply #2 on: February 13, 2012, 01:07:01 am »
/englischifizinoiert :P

Actually Steff you can survive up to 4 weeks without eating ;)
http://de.wikipedia.org/wiki/Hungerstof ... ne_Nahrung
(german wikipedia article)

*e* nice idea anyway :D
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
One is a genius, the other\'s insane!

Keta

  • Contributors
  • Model Change Addict
  • *****
  • Posts: 210
    • View Profile
Re: [TUTORIAL] [TrinityCore] Hunger Script
« Reply #3 on: February 13, 2012, 12:41:32 pm »
But who in their right mind would DO that?! xD

Thanks
Keta
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Steff

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 4551
    • View Profile
Re: [TUTORIAL] [TrinityCore] Hunger Script
« Reply #4 on: February 13, 2012, 12:57:56 pm »
What? implement this script. Its a funny idea :) But its not realy needed to get good rp on a server.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Please mark as solved if solved.
Don't ask if you could ask a question... JUST ask the Question.
You can send me also offline messages. I will answer if I get online.
Skype: project.modcraft
Discord: steff#6954

glararan

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 162
    • View Profile
    • http://glararan.eu
Re: [TUTORIAL] [TrinityCore] Hunger Script
« Reply #5 on: February 13, 2012, 02:40:01 pm »
maybe give ressurection sick or some debuff instead of damage?
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Blackplayer27

  • Registred Member
  • Polygonshifter
  • *****
  • Posts: 52
    • View Profile
    • http://home.pf-control.de/
Re: [TUTORIAL] [TrinityCore] Hunger Script
« Reply #6 on: February 14, 2012, 11:37:00 am »
This is just a basic scaffold. You can change this script.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

MeL182

  • Registred Member
  • MS Paint Freak
  • *****
  • Posts: 3
    • View Profile
Re: [TUTORIAL] [TrinityCore] Hunger Script
« Reply #7 on: February 28, 2012, 12:51:56 pm »
Interesting idea, I'll try to make it. ideas of Implementation  a lot. :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »