New account registration is temporarily disabled.

MCBICK'S PROFILE

Search

Filter

[RM2K3] Decreasing attributes

author=Dyhalto
This is bizarre. I just tested exactly what you screencapped, and it worked fine. No Influence points needed.
I'm confused as to what the source of the problem was :|
I'm not sure. I think this has happened to me before too, but the issue fixed itself. I use rm2k09 ultimate editor and sometimes it bugs out, so perhaps that was the issue. It sometimes will say something is ticked, but it actually isn't which could have been my issue here.

[RM2K3] DynRPG Compiling Error

I finally finished my plugin, at least the first version of it. It is still missing quite a few features, but at least I now have a solid foundation to build upon in the future when I add the rest of the features. I'm just doing some last minute crash testing and then I will submit it. It likely won't be bug free as there are way too many things to test for in the default battle system, so I will have to rely on people's feed back for future bug fixes.

[RM2K3] Decreasing attributes

author=pianotm
Try setting your Attack Influence to max. Also, you should be calling Frizz from conditions. Can you do that? Conditions and Attributes are States and Attack Elements for me.

Please note that you can't "inflict" attributes. You want to be able to "inflict" frizz.

Wow, that actually worked, even setting it to 1 Attack influence it still works. I wonder why it needs an Attack influence to work. Thanks!

I am not sure what you mean by calling Frizz from conditions. I am trying to increase the damage of Frizz attribute skills that my party members do to enemies.

[RM2K3] Decreasing attributes

I have the reduce resist button checked and I am trying to reduce the attribute(not condition) of Fire. I have made sure the attribute is not weapon type, but magic type.

The attribute Frizz is a fire type magic.

[RM2K3] DynRPG Compiling Error

author=Kazesui
if(!myImage["winStats"]){
    myImage["winStats"] = RPG::Image::create(320, 64);
    myImage["winparty"] = RPG::Image::create(320, 64);
    ...
    myText["winStats"] = RPG::Image::create(160, 16);
    ...
}
I didn't think of that, I will implement that for sure. Ideally I would like to load all the objects once at startup, but for some reason the game just won't run when I do that. It is also useful to see all the objects in my functions while working on them as I can easily edit them on the fly without switching to different headers.

On another note is there any good way to sort learned skills? For example this:
//I get the current skill selected in the skill window here.
//I have to some how differentiate the different skill types here.
//The winSkill->currentChoice is shared with all skill types, in my case
//I have 2, skills and spells. learnedSkills is stored as a first in first out
//array, so there is no easy way to sort the different types. This results
//in incorrect skill descriptions being displayed in my plugin.
RPG::Actor::partyMember(CBS::currentBattler)->learnedSkills[RPG::battleData->winSkill->currentChoice]
//Refresh my text Image
myText["winDescription"]->clear();
//Write the skill description onto the text image
myText["winDescription"]->drawString(8, 8, RPG::skills[n]->description, 1);
//Draw the text on screen
RPG::screen->canvas->draw(0, 0, myText["winDescription"]);
As it is now, I might have to remove this feature which is unfortunate because I discovered a graphical glitch in rm2k3, outside of DynRPG, that this feature was hiding. If you select a skill to target a monster and then cancel before selecting a monster and then repeat the process again, the winParty and winPartyTarget window will not be redrawn causing it to become blank with no HP/MP/ATB showing on screen. I've tried to fix this, but these window objects aren't easy to manipulate, so I had to forgo manipulating them.

Edit: I solved my issue.

[RM2K3] DynRPG Compiling Error

author=Kazesui
You're half right. That you cannot declare the same key twice is true, but a declaration of the key is actually only done the first time. If you would use the "insert" method, it would probably have failed, but not when using the subscript operator (the square brackets). What actually happens is that when you use this, it will first check if a key exists for they key you give, and if it does not exist, it will create a key. This is what happens the first time, but the second time it just gives you access to the pointer variable without trying to create another key.
I will have to be careful of this in the future then.


author=Kazesui
You sure you remembered to make "image" an RPG::Image* rather than an RPG::Image?
I stand corrected, I did not declare the variable as a pointer which was the issue.


