[help] first time trying to write a c++ code (TRINITYCORE 3.3.5)[PET.CPP/PET.H] menu

Shout-Out

User Tag List

Results 1 to 2 of 2
  1. #1
    danielx's Avatar Member
    Reputation
    1
    Join Date
    Jul 2012
    Posts
    14
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [help] first time trying to write a c++ code (TRINITYCORE 3.3.5)[PET.CPP/PET.H]

    hey all!
    so basically i needs help again, i can't seems to get the whole c++ on the table its so messy and vaguely in my head.
    so pretty much i've been trying to write a code inside TC 3.3.5. and pretty much what i will do is copy pasting it but of course explaining which row SUPPOUSD to do.

    so a bit of record of what i wanted to:
    i wanted to take the hunter HAPPINESS timer and add few parameters to that, and try elaborate that for my own needs.
    its pretty much suppousd to work like that:
    each time a person get into combat and loses a certain amount of health the timer decreasing is being somehow doubled i guess.( that value is not important just the code itself)
    and another thing i did is to create another system that if the person is out of combat and then he remain Out of combat for another 35 second the timer resets back to to the maximum value.

    here's the code:
    PET.CPP
    Pet::HappinessLoss(int Mode1,int Mode2,int Mode3){

    int Mode1(){
    if (!HUNTER_PET->getVictim() && HUNTER_PET->GetHealth()*100 / HUNTER_PET->GetMaxHealth() < 80){ // Case of less then 80% hp+in combat - person loses moral slowly but it'll get rapid if loses health
    while(int m_happinessTimer= m_happinessTimer - 20){ //runs a timer, if timer ends pet gets to 0 timer - and get the diff shit
    m_happinessTimer=0;}
    }
    }
    }
    int Mode2(){
    if(!HUNTER_PET->getVictim()&& HUNTER_PET->GetHealth()*100 / HUNTER_PET->GetMaxHealth() < 50){ // Case of 50% - person loses more moral
    while(int m_happinessTimer = m_happinessTimer - 40){
    m_happinessTimer=0;}
    }
    }


    int Mode3(){
    if(int !HUNTER_PET->getVictim()&& HUNTER_PET->GetHealth()*100 / HUNTER_PET->GetMaxHealth() <= 30){ //Case of 30% - person loses moral radically
    while(int m_happinessTimer = m_happinessTimer - 60){
    m_happinessTimer = 0;}

    }
    }



    Pet::HappinessCurrent(int m_happinessTimer){ // if pet goes out of combat - it regenerates the timer back.
    if(int HUNTER_PET->getVictim()){ // if out of combat the countdown runs
    for(int resetloop = 0; resetloop != 35, resetloop++{
    m_happinessTimer = m_happinessTimer +=3000;}
    if(int !HUNTER_PET->getVictim()){ // case of getting into combat while counting it doesn't changes the timer back.
    break;}
    }
    }
    PET.H
    int HappinessLoss(int Mode1, int Mode2, int Mode3, );
    int HappinessCurrent();
    void HappinessResult();
    My apolgoies if its written morbidly bad and wrong, just trying on practise no more. not pretentending to be a programmer, but attempting to be one.

    [help] first time trying to write a c++ code (TRINITYCORE 3.3.5)[PET.CPP/PET.H]
  2. #2
    Natrist's Avatar Member
    Reputation
    11
    Join Date
    Mar 2013
    Posts
    146
    Thanks G/R
    9/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    I cleaned up your code but I'm not exactly sure what you were trying to do and there are a few typos I can't fix as I don't know what the references point to.

    PET.cpp
    Code:
    Pet::HappinessLoss(int Mode1,int Mode2,int Mode3)
    {
    	int Mode1()
    	{
    		if (!HUNTER_PET->getVictim() && HUNTER_PET->GetHealth()*100 / HUNTER_PET->GetMaxHealth() < 80)	// Case of less then 80% hp+in combat - person loses moral slowly but it'll get rapid if loses health
    			while(int m_happinessTimer= m_happinessTimer - 20)	//runs a timer, if timer ends pet gets to 0 timer - and get the diff shit
    				m_happinessTimer=0;
    	}
    }
    
    int Mode2()
    {
    	if(!HUNTER_PET->getVictim()&& HUNTER_PET->GetHealth()*100 / HUNTER_PET->GetMaxHealth() < 50)	// Case of 50% - person loses more moral
    		while(int m_happinessTimer = m_happinessTimer - 40)
    			m_happinessTimer=0;
    }
    
    
    int Mode3()
    {
    	if(int !HUNTER_PET->getVictim()&& HUNTER_PET->GetHealth()*100 / HUNTER_PET->GetMaxHealth() <= 30)	//Case of 30% - person loses moral radically
    		while(int m_happinessTimer = m_happinessTimer - 60)
    			m_happinessTimer = 0;
    }
    
    
    
    Pet::HappinessCurrent(int m_happinessTimer)	// if pet goes out of combat - it regenerates the timer back.
    {
    	if(int HUNTER_PET->getVictim())	// if out of combat the countdown runs
    		for(int resetloop = 0; resetloop != 35, resetloop++)
    			m_happinessTimer = m_happinessTimer +=3000;}
    
    	if(int !HUNTER_PET->getVictim())	// case of getting into combat while counting it doesn't changes the timer back.
    		break;
    }
    PET.h
    Code:
    int HappinessLoss(int Mode1, int Mode2, int Mode3);	// don't uppercase your variable names!!
    int HappinessCurrent();
    void HappinessResult();

    Sorry for the long wait.

Similar Threads

  1. [Bot] Need help first time to encounter this error through bot.
    By jaideleon04 in forum Pokemon GO Hacks|Cheats
    Replies: 3
    Last Post: 08-18-2016, 03:31 AM
  2. Replies: 5
    Last Post: 09-15-2009, 02:33 PM
  3. Overflowing with gold selling sites (first time buyer)
    By simmo in forum World of Warcraft General
    Replies: 3
    Last Post: 05-28-2007, 01:57 PM
  4. i just got suspended for the first time
    By tweak9969 in forum World of Warcraft General
    Replies: 8
    Last Post: 05-10-2007, 10:28 AM
  5. its my first time wanna help?.......
    By DoWhatToWho? in forum Community Chat
    Replies: 3
    Last Post: 03-20-2007, 02:17 PM
All times are GMT -5. The time now is 07:42 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search