QuestJS icon indicating copy to clipboard operation
QuestJS copied to clipboard

Uncaught TypeError: prototype is undefined

Open Woodhouse3D opened this issue 1 year ago • 5 comments

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.

Woodhouse3D avatar Nov 07 '24 03:11 Woodhouse3D

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

KVonGit avatar Nov 22 '24 17:11 KVonGit

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?

Woodhouse3D avatar Nov 22 '24 18:11 Woodhouse3D

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?

ThePix avatar Dec 05 '24 20:12 ThePix

interesting. I copied the library include line from the docs, so they need to be updated.

Woodhouse3D avatar Dec 05 '24 21:12 Woodhouse3D

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.

Woodhouse3D avatar Dec 05 '24 22:12 Woodhouse3D