Empyre Posted November 3, 2016 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. 0 Share this post Link to post
SaladBadger Posted November 3, 2016 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. 0 Share this post Link to post
Empyre Posted November 3, 2016 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? 0 Share this post Link to post
Arctangent Posted November 3, 2016 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. 0 Share this post Link to post
Empyre Posted November 3, 2016 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? 0 Share this post Link to post
Empyre Posted November 4, 2016 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. 0 Share this post Link to post