Toggle Commands, Why not?

Aeryna

Moderator
Staff member
Moderator
Joined
Oct 10, 2017
Messages
359
Why not to toggle every selfbuff command like Meditate,ForceMeditate,BurstRun...
Any ideas?
 

Valkyra

Member
Joined
Aug 31, 2010
Messages
211
Look at how it's done in JediSelfBuffCommand.cpp ( I think it's called.) in the commands directory in creature.

Basically it just checks to see if the buff already exists upon command activation, with creature->hasBuff(<crc>);

So you can do different codeblock mechanics using that if else statement.
 

Aeryna

Moderator
Staff member
Moderator
Joined
Oct 10, 2017
Messages
359
Why "JediSelfBuffCommand"?. Maskscent isn't a Jedi skill. Is that command managing everything?.
 

Aeryna

Moderator
Staff member
Moderator
Joined
Oct 10, 2017
Messages
359
Ok, I was checking the "doJediSelfBuffCommand" using the "ForceRun1" file... :

The Run Buff ends when you hit again "ForceRun1" but
now i only need how to stop the visual effect when FR1 finishes.




Code:
/*
                Copyright <SWGEmu>
        See file COPYING for copying conditions. */

#ifndef FORCERUN1COMMAND_H_
#define FORCERUN1COMMAND_H_

#include "JediQueueCommand.h"

class ForceRun1Command : public JediQueueCommand {
public:

    ForceRun1Command(const String& name, ZoneProcessServer* server)
    : JediQueueCommand(name, server) {
        // BuffCRC's, first one is used.
        buffCRC = BuffCRC::JEDI_FORCE_RUN_1;

        // If these are active they will block buff use
        blockingCRCs.add(BuffCRC::JEDI_FORCE_RUN_2);
        blockingCRCs.add(BuffCRC::JEDI_FORCE_RUN_3);

        // Skill mods.
        skillMods.put("force_run", 1);
        skillMods.put("slope_move", 33);

    }

    int doQueueCommand(CreatureObject* creature, const uint64& target, const UnicodeString& arguments) const {
    int res = creature->hasBuff(buffCRC) ? NOSTACKJEDIBUFF : doJediSelfBuffCommand(creature);

        if (res == NOSTACKJEDIBUFF) {
            return doJediSelfBuffCommand(creature);
        }
        
        // Return if something is in error.
        if (res != SUCCESS) {
            return res;
        }

        // SPECIAL - For Force Run.
        if (creature->hasBuff(STRING_HASHCODE("burstrun")) || creature->hasBuff(STRING_HASHCODE("retreat"))) {
            creature->removeBuff(STRING_HASHCODE("burstrun"));
            creature->removeBuff(STRING_HASHCODE("retreat"));
        }

        // Return.
        return SUCCESS;
    }

};
#endif //FORCERUN1COMMAND_H_
 

Aeryna

Moderator
Staff member
Moderator
Joined
Oct 10, 2017
Messages
359
Hello, still requesting for an answer...
 

thrax989

New Member
Joined
May 3, 2015
Messages
14
Hello, still requesting for an answer...
Do this for Forcerun1-3

Remove this line - int res = creature->hasBuff(buffCRC) ? NOSTACKJEDIBUFF : doJediSelfBuffCommand(creature);
Update with this line - int res = doJediSelfBuffCommand(creature);

By removing the creature->hasBuff(buffCRC) ? NOSTACKJEDIBUFF : you can click the skill on or off any time making it so you can toggle it.
 

Aeryna

Moderator
Staff member
Moderator
Joined
Oct 10, 2017
Messages
359
Do this for Forcerun1-3

Remove this line - int res = creature->hasBuff(buffCRC) ? NOSTACKJEDIBUFF : doJediSelfBuffCommand(creature);
Update with this line - int res = doJediSelfBuffCommand(creature);

By removing the creature->hasBuff(buffCRC) ? NOSTACKJEDIBUFF : you can click the skill on or off any time making it so you can toggle it.

Hey Thrax. The problem isn't toggle the command but remove its ForceRun Effect while is OFF.
The code i put is to toggle forcerun1. You don't need to remove anything else.
 
Top Bottom