SwitchableDecoration... not switching

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Grey-Wolf
Posts: 179
Joined: Sun Jul 15, 2018 4:59 pm
Graphics Processor: nVidia (Modern GZDoom)

SwitchableDecoration... not switching

Post by Grey-Wolf »

Hello guys,
I'm trying to make a smoke flare that can be picked up again after lighting it up and throwing it to the ground, so the players can move around with the lit flare in their hands.
To do this I made the following actor:

Code: Select all

Actor ActiveFlare : switchabledecoration
{
	Radius 6
	Height 6
	Projectile
	Speed 13
    Damage (random (10, 10))
	Damagetype Fire
    Gravity 0.7
	Projectile
	+MISSILE
    -NOGRAVITY
    -BLOODSPLATTER
	-EXTREMEDEATH
	+BOUNCEONFLOORS
	+BOUNCEONWALLS
	+BOUNCEONCEILINGS
	-NOTELEPORT
	+THRUSPECIES
	+USESPECIAL
	Activation THINGSPEC_Activate
	Species "Marines"
	BounceFactor 0.5
	WallBounceFactor 0.25
    Health 5
    SeeSound "GRNBNCE"
	DeathSound "none"
  scale 0.5
  Radius 15
  Height 11
  +touchy
  States
  {
  Spawn:
    FLAR F 0 Bright
    FLAR F 0 Bright 
	
	Midair:
    FFLA ABCDEFGHABCDEFGHGFGHG 2 Bright
	
	Death:
	FFLA P 0 Bright A_PlaySoundEx("Flare/Loop", "SoundSlot7", 1, -1)
    FFLA PQ 2 Bright
	loop
	
	Active:
	FFLA P 0
	FFLA P 1 ACS_NamedExecute("PICKFLARE")
	TNT1 A -1
	Stop
	
  }
}
Thing is, nothing is happening when I press "use" near it. Since it won't even disappear (that TNT1 A -1 then STOP command) I'm guessing that the problem is not in the script, but rather in the jump to the "Active" state not being made.

Why is it? Is it because I press use after the projectile dies? Shouldn't it activate anyway since I didn't use the THINGSPEC_NoDeathSpecial?

Is it because missiles can't be activated? In that case what could be a possible solution? I was thinking of creating another actor to be spawned from the death state of this one, and make that switchable, but wouldn't it lose all its current speed, velocity etc.?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: SwitchableDecoration... not switching

Post by Graf Zahl »

How are you controlling the activation? It is not automatic - SwitchableDecoration requires calling Thing_Activate to jump to the "active" state.
User avatar
Grey-Wolf
Posts: 179
Joined: Sun Jul 15, 2018 4:59 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: SwitchableDecoration... not switching

Post by Grey-Wolf »

It's there, just below the +USESPECIAL flag. Unless you're talking about something else
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: SwitchableDecoration... not switching

Post by Graf Zahl »

Did you set the special in the editor? You still need to put the Thing_Activate on the thing in the map.
User avatar
Grey-Wolf
Posts: 179
Joined: Sun Jul 15, 2018 4:59 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: SwitchableDecoration... not switching

Post by Grey-Wolf »

It's not a thing in the map, it's an actor in DECORATE, a projectile thrown by the player.

This is part of another actor I made, for a crafting station:

Code: Select all

ACTOR RecombinerStart : SwitchableDecoration
{
	Game Doom
	Radius 20
	Height 30
	ProjectilePassHeight -16
	+SOLID
	+USESPECIAL
	+SHOOTABLE
	+NOBLOOD
	+NOTARGET
	+INVULNERABLE
	Activation THINGSPEC_Activate | THINGSPEC_NoDeathSpecial
	States
	{
	Spawn:
		RECS A 10
		RECS ABCDEFGHILMNOPQ 2


	////////////	
	//EMPTY ///////////////////////////////////////////////////////////////
	///////////
	
	Empty:
		RECO ABCDEFGHILMNOPQRSTUV 1
		TNT1 A 0 A_checkproximity("basic1", "basicvial", 50, 1)
		TNT1 A 0 A_checkproximity("acid1", "acidvial", 50, 1)
		TNT1 A 0 A_checkproximity("neutral1", "neutralvial", 50, 1)
		TNT1 A 0 A_checkproximity("glassx2", "emptyvial", 50, 2)
		TNT1 A 0 A_checkproximity("cloth1", "fabric", 50, 1)
		loop

	Active:
	RECS QPONMLIHGFEDCBA 2
	TNT1 A 0 A_Spawnitem("Recombinerpickup")
	Stop
	
	//
	//
	//
In this case, when I press use next to the actor, it properly goes to its "Active state", so it does work. The flare in the first post instead doesn't, even though it's coded in a pretty similar way. So I think some of the flags are to blame. But I'm not having any luck in finding out what's the cause.
User avatar
Grey-Wolf
Posts: 179
Joined: Sun Jul 15, 2018 4:59 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: SwitchableDecoration... not switching

Post by Grey-Wolf »

I've tried other things to avoid bumping this post annoying the moderators, but I still didn't find a soulution... sigh
User avatar
ketmar
Posts: 160
Joined: Sat Oct 01, 2016 6:26 am
Contact:

Re: SwitchableDecoration... not switching

Post by ketmar »

this is "projectile" in effect. it is a "combo flag", and it sets "+noblockmap" flag. obviously, you cannot activate something that doesn't really exist in collision grid. do you even need a full projectile combo here?

also note that you repeated "projectile" two times there, so make sure to remove both.
User avatar
Grey-Wolf
Posts: 179
Joined: Sun Jul 15, 2018 4:59 pm
Graphics Processor: nVidia (Modern GZDoom)

Re: SwitchableDecoration... not switching

Post by Grey-Wolf »

I solved making the projectile disappear after a couple of seconds after death, then replacing it with an identical looking actor that's not a projectile, and can be activated. Maybe not the most elegant way to do it, but seems to be working fine.
User avatar
ketmar
Posts: 160
Joined: Sat Oct 01, 2016 6:26 am
Contact:

Re: SwitchableDecoration... not switching

Post by ketmar »

still, why do you need a "projectile" at all? do you need all those flags set (including "noblockmap")?
Post Reply

Return to “Scripting”