Trying to make a "GhostSphere" pick-up

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

Trying to make a "GhostSphere" pick-up

#1

Post by Empyre » Thu Nov 03, 2016 12:40 am

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:

Code: Select all

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.
"For the world is hollow, and I have touched the sky."

User avatar
Ænima
Addicted to Zandronum
Posts: 3579
Joined: Tue Jun 05, 2012 6:12 pm

Re: Trying to make a "GhostSphere" pick-up

#2

Post by Ænima » Thu Nov 03, 2016 12:40 pm

All Pickup states have zero tic duration regardless of what you specify.

You need ACS.
Reinforcements: midgame Survival joining/respawning
Doom64: Unabsolved: Doom64 + Diablo II
ZandroSkins: a pack made by our community
AeniPuffs: 3D blood and bullet puff effects, free to use for your own mods
Squad Radio: a WASD-based radio chat menu, add your own custom sounds!
Mercenaries (on hold)
Image

User avatar
fr blood
Frequent Poster Miles card holder
Posts: 995
Joined: Wed Mar 06, 2013 4:04 pm
Location: France

Re: Trying to make a "GhostSphere" pick-up

#3

Post by fr blood » Thu Nov 03, 2016 3:07 pm

You can use that PowerTargeter, it will maybe help you, here is an example:

Code: Select all

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
    }
}

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

Re: Trying to make a "GhostSphere" pick-up

#4

Post by Empyre » Thu Nov 03, 2016 3:41 pm

Ooooh, I like that! Thanks, Blood!

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?
"For the world is hollow, and I have touched the sky."

User avatar
Popsoap
 
Posts: 86
Joined: Mon Jun 04, 2012 2:38 pm
Location: Inside a wall

Re: Trying to make a "GhostSphere" pick-up

#5

Post by Popsoap » Thu Nov 03, 2016 7:50 pm

Empyre wrote:Ooooh, I like that! Thanks, Blood!
Glad to see my hacky code got some use.
Empyre wrote: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?
I never tested the code with A_ChangeFlag specifically, but you can use A_GiveInventory at certain tics in the PowerTargeter to toggle the effects you want (assuming A_ChangeFlag does not work with PowerTargeter).

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

Re: Trying to make a "GhostSphere" pick-up

#6

Post by Empyre » Fri Nov 04, 2016 9:31 am

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.
"For the world is hollow, and I have touched the sky."

Post Reply