Making Ladders with ACS and Decorate

OK, so the first thing I have here is my PlayerMorph actor in Decorate

 

actor PlayerClimber: DoomPlayer //Or whatever class that is your playerpawn
{
Player.ForwardMove 0
Player.SideMove 0

+NOGRAVITY
-TELESTOMP
states
{
spawn:
    PLAY A 2
    goto Spawn2
spawn2:
    PLAY A 4
    loop
}
}

 

now i have my playermorph powerup

 

actor PlayerClimbMorph: PowerMorph
{
PowerMorph.PlayerClass "PlayerClimber"
PowerMorph.MorphFlash "NoFlash"
PowerMorph.UnMorphFlash "NoFlash"

PowerUp.Duration -0x7fffffff
}

/////////////
//This is for morphing without a flash
/////////

actor NoFlash
{
states
{
spawn:
    TNT1 A -1
    stop
}
}

 

If you want to create an animation of the player grabbing onto the ladder then the flash can be used for the morph flash.

 

the last thing in decorate is the morphweapon which is what is used to have the player move up or down the ladder.

 

actor Climb: weapon //in this one i had added a flashlight ability onto the player (another work in progress im making) and i added a reload ability so the player can
{                            ///// remove the power morph ability and essentially "let go" of the ladder
+WEAPON.NOALERT
states
{
select:
    goto Ready
deselect:
    goto Ready
ready:
    TNT1 A 0 A_JumpIfInventory("FlashLight", 1, "ReadyLight")
    TNT1 A 0 A_JumpIfInventory("Reloader", 1, "Reload")
    TNT1 A 0 A_WeaponReady
    TNT1 A 1
    loop
    
ReadyLight:
    TNT1 A 0 A_FireCustomMissile("FlashLightPlacer", 0, 0, 0, -25, 48)
    TNT1 A 0 A_JumpIfInventory("Reloader", 1, "LightReload")
    TNT1 A 0 A_WeaponReady
    TNT1 A 1
    goto Ready
    
Fire:
    TNT1 A 0 A_JumpIfInventory("FlashLight", 1, "LightFire")
    TNT1 A 1 ThrustThingZ(0, 8, 0, 0)
    TNT1 A 2 A_ReFire
    goto Ready
    
LightFire:
    TNT1 A 0 A_FireCustomMissile("FlashLightPlacer", 0, 0, 0, -25, 48)
    TNT1 A 1 ThrustThingz(0, 8, 0, 0)
    TNT1 A 2 A_ReFire
    goto Ready
    
AltFire:
    TNT1 A 0 A_JumpIfInventory("FlashLight", 1, "LightAltFire")
    TNT1 A 1 ThrustThingZ(0, -8, 0, 0)
    TNT1 A 1 A_ReFire
    goto Ready
    
LightAltFire:
    TNT1 A 0 A_FireCustomMissile("FlashLightPlacer", 0, 0, 0, -25, 48)
    TNT1 A 1 ThrustThingz(0, -8, 0, 0)
    TNT1 A 0 A_FireCustomMissile("FlashLightPlacer", 0, 0, 0, -25, 48)
    TNT1 A 1 A_ReFire
    TNT1 A 0 A_FireCustomMissile("FlashLightPlacer", 0, 0, 0, -25, 48)
    goto Ready
    
Reload:
    TNT1 A 0 A_JumpIfInventory("FlashLight", 1, "LightReload")
    TNT1 A 0 A_TakeInventory("Reloader", 1)
    TNT1 A 1 A_ChangeFlag(NOGRAVITY, 0)
    TNT1 A 0 ACS_Execute(244, 0, 0, 0, 0)
    TNT1 A 1 A_TakeInventory("PlayerClimbMorph", 1)
    TNT1 A -1
    stop
    
LightReload:
    TNT1 A 0 A_FireCustomMissile("FlashLightPlacer", 0, 0, 0, -25, 48)
    TNT1 A 0 A_TakeInventory("Reloader", 1)
    TNT1 A 1 A_ChangeFlag(NOGRAVITY, 0)
    TNT1 A 0 A_FireCustomMissile("FlashLightPlacer", 0, 0, 0, -25, 48)
    TNT1 A 0 ACS_Execute(244, 0, 0, 0, 0)
    TNT1 A 1 A_TakeInventory("PlayerClimbMorph", 1)
    TNT1 A 0 A_FireCustomMissile("FlashLightPlacer", 0, 0, 0, -25, 48)
    TNT1 A -1
    stop
}
}

 