author=Kazesui
I'm going to assume that the std::maps are global and that the ifs are within a callback function (I believe it should crash if this was all global). There's no need for the if statements at this point, since the keys can't exist at the point of the check, and as long as you're not using a callback which is called multiple times (which you shouldn't anyway for something meant to be allocated once like here). Apart from that, as mentioned, this should be fine.
Your assumption is correct, they are all global maps. The if statements exist within battle callbacks. The reason for this is it makes it easier for me to see all the objects used within my functions. I could move them all to the onInit callback, but it can get annoying going back and forth between the callback and my function when editing my function to have more objects. Also I believe I tried that before and the game would not run upon execution. It would attempt to run and then close out right away. I think the object's class, ie RPG::Image, was not loaded yet when I was trying to declare my keys.

Is there a reason I can't include the if statements in a callback that is called multiple times? From my understanding nothing will happen, at worst it will check a single line of execution. I think the battle callbacks are only called 30 times a second, so that means the callback will be called 30 times a second? This seems quite negligible as even the weakest CPUs could run millions of lines of code a second.

[RM2K3] DynRPG Compiling Error

std::map<int,RPG::Image*> images;
images[0] = RPG::Image::create();
images[0] = RPG::Image::create(); //A crash should happen here
RPG::Image::destroy(images[0]);
From what I studied this should not work. At least from my understanding you can not declare the same key twice, but perhaps I misunderstood this?


author=Kazesui
You do not need the std::map data structure to use the if check. To be honest, if you have two static images which you use and you don't loop through a for loop anyway, it would generally make sense to give them more specific names and use them directly as a variable
Yes, I have learned this upon cleaning up my code. I have kept the map structure only for any HUD text now, but have since changed the objects for the window graphics to each have their own variable.

author=Kazesui
The default battle system just doesn't make this easy.
This is an understatement. I can't tell you how many times I had to recode my plugin to take into account how the default battle system handles their window objects. I still don't completely understand how they are handled, but I have managed to manipulate them enough to do what I want, after much testing, emphasis on "must." Some of them just will not cooperate with you and I had to either hide them and create my own window to replace it entirely or omit the feature from the battle system. For example I originally wanted to do a turn based system where you gave commands to your entire party before any actions took place, but this proved to be impossible as there were many bugs that came along with this method, especially with window objects. So now my current plugin has each battler takes a single turn based on the order of their agility until each battler has taken a turn and then the round is cycled over.

I've based my battle system off of Dragon Quest XI's battle system for a lot of things. Considering you can easily make a Final Fantasy type game with rm2k3 and I always wanted to make a Dragon Quest type instead, I ended up basing the battle system on that instead. Future installments of my plugin might see the function of a message box that describes each action taken, similar to Dragon Quest. For now such a feature is met with many issues like the game being unable to give me the amount of damage dealt, although this could be circumvented, but there are many issues like this.

author=Kazesui
RPG::Image* image;
image = RPG::Image::create();
if(!image) //Error cannot convert image from RPG::Image to type bool.
    image = RPG::Image::create();
RPG::Image::destroy(image);
I'm not sure how this is supposed to work as the if condition will always be false and the destroy function will always be called immediately after creating the Image. Also this does not compile. This is what I ended up doing to make things cleaner in my script.
std::map<std::string, RPG::Image*> myImage;
std::map<int, RPG::Image*> myText;
if(!myImage["winStats"])
    myImage["winStats"] = RPG::Image::create(320, 64);
if(!myImage["winParty"])
    myImage["winparty"] = RPG::Image::create(320, 64);
...
if(!myText["winStats"])
    myText["winStats"] = RPG::Image::create(160, 16);
...
I have no destroy functions as the code will never create multiples of the same Image objects.

[RM2K3] DynRPG Compiling Error

So I did misunderstand, sorry about that. I believe with the map function it is impossible to have multiples of the same key too, so this should protect me from memory leaks too.

I have fixed and cleaned up much of my code and I am almost ready to release the first version of my plugin. I just have to fix a graphical issue and adjust a timing issue with the menuing between battler turns and I should be good.

I think I know why there aren't really any plug-ins that change the default battle system though. There are many issues with the order in which rm2k3 changes battle variables and such. I would have been better off just making my battle system exist independently from the default battle system. Unfortunately that would mean the removal of battle events as well unless I really went out of my way to parse monster group pages and battle events, which would be very time consuming.

Also Kazesui I took your advice for creating custom battle damage algorithms. Now when a battler acts their action is changed to a skill that is altered on the fly with a custom damage algorithm. This method worked great and there only seems to be one issue with it that I found and that is when the player spams the decision key to exist the action window, that window that says what skill is being used, can cause issues with some of my code. I am still deciding if I should disable the player from closing that window or not. If I do then the wait time between each battlers action will become longer. I'll have to do some experimenting.

[RM2K3] DynRPG Compiling Error

So theoretically something like this should be fine right?
if(!winMonSelect[0]) //Load Window Image
        {
            winMonSelect[0] = RPG::Image::create();
            winMonSelect[0]->loadFromFile(filePath[0]);
            winMonSelect[0]->useMaskColor = true;
        }
if(!winMonSelectText[0]) //Load Text Image
        {
            winMonSelectText[0] = RPG::Image::create(320, 80);
            winMonSelectText[0]->setSystemPalette();
            winMonSelectText[0]->useMaskColor = true;
        }
...
If I run this code only once at start up will there ever be a need to destroy these objects as they will automatically be destroyed at shut down and won't ever create duplicates? As it is now I can destroy them after every battle, but I am just curious if there is a need to since these objects should only ever be created once unless I am misunderstanding something.

Kazesui, could you clarify this?
author=Kazesui
Note that if you assign RPG::Image::create() to a pointer variable before having used destroy on the previous image (assuming there was one), you will have a memory leak since none of the other methods will fully deallocate the memory.
This does not appear to be true as I have created multiple Image objects without ever destroying them only to later destroy them, usually in a different callback. I haven't had any memory leaks and I have been checking constantly for them to be sure. Perhaps I am misunderstanding what you mean though? This is the method I used to destroy said Image objects:
void destroyImages() //Checks and destroys any existing Image objects
    {
           if(myImage[0])
           {
               RPG::Image::destroy(myImage[0]);
               myImage[0] = NULL;
           }
           if(myImage[1])
           {
               RPG::Image::destroy(myImage[1]);
               myImage[1] = NULL;
           }
           for(int i=0; i<8; i++)
           {
               if(myText[i])
               {
                   RPG::Image::destroy(myText[i]);
                   myText[i] = NULL;
               }
           }
    }


On another note, does anyone know why this happens?
//Example 1
bool onDrawBattleActionWindow(int * x,
                              int * y,
                              int  	selection,
                              bool  selActive,
                              bool 	isVisible)
{
    //Attribute(2) has the values 0, 25, 50, 75, and 100 in descending value.
    int resist = RPG::Actor::partyMember(0)->getAttributeResist(2); //Actor's resist is C or 50
    RPG::variables[801] = resist; //This value becomes 50 which it should
    return true;
}
//Example 2
static int resist;
bool onDrawBattleActionWindow(int * x,
                              int * y,
                              int  	selection,
                              bool  selActive,
                              bool 	isVisible)
{
    //Attribute(2) has the values 0, 25, 50, 75, and 100 in descending value.
    resist = RPG::Actor::partyMember(0)->getAttributeResist(2); //Actor's resist is C or 50
    RPG::variables[801] = resist; //This value becomes 0 which is wrong.
    return true;
}
Using the getAttributeResist() function seems very broken. Depending on the type of variable I use to store the value returned from the function and which callback I use the function in, it either does one of four things; return a value from 0-4(representing elements A-E), return a value of 0, return a value of the damage multiplier before calculating equipment/skill bonuses, or returns the correct damage multiplier. Using if statements or trying to store the value in a global variable or array seems to break the function. Am I doing something wrong or is the function bugged?

[RM2K3] Decreasing attributes

When I try to create a skill that reduces an attribute and deals no damage or other effect, the skill always misses in battle. The attribute that it reduces is a magic type attribute and the influence bars are set to 0. If I add damage to the skill,it will work, but it still won't reduce the attribute ever, but it will still deal damage. I have tried changing the skill settings and nothing I do seems to work. I have tried it on a fresh game, but I still cannot get the skill to reduce the attribute, does anyone know what is wrong?

Something to note is that the monster has a C resistance to the attribute that the skill is trying to reduce and it has not had its attribute resistance increased or decreased prior to the skill being used on it.