Re: Project ZeC (My Zelda-esque Clone)
Reply #345 –
"persist.js" questions:
Map Events:
1st - the map state. Usually named map.
2nd - the world state. Usually named world
Person Events:
1st - the person state. Usually named self.
2nd - the map state. Usually named map.
3rd - the world state. Usually named world
If I understand this correctly, 'self' refers to the actual mapname.js or would it be the mapname.rmp file because of the example. As an example using actual ZeC references...
The player enters the cave with the first sword:
//swordcave.js
({
visited: false,
enter: function (self)
{
if (!self.visited)
{
GenerateShop("OldMan", "WoodenSword");
self.visited = true;
}
},
leaveSouth: function ()
{
Warp(55, 39, 0, "south", Start);
}
})
According to that, when the player enters swordcave.rmp and already collected the sword the GenerateShop() would not process because visited is true.
What I'm hazy on is the map & world portions of the optional parameters.
talk: function (self, map, world)
What exactly do they reference? If 'self' is the map then what is 'map'? I'm not very sure about that. The wiki page doesn't really seem to explain it. Unless, I misread something. Although, I have read & reread the page a few times trying to understand the concepts before posting about it.
Also, what does 'world' set? From reading, it appears that 'world' would be used for set/getWorldState(). If that is correct, then I would need to add 'world' to the dungeon items, doors & whatever other variable setting entities I would want to add into a game save file?
Am I correct in my understanding about any of this?
"I am to misbehave." - Malcom Renyolds, Captain of Serenity