Now moving on to ACS, this one is a bit tricky because I have different values because I've been working on other things in the game such as armor and health statuses.

Basically there are scripts that are going to record how much armor the player has BEFORE morphing then they do some math work to pass those values onto the morphed player.

 

int ArmorAmount;
int SecurityMorphArmor;
int CombatMorphArmor;
int ChargeMorphArmor;
int DemolitionMorphArmor;

int PlayerPitch;

 

 

script 5 (void)
{
if(getactorz(0) < x) // x being what ever value your player is at when you approach your ladder, you can make it whatever you want, mine is basically the bottom rung of
{                           ///my ladder
print(s:"fire to climb up and alt fire to climb down and reload to let go.");
acs_execute(245, 0, 0, 0, 0);
PlayerPitch = GetActorPitch(0);
delay(1);
giveinventory("PlayerClimbMorph", 1);
setactorpitch(0, PlayerPitch);
delay(1);
if(checkinventory("greenbar"))
    {
    giveinventory("SecurityArmor", 1);
    delay(1);
    takeinventory("Armor", SecurityMorphArmor);
    }
if(checkinventory("bluebar"))
    {
    giveinventory("DamagedArmor", 1);
    delay(1);
    takeinventory("Armor", CombatMorphArmor);
    }
if(checkinventory("redbar"))
    {
    giveinventory("DemolitionArmor", 1);
    delay(1);
    takeinventory("Armor", DemolitionMorphArmor);
    }
if(checkinventory("bluearmorcheck"))
    {
    giveinventory("Charge", 200);
    delay(1);
    takeinventory("Armor", ChargeMorphArmor);
    }
acs_execute(244, 0, 0, 0, 0);
acs_execute(13, 0, 0, 0, 0);
}
else //this script also lets the player "let go" of the ladder
{
takeinventory("PlayerClimbMorph", 1);
setplayerproperty(0, 0, PROP_FLY);
acs_execute(244, 0, 0, 0, 0);
}
}

 

this script is whats doing the math

 

int Health;

script 245 open
{
Health = getactorproperty(0, APROP_HEALTH);
ArmorAmount = checkinventory("Armor");
SecurityMorphArmor = 100 - ArmorAmount;
CombatMorphArmor = 100 - ArmorAmount;
ChargeMorphArmor = 200 - ArmorAmount;
DemolitionMorphArmor = 250 - ArmorAmount;
}

 

this script transfers the player's health

 

script 244 (void)
{
setactorproperty(0, APROP_HEALTH, Health);
}

 

this last script tells when the player has reached the top of the ladder

 

script 13 (void)
{
until(getactorz(0) >= x) // again, x can be what ever value you want, it can be however tall your want you ladder to be.
    {
    PlayerPitch = getactorpitch(0);
    delay(1);
    }
        thing_move(0, 44, 1); //this is where the player teleports when you reach the top of the ladder as sort of "stepping off" the ladder.
        setactorpitch(0, PlayerPitch);
        takeinventory("PlayerClimbMorph", 1);
        setplayerproperty(0, 0, PROP_FLY);
        acs_execute(244, 0, 0, 0, 0);
        PlayerPitch = GetActorPitch(0);
        delay(1);
        setactorpitch(0, PlayerPitch);
}

 

The only bug I can think if is when you climb to the top but there is a monster or another object in the teleport point. This can be fixed with the block monsters line around it but won't work for another player who is in your way. The reason being it doesn't make sense to telestomp something at the end of a ladder hence the -TELESTOMP flag being set for the PlayerClimber.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now