Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Empyre

Trying to make a "Ghost Sphere"

Recommended Posts

I am trying to make a replacement for the BlurSphere that makes the player partially invisible, but also makes him not solid and gives him NoTarget, all for 120 seconds. Here's the DECORATE code:

ACTOR GhostSphere : CustomInventory replaces BlurSphere
{
  +COUNTITEM
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  +INVENTORY.BIGPOWERUP
  Inventory.MaxAmount 0
  RenderStyle "Add"
  Alpha 0.95
  Inventory.PickupMessage "You will be a ghost for a while!"
  States
  {
  Spawn:
     PINS ABCD 6 Bright
     Loop
  Pickup:
    TNT1 A 0
    TNT1 A 0 A_ChangeFlag ("NoTarget", True)
    TNT1 A 0 A_SetTranslucent (0.50, 1)
    TNT1 A 4095 A_ChangeFlag ("Solid", False)
    TNT1 A 105 A_Log ("WARNING! Your time as a ghost is almost over!")
    TNT1 A 0 A_Log ("You are not a ghost any more.")
    TNT1 A 0 A_ChangeFlag ("NoTarget", False)
    TNT1 A 0 A_SetTranslucent (1.0, 0)
    TNT1 A 0 A_ChangeFlag ("Solid", True)
    stop
  }
}
It prints the two A_Log messages before it even prints the pickup message, so the effect has zero duration, so I can't even find out if the effect even works.

Share this post


Link to post

CustomInventory items ignore state durations in their Pickup and Use states. you'll need to use a script or something else in order to implement the effect.

Share this post


Link to post

In the Zandronum forums, fr blood said that I could make my own powerup type inheriting from PowerTargeter, putting stuff in the Targeter state. He gave this example code:

ACTOR MedPack : CustomInventory
{
Inventory.MaxAmount 1
Inventory.Icon "I_MBPK"
Inventory.PickupMessage "Medical Backpack"
Inventory.PickupSound "pickups/pmedkit"
Inventory.UseSound "pmed/use"
+INVBAR
States
{
  Spawn:
   MBPK A -1
    Stop
  Use:
   TNT1 A 1 A_GiveInventory("MedPackHealing",1)
   Stop
}
}

Actor MedPackHealing : PowerupGiver
{
    Powerup.Type MedPackHeal
    +AUTOACTIVATE
    +ALWAYSPICKUP
}

Actor PowerMedPackHeal : PowerTargeter
{
    Powerup.Duration -20
    States
    {
    Targeter:
        TNT1 AA 0
      TNT1 A 0 HealThing(2,150)
      TNT1 AAAAAA 3 A_SpawnItemEx("HealingEffect",random(24,-24),random(24,-24),random(0,32),0,0,random(1,4),0,128,0)
        Loop
    }
}
What I am wondering now is how can I use this to turn the effect on and then turn it off after the time elapses?

Share this post


Link to post

I would avoid using that method entirely, since it's so actively future-proof it's almost painful. That is in no way intended behavior for PowerTargeter, and there's no telling how PowerTargeter may change considering it's a pretty irrelevant actor for most mods. You're better off using ACS, likely in conjuction with dummy inventory items or user variables to keep track of the powerup's duration.

Share this post


Link to post

I have another idea, but it depends on being able to do something that I am not sure can be done. The idea is to have the player actor continuously turn off the effect, and use A_JumpIfInventory to skip those commands if the power-up is still in effect. The power-up itself would start the effect and last a certain time. I could inherit it from the invisibility power-up instead of using A_SetTranslucent.

This will work only if A_JumpIfInventory can detect whether a power-up is still in effect. Can it? Also, in which state of the player actor should I put the loop that deactivates the power-up?

Share this post


Link to post

I was unable to get this to work. I wound up settling for giving the player 2 minutes of partial invisibility (with the cantseek flag), frightener, speed, and protection (taking only 33% of normal damage, with the noradiusdamage, dontrip, and nopain flags). It isn't what I wanted, but it is still a pretty good power-up. I might decide to add flight as well.

I might learn ACS some day, but for now, I am learning DECORATE.

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
Sign in to follow this  
×