New account registration is temporarily disabled.

MCBICK'S PROFILE

Search

Filter

The mechanics of a turn based system...

I'm currently making a plugin to change the default battle system into a turn based system where each actor(hero/monster) can only input one action until every other actor has had an action. They will take their actions in the order of their agility, if equal then priority is given to the player's actor.

What I need help with is how to implement such a system. So far I have the plugin get the agility values of every actor, then the plugin sets the ATB of the actor with the highest agility to 300,000 (full bar) and every other actor to 0 (no bar). My problem arises after said actor takes an action. I'm not sure how to keep track of the actors who have taken their "turn" and those who haven't. I'm guessing I need to use a boolean array of some kind, but I'm not sure how to implement it.

Also, If anyone knows any websites that teaches the coding of game mechanics please post links, preferably in C++.

Graphic issue with making a bridge you can walk over and under. [RMMV]

You can also put events on both sides of the bridge that change the chipset to an identical one, but the bridge pathing is changed to be overhead instead. I'm not sure how large the bridge is, but if it's really big, this way may be simpler to implement.

[RM2K3] DynRPG Compiling Error

Will do, but I might actually just make my own plugin now. While messing with the ATB plugin I noticed I could just create an addendum plugin to work in conjunction with the ATB plugin to create a turn based system.

[RM2K3] DynRPG Compiling Error

On another note, am I allowed to submit plugins that are built upon, credit included of course? I am currently adding code to the ATB Overhaul plugin to create a turn based system, but I'm not sure if I can submit my plugin if I used someones else' plugin as the base. I would credit them of course.

[RM2K3] DynRPG Compiling Error

How would I fix that? I tried deleting the old lib and getting a fresh copy of v0.30+ to replace it, but I still get the errors. I also tried directly placing the lib in code blocks and directly linking it from there, but still the same thing happens. I could just use v0.14a to make plugins, but it's quite limited compared to v0.30+.

Edit: I got less errors, but still can't compile.

obj\Release\battle_atb_overhaul.o:battle_atb_overhaul.cpp:(.text+0x1a2): undefined reference to `RPG::DStringPtr::DStringPtr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'

obj\Release\battle_atb_overhaul.o:battle_atb_overhaul.cpp:(.text+0x5e8): undefined reference to `RPG::DStringPtr::s_str()'

obj\Release\battle_atb_overhaul.o:battle_atb_overhaul.cpp:(.text+0x67a): undefined reference to `RPG::DStringPtr::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'

obj\Release\battle_atb_overhaul.o:battle_atb_overhaul.cpp:(.text+0xc96): undefined reference to `RPG::DStringPtr::DStringPtr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'

obj\Release\battle_atb_overhaul.o:battle_atb_overhaul.cpp:(.text+0xdec): undefined reference to `RPG::DStringPtr::DStringPtr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'

obj\Release\battle_atb_overhaul.o:battle_atb_overhaul.cpp:(.text+0x2e3a): undefined reference to `RPG::loadConfiguration(char*, char*)'


