Jump to content

Decoration thingy


Recommended Posts

Let's get straight to the point: how do I make CVAR-dependant death state?

To clarify: we have lamps. Normally, they just shine (Or don't shine), and you can't hit them.

However, I want to make them destructible, when the appropriate CVAR is used.

Edited by Grieferus

Share this post


Link to post

Okay, pretty simple. You can do it either in decorate or in zscript.

Zscript:

Death:
    TNT1 A 0 {
        if ( GetCvar("cvar_isshining") ) {
            return resolveState("Death_shine");
        } else {
            return resolveState("Death_Normal");
        }
        return resolveState(null);
    }
Death_Shine:
    // stuff
Death_Normal:
    // stuff

Decorate:

Death:
    TNT1 A 0 A_JumpIf(GetCvar("cvar_isshining"), "Death_shine")
    TNT1 A 0 A_JumpIf(!GetCvar("cvar_isshining"), "Death_Normal")
    //intentional fallthrough
Death_Normal:
    // stuff
Death_Shine:
    // stuff

And a little clarification, if ( GetCvar("cvar_isshining") ) means GetCvar("cvar_isshining") equals true, while ( !GetCvar("cvar_isshining") ) means GetCvar("cvar_isshining") equals false.

Edited by ramon.dexter

Share this post


Link to post
Death:
    TNT1 A 0 A_JumpIf(CallACS("environmenttoggle")==0, "Death_shine")
    TNT1 A 0 A_JumpIf(CallACS("environmenttoggle")==1, "Death_Normal")
    //don't really know what goto should be here
Death_Normal:
    LAMP AB 2 A_PlaySound("glassbreak")
	TNT1 AAAA 0 A_SpawnItemEx("GlassPiece",random(-2,2),random(-2,2),random(47,49),random(4,8),0,random(5,10),random(0,360),0,80)
	LAMP B 1
	LAMP B -1
	Stop
Death_Shine:
    Goto Spawn

If I got this right.

Share this post


Link to post

Got it!

Now that I'm thinking, I could do this with other decorations.

The problem is... Well, they're randomized (Although, it's optional), so it seems that the only viable option is to make a separate actor for each randomized decoration (To prevent, for example, skulls appearing from a stick with only a head).

Share this post


Link to post

Just a heads-up, you'll only want to use the DECORATE version if you're targeting Zandronum, ACE Engine, or some other non-gzdoom port. For GZDoom itself, go with ZScript so you don't lock yourself out of the power of the language for when you'll inevitably need it.

Share this post


Link to post

I'm using old version of GZDoom, which supports ZScript, but I don't know how different the syntax of its version of ZScript is from newer ones.

Edited by Grieferus

Share this post


Link to post

The basic syntax is the same in all versions, pretty much -- later versions add new features, functions, and whatnot, but the example posted uses some pretty basic stuff (GetCvar and ResolveState have been around for a long while). Give it a shot.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...