- Joined
- Mar 9, 2017
- Messages
- 34
- Reaction score
- 4
- First Language
- English
- Primarily Uses
- RMMV
After taking a few days to ensure that the necessary objects are working properly, I've run into problems adding a variable to Game_Party to keep a glossary of important information in RPG Maker MV.
The idea is that I should be able to access the new variable via the Script command in events to add new items to it, edit existing items, and check if certain items are present in the list; once I've got the list working properly I'll migrate everything into Plugin commands to streamline everything, but at present the list does not seem to successfully bind to the Game_Party prototype.
I've already verified that the intelList and intelItem object prototypes (defined in a separate file for the moment) are working properly, so I must be doing something wrong/forgetting something with the redefinitions.
Attempting to run this script causes a game crash on execution (TypeError: undefined is not a function), which I'm assuming means that $gameParty.addIntel is not being successfully applied.
Now, I have two questions:
The idea is that I should be able to access the new variable via the Script command in events to add new items to it, edit existing items, and check if certain items are present in the list; once I've got the list working properly I'll migrate everything into Plugin commands to streamline everything, but at present the list does not seem to successfully bind to the Game_Party prototype.
I've already verified that the intelList and intelItem object prototypes (defined in a separate file for the moment) are working properly, so I must be doing something wrong/forgetting something with the redefinitions.
Code:
//Attach IntelList to the Party object on initialization.
Game_Party.prototype.initialize = function() {
Game_Unit.prototype.initialize.call(this);
this._gold = 0;
this._steps = 0;
this._lastItem = new Game_Item();
this._intelList = new intelList();
this._menuActorId = 0;
this._targetActorId = 0;
this._actors = [];
this.initAllItems();
};
//Methods for accessing data from intelList
//Returns the categories
Game_Party.prototype.getIntelCategories = function() {
return this._intelList.intelCategories;
};
//Return all Intel items in the list.
Game_Party.prototype.getAllIntel = function() {
return this._intelList.intelItems;
};
//Used for event flags.
Game_Party.prototype.hasIntel = function(targetIntel){
return this._intelList.hasIntel(targetIntel);
};
//Return all Intel items with the specified category.
Game_Party.prototype.getIntelFromCategory = function(category) {
return this._intelList.getIntelFromCategory(category);
};
//returns a string for an in-game message if the intel was added successfully.
Game_Party.prototype.addIntel = function(targetIntel){
return(this._intelList.addIntel(targetIntel));
};
Code:
var newIntel = new intelItem("Places", "Chi Bi",
["A small fishing villiage located on the southern cliffs of the Song Empire. Its name translates roughly to 'red stone', in refference to the dusty redstone cliffs the city was built upon.",
"Chi Bi was once a major waypoint between the Jing providences of the central and Eastern empire, and the various kingdoms to the north. After the establishment of a more accessable port on Wei Zhou island the city's economic power quickly dwindled. Today most of its residents are either fisherfolk or subsistance farmers."]);
$gameParty.addIntel(newIntel);
Attempting to run this script causes a game crash on execution (TypeError: undefined is not a function), which I'm assuming means that $gameParty.addIntel is not being successfully applied.
Now, I have two questions:
- Why isn't this working as expected, and how do I fix that?
- Is there a better place to define/attach intelList?
Last edited:
