Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Gunrock

How do I make this decorate object activate and deactive?

Recommended Posts

I want to make a fountain that can be turned on an off through a simple switch on a wall. How can I make this decorate blood fountain activate and deactivate via a simple switch?

 

ACTOR FountainBlood 13002
{
  Radius 2
  Height 2
  Scale 0.75
  RenderStyle Translucent
  Alpha 0.75
  +NOBLOCKMAP
  +MOVEWITHSECTOR
  States
  {
  Spawn:
    BFOU ABCD 3
    Loop
  }
}

Share this post


Link to post
Posted (edited)

What I would do is give it a SpawnID and then make the switch run a script. The script will simply toggle which action it should do. Make a variable which checks if the fountain is on, if so, remove the actor. If it's off, spawn the actor at a MapSpot.

 

Example:

int fountainState = 0;

script "ToggleFountain" (void)
{
   if(fountainState == 0)
   {
      //spawn at mapspot with a tid
      fountainState = 1;
   }
   else if(fountainState == 1)
   {
      //remove with the tid
      fountainState = 0;
   }
   Delay(1);
}

 

Share this post


Link to post
Posted (edited)

There is also another way.

 

You can use this as an example.

https://www.realm667.com/index.php/en/prop-stop-mainmenu-163-64831/technical-mainmenu-164-44115/852-switchable-tech-lamp

Spoiler

ACTOR TechLampOff : SwitchableDecoration 90
{
    //$Category Light
    Radius 16
    Height 80
    +SOLID
    +USESPECIAL
    Activation THINGSPEC_Switch
    States
    {
    Active:
        TLMP A 0 A_PlaySound("switches/normbutn")
        // Fall through
    Lit:
        TLMP ABCD 4 Bright Light(BIGLAMP)
        Loop
    Inactive:
        TLMP E 0 A_PlaySound("switches/exitbutn")
        // Fall through
    Spawn:
        TLMP E -1
        Stop
    }
}

ACTOR TechLampOn : TechLampOff 91
{
    //$Category Light
    Activation THINGSPEC_Switch|THINGSPEC_Deactivate
    States
    {
    Spawn:
        Goto Super::Lit
    }
}

 

 

Then use switch with action 130 "Activate thing" with a same tag with your fountain.

Or deactivate it with action 131 "Deactivate thing"

 

So here it is

ACTOR FountainBloodOff : SwitchableDecoration 13002
{
      Radius 2
      Height 2
      Scale 0.75
      RenderStyle Translucent
      Alpha 0.75

    +MOVEWITHSECTOR

    +NOBLOCKMAP
    +USESPECIAL    
    Activation THINGSPEC_Switch
    States
    {
    Active:
        BFOU A 0
        // Fall through
    TurnOn:
        BFOU ABCD 3
        Loop
    Inactive:
        TNT1 A 0
        // Fall through
    Spawn:
        TNT1 A -1
        Stop
    }
}

ACTOR FountainBloodOn : FountainBloodOff 13003  //assuming doomednum 13003 is unused
{
    Activation THINGSPEC_Switch|THINGSPEC_Deactivate
    States
    {
    Spawn:
        Goto Super::TurnOn
    }
}

 

 

Share this post


Link to post

Note that in Jaska's example, you can activate/deactivate the fountain by directly using it. See Activation property and USESPECIAL flag.

Share this post


Link to post
12 hours ago, Gez said:

Note that in Jaska's example, you can activate/deactivate the fountain by directly using it. See Activation property and USESPECIAL flag.

 

That's true, so remove "+usespecial" flag.

 

However, "+NOBLOCKMAP" flag seems to prevent use actions anyway.

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
×