Edit2: I noticed this address doesn't seem right, but I'm new to code blocks so I am unsure.

Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/5.1.0/../../../../mingw32/bin/ld.exe: obj\Release\battle_atb_overhaul.o: bad reloc address 0x44 in section `.rdata'
collect2.exe: error: ld returned 1 exit status


EDIT3: I have successfully compiled the plugin. It was the compiler not being configured correctly. Thanks for your input. Hopefully I won't run into anymore issues compiling plugins.

Star_Location.png

I'm always a fan of simplicity, but this is a bit too simple. Perhaps a different color scheme would help or add more outlines to objects. The floor tiles are fine though.

[RM2K3] DynRPG Compiling Error

I did some further testing and I can compile, no problem, with DynRPG v0.14a using a different plugin, but I always get errors with v0.30+, using version-specific callbacks from that version.

[RM2K3] DynRPG Compiling Error

The original plugin won't work without DynRPG v0.30+ by: Andrew King (PepsiOtaku). The plugin references things that don't exist in the original DynRPG, v0.14a, thus can't be compiled. I am using Code Blocks with the GNU GCC compiler, linked with DynRPG v0.30+ lib.

Here's the original coding, which can't be compiled either without the same errors.
// ATB Overhaul
// by PepsiOtaku
// Version 1.6

#include <DynRPG/DynRPG.h>
#include <vector>

#define ATB_PARTY RPG::Actor::partyMember(i)->atbValue
#define ATB_MON RPG::monsters->atbValue

std::map<std::string, std::string> configuration;

int confAddValue;
int confHeroSpeedVarM;
int confBattlerStartVar;
int confMonsterSpeedVarM;
int confDefaultHeroSpeed;
int confDefaultMonsterSpeed;
int confAtbModeSwitch;
int confActiveSpeed;
int confWaitSpeed;
bool atbWait;
bool monsterAction = false;
bool confAgilMult;
bool condCheckFail;
bool preventEarlyResume = false;
bool animPlaying = false;
bool confStartInWaitMode = false;
bool confOnlyShowCommandWhenFocused = false;
bool confFixSelectionBarHeight = false;
bool speedInitialize = false;
int confFreezeSwitch;
std::string condExceptionSet;

std::vector<int> exceptionVect;

unsigned char frameTimer = 0;

bool onStartup (char *pluginName) {
configuration = RPG::loadConfiguration(pluginName);
confAtbModeSwitch = atoi(configuration.c_str());
confAddValue = atoi(configuration.c_str());
confAgilMult = configuration == "true";
confHeroSpeedVarM = atoi(configuration.c_str()); // Convert String to Int
confMonsterSpeedVarM = atoi(configuration.c_str());
confBattlerStartVar = atoi(configuration.c_str());
confDefaultHeroSpeed = atoi(configuration.c_str());
confDefaultMonsterSpeed = atoi(configuration.c_str());
confActiveSpeed = atoi(configuration.c_str());
confWaitSpeed = atoi(configuration.c_str());
confFreezeSwitch = atoi(configuration.c_str());
confStartInWaitMode = configuration == "true";
confOnlyShowCommandWhenFocused = configuration == "true";
confFixSelectionBarHeight = configuration == "true";
// get the condition exceptions
condExceptionSet = configuration;
std::string delimiter = ",";
size_t pos = 0;
int token;
while ((pos = condExceptionSet.find(delimiter)) != std::string::npos) {
token = atoi(condExceptionSet.substr(0, pos).c_str());
exceptionVect.push_back(token);
condExceptionSet.erase(0, pos + delimiter.length());
}
token = atoi(condExceptionSet.c_str());
exceptionVect.push_back(token);

return true;
}

void initializeSpeedVars(){
if (RPG::variables == 0) RPG::variables = confDefaultHeroSpeed;
if (RPG::variables == 0) RPG::variables = confDefaultMonsterSpeed;
}

// this will reset RPG::BattleSpeed. NOTE: RPG::battleSpeed is only set to 100 (default), 0 (for Wait Mode), or 75 (for Active Mode)
// onFrame only makes alterations to individual battler's ATB bars
void resumeAtb(){
if (atbWait) {
if (RPG::system->atbMode == RPG::ATBM_WAIT) RPG::battleSpeed = 100; // wait mode should stop the atb bar when heroes are selecting actions
else RPG::battleSpeed = confActiveSpeed; // active mode should still move the atb bar by the % set in confActiveSpeed (100 is the default speed)
atbWait = false;
}
}

void onNewGame(){
// initialize the master speed variables based on what's in DynRPG.ini
initializeSpeedVars();
if (RPG::switches) RPG::system->atbMode = RPG::ATBM_ACTIVE;
else RPG::system->atbMode = RPG::ATBM_WAIT;
}

void onLoadGame(int id, char *data, int length) {
// initialize the master speed variables based on what's in DynRPG.ini
//initializeSpeedVars(); // Probably shouldn't do this onLoadGame because saves might have them set to something else
// initialize the Active/Wait system based on what the ATB Mode Switch is in the save file
if (RPG::switches) RPG::system->atbMode = RPG::ATBM_ACTIVE;
else RPG::system->atbMode = RPG::ATBM_WAIT;
speedInitialize = false; // Just in case
}

bool onSetSwitch(int id, bool value) {
// if ATBmodeSwitch is on, set it to active, otherwise if off, set to wait
if (id == confAtbModeSwitch) { // this was moved from ragnadyn since it was more appropriate here
if (value) RPG::system->atbMode = RPG::ATBM_ACTIVE;
else RPG::system->atbMode = RPG::ATBM_WAIT;
} else if (id == confFreezeSwitch) {
if (value) {
// same as @halt_atb but other plugins can call it
if (RPG::system->atbMode == RPG::ATBM_WAIT) RPG::battleSpeed = confWaitSpeed; // wait mode should stop the atb bar when heroes are selecting actions
else RPG::battleSpeed = confActiveSpeed;
atbWait = true;
preventEarlyResume = true;
} else {
// same as @resume_atb
preventEarlyResume = false;
resumeAtb();
}
}
return true;
}

void initHeroSpeed() {
// Initialize hero speed variables
for (int i=0; i<4; i++){
RPG::variables = RPG::variables;
}
}

void initMonsterSpeed() {
// Initialize monster speed variables
for (int i=0; i<8; i++){
RPG::variables = RPG::variables;
}
}

void onDrawScreen() {
// This has to be onDrawScreen because F12 calls the reset game function before onFrame is called or something (fun)
if (RPG::isBattleTest && (GetKeyState(VK_F12) & 0x8000)) {
speedInitialize = false;
}
}

void onFrame (RPG::Scene scene){
if (scene == RPG::SCENE_BATTLE)
{
// Set Active/Wait if starting up a test battle
if (RPG::isBattleTest && (RPG::variables != confDefaultHeroSpeed)) {
if (confStartInWaitMode) {
RPG::system->atbMode = RPG::ATBM_WAIT; // wait mode should stop the atb bar when heroes are selecting actions
if (confAtbModeSwitch > 0) RPG::switches = false;
} else {
RPG::system->atbMode = RPG::ATBM_ACTIVE;
if (confAtbModeSwitch > 0) RPG::switches = true;
}
initializeSpeedVars();
}
// Speed initialization at start of battle
if (RPG::battleData->battlePhase == RPG::BPHASE_BATTLE && !speedInitialize) {
initHeroSpeed();
initMonsterSpeed();
speedInitialize = true;
}
if (!atbWait) { // do not do the following if the ATB bar is set to 0 or a monster is performing an action
frameTimer++;
if (frameTimer > 10)
{
frameTimer = 0;
animPlaying = false;
for (int i=0; i<8; i++)
{
if (RPG::monsters) if (RPG::monsters->animData->isAnimationPlaying) animPlaying = true;
// Heroes
if (i<4 && RPG::Actor::partyMember(i)) {
if (RPG::Actor::partyMember(i)->animData->isAnimationPlaying) animPlaying = true;
for (unsigned int j=0; j<exceptionVect.size(); j++)
{
if (RPG::Actor::partyMember(i)->conditions[exceptionVect] != 0)
{
ATB_PARTY = 0;
condCheckFail = true;
break;
} else condCheckFail = false;
}
if (!condCheckFail) // Just check this first
{
//printf("onFrame: party condition checks\n");
if ((RPG::Actor::partyMember(i)->conditions == 0 // ... the hero is alive
&& RPG::Actor::partyMember(i)->actionStatus == RPG::AS_IDLE // ... the hero is idle
&& RPG::battleData->battlePhase == RPG::BPHASE_BATTLE) // ... the hero has not yet won the battle
&& !animPlaying
// 14 is the animation id for battle won for whatever reason-- should be 11
&& !RPG::switches // Other plugins need a means of freezing battle
)
{
if (ATB_PARTY < 300000) {
if (confAgilMult == true)
ATB_PARTY = ATB_PARTY + ((confAddValue*RPG::Actor::partyMember(i)->getAgility())*RPG::variables);
else ATB_PARTY = ATB_PARTY + (confAddValue*RPG::variables);
} else {
ATB_PARTY = 300000;
}
if (ATB_PARTY < 0)
ATB_PARTY = 0;
}
}
}

// Monsters
if (RPG::monsters)
{
for (unsigned int j=0; j<exceptionVect.size(); j++)
{
if (RPG::monsters->conditions[exceptionVect] != 0)
{
condCheckFail = true;
break;
} else condCheckFail = false;
}
if (!condCheckFail) // Just check this first
{
if ((RPG::monsters->conditions == 0 // the monster is alive
)//&& RPG::monsters->actionStatus == RPG::AS_IDLE)
&& !animPlaying
&& !RPG::switches // Other plugins need a means of freezing battle
&& (!RPG::battleData->winMonTarget->choiceActive || !RPG::battleData->winPartyTarget->choiceActive
|| !RPG::battleData->winItem->choiceActive || !RPG::battleData->winSkill->choiceActive)
)
{
if (ATB_MON < 300000) {
if (confAgilMult == true)
ATB_MON = ATB_MON + (((confAddValue* RPG::monsters->getAgility())*RPG::variables)/2);
else ATB_MON = ATB_MON + ((confAddValue*RPG::variables)/2);
} else {
ATB_MON = 300000;
}
if (ATB_MON < 0)
ATB_MON = 0;
}
}
}
}
}
}
if (RPG::battleData->battlePhase != RPG::BPHASE_BATTLE) {
speedInitialize = false;
}

} else if (atbWait && scene != RPG::SCENE_BATTLE) {
resumeAtb();
frameTimer = 0;
speedInitialize = false;
}
}

void setCursorHeight(RPG::Window *&window) {
if (window) {
if (window->cursorHeight != 16) {
window->cursorHeight = 16;
window->updateCursor(window->currentChoice);
}
}
}

// anytime the battle status window refreshes
bool onBattleStatusWindowDrawn(int x, int selection, bool selActive, bool isTargetSelection, bool isVisible) {
if (confOnlyShowCommandWhenFocused) {
if (RPG::battleData->winCommand->choiceActive) {
RPG::battleData->winCommand->x = 244;
} else {
RPG::battleData->winCommand->x = 320;
}
}
if (RPG::system->scene == RPG::SCENE_BATTLE && confFixSelectionBarHeight) {
setCursorHeight(RPG::battleData->winCommand);
setCursorHeight(RPG::battleData->winItem);
setCursorHeight(RPG::battleData->winSkill);
}

if (isTargetSelection && (RPG::battleData->winMonTarget->choiceActive || RPG::battleData->winPartyTarget->choiceActive ||
RPG::battleData->winItem->choiceActive || RPG::battleData->winSkill->choiceActive)) {
atbWait = true;
RPG::battleSpeed = 0;
} else {
if (atbWait && RPG::battleSpeed == 0 && RPG::system->atbMode == RPG::ATBM_ACTIVE && !preventEarlyResume) {
resumeAtb();
if (RPG::battleData->winParty->choiceActive || RPG::battleData->winCommand->choiceActive) atbWait = true;
}
}

if ((selActive && !atbWait)
|| (atbWait && (RPG::battleData->winParty->choiceActive || RPG::battleData->winCommand->choiceActive))) {
if (RPG::system->atbMode == RPG::ATBM_WAIT) RPG::battleSpeed = confWaitSpeed; // wait mode should stop the atb bar when heroes are selecting actions
else RPG::battleSpeed = confActiveSpeed; // active mode should still move the atb bar by the % set in confActiveSpeed (100 is the default speed)
atbWait = true;
}

// if the party member dies (or has a condition with a status restriction) while the status window was open
if (selection >= 0 && selection < 4 && !isTargetSelection && selActive) {
if (RPG::Actor::partyMember(selection))
{
for (unsigned int j=0; j<exceptionVect.size(); j++)
{
if ((RPG::Actor::partyMember(selection)->conditions != 0) ||
(RPG::Actor::partyMember(selection)->conditions[exceptionVect] != 0)) {
// Nailed it!
RPG::battleData->winCommand->choiceActive = false;
RPG::battleData->winItem->choiceActive = false;
RPG::battleData->winSkill->choiceActive = false;
RPG::battleData->winMonTarget->choiceActive = false;
RPG::battleData->winPartyTarget->choiceActive = false;

RPG::battleData->winParty->choiceActive = true;
if (RPG::battleData->readyPartySlot != -1) {
//RPG::battleData->winParty->choiceActive = true;
RPG::battleData->winParty->currentChoice = RPG::battleData->readyPartySlot;
} else {
//RPG::battleData->winParty->choiceActive = false;
}
RPG::Actor::partyMember(selection)->atbValue = 0;
resumeAtb(); // resume the ATB bar
break;
}
}
}
}
return true;
}

bool onDoBattlerAction(RPG::Battler* battler, bool firstTry) {
atbWait = true;
RPG::battleSpeed = 0;
return true;
}
bool onBattlerActionDone(RPG::Battler* battler, bool success) {
if (success && RPG::system->atbMode == RPG::ATBM_WAIT) resumeAtb();
return true;
}

// do not move ATB bar when event commands are running
bool onEventCommand(RPG::EventScriptLine* scriptLine, RPG::EventScriptData* scriptData,
int eventId, int pageId, int lineId, int* nextLineId) {
if (RPG::system->scene == RPG::SCENE_BATTLE && eventId == 0) { // battle events
if (scriptData->currentLineId == 0) // when an event page starts
// *******************************************************
atbWait = true;
// *******************************************************
else if (scriptLine->command == RPG::EVCMD_END_OF_EVENT) // when an event page ends
resumeAtb();
}
return true;
}

bool onComment ( const char* text,
const RPG::ParsedCommentData* parsedData,
RPG::EventScriptLine* nextScriptLine,
RPG::EventScriptData* scriptData,
int eventId,
int pageId,
int lineId,
int* nextLineId )
{
std::string cmd = parsedData->command;
if(!cmd.compare("init_hero_speed"))
{
initHeroSpeed();
return false;
}
if(!cmd.compare("init_monster_speed"))
{
initMonsterSpeed();
return false;
}
if(!cmd.compare("condition_speed_check"))
{
// parameter 1: condition ID
if (parsedData->parametersCount >= 3 && parsedData->parameters.type == RPG::PARAM_NUMBER
&& parsedData->parameters.type == RPG::PARAM_NUMBER
&& parsedData->parameters.type == RPG::PARAM_NUMBER) {
for (int i=0; i<8; i++){
if (i<4){
if (RPG::Actor::partyMember(i)) {
if (RPG::Actor::partyMember(i)->conditions[parsedData->parameters.number] != 0)
RPG::variables = parsedData->parameters.number;
}
}
if (RPG::monsters) {
if (RPG::monsters->conditions[parsedData->parameters.number] != 0)
RPG::variables = parsedData->parameters.number;
}
}
}
return false;
}
if(!cmd.compare("halt_atb"))
{
if (RPG::system->atbMode == RPG::ATBM_WAIT) RPG::battleSpeed = confWaitSpeed; // wait mode should stop the atb bar when heroes are selecting actions
else RPG::battleSpeed = confActiveSpeed;
atbWait = true;
preventEarlyResume = true;
return false;
}
if(!cmd.compare("resume_atb"))
{
preventEarlyResume = false;
resumeAtb();
return false;
}
return true;
}

void onExit() {
exceptionVect.clear();
}

New_MON.png

That poor monster...

[RM2K3] DynRPG Compiling Error

I wanted to start making plugins for DynRPG, but I can't seem to compile an altered plugin that I messed around with. I keep getting these errors, no idea how to resolve them. I have the DynRPG lib linked. I'm sure of this because I got a host of different errors when I didn't have it linked.

Build Log;
obj\Release\main.o:main.cpp:(.text+0x1a2): undefined reference to `RPG::DStringPtr::DStringPtr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
obj\Release\main.o:main.cpp:(.text+0x1f1): undefined reference to `RPG::DStringPtr::~DStringPtr()'
obj\Release\main.o:main.cpp:(.text+0x308): undefined reference to `RPG::DStringPtr::DStringPtr(RPG::DStringPtr&)'
obj\Release\main.o:main.cpp:(.text+0x34a): undefined reference to `RPG::DStringPtr::DStringPtr(RPG::DStringPtr&)'
obj\Release\main.o:main.cpp:(.text+0x5e8): undefined reference to `RPG::DStringPtr::s_str()'
obj\Release\main.o:main.cpp:(.text+0x67a): undefined reference to `RPG::DStringPtr::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
obj\Release\main.o:main.cpp:(.text+0xc96): undefined reference to `RPG::DStringPtr::DStringPtr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
obj\Release\main.o:main.cpp:(.text+0xcf2): undefined reference to `RPG::DStringPtr::~DStringPtr()'
obj\Release\main.o:main.cpp:(.text+0xdec): undefined reference to `RPG::DStringPtr::DStringPtr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
obj\Release\main.o:main.cpp:(.text+0xe42): undefined reference to `RPG::DStringPtr::~DStringPtr()'
obj\Release\main.o:main.cpp:(.text+0x1c8b): undefined reference to `RPG::Actor::partyMember(int)'
obj\Release\main.o:main.cpp:(.text+0x1c9f): undefined reference to `RPG::Actor::partyMember(int)'
obj\Release\main.o:main.cpp:(.text+0x1cdc): undefined reference to `RPG::Actor::partyMember(int)'
obj\Release\main.o:main.cpp:(.text+0x1d69): undefined reference to `RPG::Actor::partyMember(int)'
obj\Release\main.o:main.cpp:(.text+0x1dc3): undefined reference to `RPG::Actor::partyMember(int)'
obj\Release\main.o:main.cpp:(.text+0x1dd6): more undefined references to `RPG::Actor::partyMember(int)' follow
obj\Release\main.o:main.cpp:(.text+0x1fae): undefined reference to `RPG::Battler::getAgility()'
obj\Release\main.o:main.cpp:(.text+0x2099): undefined reference to `RPG::Battler::getAgility()'
obj\Release\main.o:main.cpp:(.text+0x22b2): undefined reference to `RPG::Actor::partyMember(int)'
obj\Release\main.o:main.cpp:(.text+0x22be): undefined reference to `RPG::Actor::partyMember(int)'
obj\Release\main.o:main.cpp:(.text+0x245c): undefined reference to `RPG::Actor::partyMember(int)'
obj\Release\main.o:main.cpp:(.text+0x248d): undefined reference to `RPG::Actor::partyMember(int)'
obj\Release\main.o:main.cpp:(.text+0x2528): undefined reference to `RPG::Actor::partyMember(int)'
obj\Release\main.o:main.cpp:(.text+0x268d): more undefined references to `RPG::Actor::partyMember(int)' follow
obj\Release\main.o:main.cpp:(.text+0x2e3a): undefined reference to `RPG::loadConfiguration(char*, char*)'