Uncaught TypeError: prototype is undefined
Uncaught TypeError: prototype is undefined " SpellSummon file:///C:/Users/Chris/Downloads/QuestJS-1-44/rpg/skill.js:96 file:///C:/Users/Chris/Downloads/QuestJS-1-44/rpg/spells.js:471"
I was having issues creating skills and tried loading the rpg modules in a blank game. It seems it has a bug of some kind. I've looked into this and it seems like some kind of default spell summon creature is incorrectly defined or something.
Are you adding the files to settings.js like this?
https://github.com/ThePix/QuestJS/blob/f9680fb53365b0b79583d1cdb67e4e345a622605/game-rpg/settings.js#L9
Following the trace, it looks like prototype should be defined as long as you've also included weapons.js.
https://github.com/ThePix/QuestJS/blob/f9680fb53365b0b79583d1cdb67e4e345a622605/rpg/skill.js#L94-L96
https://github.com/ThePix/QuestJS/blob/f9680fb53365b0b79583d1cdb67e4e345a622605/rpg/spells.js#L471
https://github.com/ThePix/QuestJS/blob/f9680fb53365b0b79583d1cdb67e4e345a622605/rpg/weapons.js#L136
Yes. And I'm pretty sure I copied the include statement from the docs,
settings.customLibraries.push({ folder:'rpg', files:[ "lang-en", "rpg", "skill", "attack", "item_templates", "npc_templates", "commands", "spells", "weapons", "agenda", "quest","lists","monsters" ], })
How do i include the file if this isn't working?
The spell needs a weapon to prototype, and the prototype is defined in weapons.js.
You need to have weapons load before spells. Try:
settings.customLibraries.push({ folder:'rpg', files:[ "lang-en", "rpg", "skill", "attack", "item_templates", "npc_templates", "commands", "weapons", "spells", "agenda", "quest","lists","monsters" ], })
So this begs the question, what needs changing so it is clear to the next user?
interesting. I copied the library include line from the docs, so they need to be updated.
The spell needs a weapon to prototype, and the prototype is defined in weapons.js.
You need to have weapons load before spells. Try:
settings.customLibraries.push({ folder:'rpg', files:[ "lang-en", "rpg", "skill", "attack", "item_templates", "npc_templates", "commands", "weapons", "spells", "agenda", "quest","lists","monsters" ], })So this begs the question, what needs changing so it is clear to the next user?
perhaps there should be some sort of way to import this as a bundle so it auto-loads in order.