Using DECORATE to change player class
Posted: Fri Jan 29, 2010 9:17 am
I want people to choose out of many player classes. Since the initial "New Game" playerclass submenu only supports a limited number of player classes, I'm trying to employ Strife dialog to get this done.
I'm already identifying player classes based on custom inventory items, which when I give them to the player via Strife Script, work just as intended. So, as far as my DECORATE scripts are concerned, the player acts like the playerclass I intended, since all checks are based on those class-specific CustomItems.
The problem however is getting the player morphed (permanently, as the 'choice' needs to transfer over levels). I created the following DECORATE code:
As-is, the code is fairly obvious: AllowDoomClass and AllowRottClass are items given by the Strife dialog, which would transform the player to those respected classes. In doing so, they first remove any items identifying the current class (either DoomClass or RottClass), then morph the player and add the corresponding items.
Note that I don't want to use ACS code at all, as I believe that ACS function numbers could conflict with other WADs loaded, possibly crippling their code. So unless someone can tell me that the ACS function numbers should be unique per WAD as opposed to over all loaded WADs, so that's why I want to have it in DECORATE instead.
Also, I believe morphing players permanently, transitioning over levels isn't possible. But I hope to be corrected on this.
*edit*
Just read that it's not possible to behave as a normal player when morphed (picking up items/weapons and such), so I need to go about this a different approach. Unfortunately, that'd probably mean using ACS?
I'm already identifying player classes based on custom inventory items, which when I give them to the player via Strife Script, work just as intended. So, as far as my DECORATE scripts are concerned, the player acts like the playerclass I intended, since all checks are based on those class-specific CustomItems.
The problem however is getting the player morphed (permanently, as the 'choice' needs to transfer over levels). I created the following DECORATE code:
Code: Select all
ACTOR ClearPlayerClass : CustomInventory // helper actor
{
States
{
Pickup: //remove all player classes
TNT1 A 0 A_TakeInventory ("AllowRott", 1)
// TNT1 A 0 A_TakeInventory ("RottMorph", 1)
// TNT1 A 0 A_TakeInventory ("DoomMorph", 1)
TNT1 A 0 A_TakeInventory ("AllowDoom", 1)
Stop
}
}
actor DoomMorph: PowerMorph
{
PowerMorph.PlayerClass "PL_Doom"
PowerMorph.MorphStyle (MRF_FULLHEALTH|MRF_ADDSTAMINA|MRF_LOSEACTUALWEAPON)
}
actor RottMorph: PowerMorph
{
PowerMorph.PlayerClass "PL_Rott"
PowerMorph.MorphStyle (MRF_FULLHEALTH|MRF_ADDSTAMINA|MRF_LOSEACTUALWEAPON)
}
actor AllowDoomClass : CustomInventory
{
ConversationID 312
States
{
Pickup:
TNT1 A 0 A_GiveInventory ("ClearPlayerClass", 1)
TNT1 A 0 A_GiveInventory ("AllowDoom", 1)
TNT1 A 0 A_GiveInventory ("DoomMorph", 1)
TNT1 A 0 A_GiveInventory ("Pistol", 1)
TNT1 A 0 A_GiveInventory ("Fist", 1)
Stop
}
}
actor AllowRottClass : CustomInventory
{
ConversationID 313
States
{
Pickup:
TNT1 A 0 A_GiveInventory ("ClearPlayerClass", 1)
TNT1 A 0 A_GiveInventory ("AllowRott", 1)
TNT1 A 0 A_GiveInventory ("RottMorph", 1)
TNT1 A 0 A_GiveInventory ("RottKnife", 1)
TNT1 A 0 A_GiveInventory ("RottDualPistol", 1)
Stop
}
}
Note that I don't want to use ACS code at all, as I believe that ACS function numbers could conflict with other WADs loaded, possibly crippling their code. So unless someone can tell me that the ACS function numbers should be unique per WAD as opposed to over all loaded WADs, so that's why I want to have it in DECORATE instead.
Also, I believe morphing players permanently, transitioning over levels isn't possible. But I hope to be corrected on this.
*edit*
Just read that it's not possible to behave as a normal player when morphed (picking up items/weapons and such), so I need to go about this a different approach. Unfortunately, that'd probably mean using ACS?
