Cutstuff Forum

Mega Man 8-bit Deathmatch => Help & Editing => Topic started by: LemonPig on August 13, 2016, 10:04:33 PM

Title: I need help making a class
Post by: LemonPig on August 13, 2016, 10:04:33 PM
When i launch MM8BDM, it says my custom clas's weapon haves an unexpected 0. can someone fix this? ive tried hard, but it still dosent work.
Thanks!
Link:https://mega.nz/#!gJcURQLS
Password:!BqTx7YKj1I4xqYY0q8IC9YwmmzZph6aW_wP7FIMSuvc
Title: Re: I need help making a class
Post by: Russel on August 14, 2016, 12:10:59 AM
Simply fixing it for you wouldn't really help you if you wanted to continue developing the class, would it?
Let's see what the problem is.

Whenever Zandronum throws an error about an unexpected anything, it's because the engine thinks there should be something else there or there's something there that shouldn't be there.
It tells you which line in any given file to look at.

In this case, the actor "PhaserBoss", the weapon, is inheriting from a projectile.
As with several other things, actors are a general "object" or "box" that has certain features aligned with it.
There are different types of these "boxes" each with their different rules and features. A player can hold an inventory-type actor but not a projectile-type actor. An weapon-type actor can have certain values adjusted that other player-type actors cannot.

Weapon.ammouse is aligned with a weapon-type box. This means that anything that isn't weapon-type cannot use weapon.ammouse.
Currently the actor "PhaserBoss" set itself to be projectile-type by having the ": FastProjectile" at the end of the header.

Let's take a good look at this line of code:
Code: [Select]
actor PhaserBoss : FastProjectile 18000
Alright. The first two words are standard for creating any object.

"actor" tells the game that you're about to create a new object. This could turn out to be anything from a shoelace to Gamma's flame cannon.

"PhaserBoss" tells the game that this new actor is called PhaserBoss. Nothing else to say here, really.

The colon tells the game that you're going to be using features from another "box" or "type" of actor. This is required in making weapons and items because there are certain features in those actors that you can't access without telling the game you wish to use these "types" of objects.

Finally, we have FastProjectile. This tells the game what type of object you wanted your weapon to be. This doesn't work in the way you think. You attempted to create a FastProjectile-type actor when that isn't something you can hold in your hands. That's fine, you're just starting out.
Let's go ahead and change FastProjectile to BaseMM8BDMWep.

Code: [Select]
actor PhaserBoss : BaseMM8BDMWep 18000There we go! Now it should work fine, right?

No, actually. You applied the same thought to the copywep, which is defined later in the file. But we'll get to that in a moment, there's one more thing I need to address.

That 18000 is the number the game would use to place your weapon in a map. This means that if you were to try and make a custom map to run with your class's wad, that weapon could be placed into a map where people go walk up and get it.
This doesn't really make sense for a class weapon, so let's take that off. Hold on to that number though, cause we'll need it again in a moment.

Code: [Select]
actor PhaserBoss : BaseMM8BDMWep
Alright, so this looks correct! Let's go try to run the game.

Code: [Select]
Script error, "class.pk3:actors/classes/coolclass/coolwep.txt" line 138:
Unexpected '1' in definition of 'PhaserWep'

Uhh... Huh? It's the same error.

Nah, it's slightly different. Take a look at where the error is occurring.
Line 138 instead of line 16, the number's 1 instead of 0 and the actor is PhaserWep instead of PhaserBoss.

Fixing the issue is the same process though.

Code: [Select]
actor PhaserWep: FastProjectileThis is what we have currently, so can you figure out what needs to be done?

Yeah, change FastProjectile to BaseMM8BDMWep.
That's all that needs to be done to run the game.

This wad's also got a ton of other errors but those are primarily because the character creator base is horribly, horribly outdated. Regardless, it runs.

But there's one more thing I wanna do with this before we close up.

Remember that 18000 earlier? The thing that would allow you to place a weapon into the map?

Let's put that at the end of PhaserWep so we can place the Mega Man copy weapon onto a map.

Code: [Select]
actor PhaserWep : BaseMM8BDMWep 18000
Perfect.



I hope this helped and didn't feel too insulting. I know little about you and wanted to try and step you through the problem rather than posting a wad with else done.
If you have any other problems, feel free to ask. I'll probably try and post an updated character creation wad that works properly with version 5.


Title: Re: I need help making a class
Post by: LemonPig on August 14, 2016, 06:38:18 PM
Thanks lego  :) it worked, now I MUST MAKE MOAR CLASSES WITH THE TEMPLATES AWSUMWEAPON XD