Jump to content

SLADE - Use multiple actions in one frame


sakulmore

Recommended Posts

Well, about Bright you can just put it right before every action you want, there's no need to have things separate.

 

While, if you to have multiple actions in one frame, let's say for example A_PlaySound and A_Explode, you just need to open brackets right after having defined the frame tics.

So something like this: 

XXX A 1 
		{
			A_PlaySound(stuff);
			A_Explode;
		}


EDIT: and if you want it to be bright too: 

XXX A 1 Bright	 
			{
				A_PlaySound(stuff);
				A_Explode;
			}

 

Edited by Kan3

Share this post


Link to post
40 minutes ago, Kan3 said:

Well, about Bright you can just put it right before every action you want, there's no need to have things separate.

 

While, if you to have multiple actions in one frame, let's say for example A_PlaySound and A_Explode, you just need to open brackets right after having defined the frame tics.

So something like this: 


XXX A 1 
		{
			A_PlaySound(stuff);
			A_Explode;
		}


EDIT: and if you want it to be bright too: 


XXX A 1 Bright	 
			{
				A_PlaySound(stuff);
				A_Explode;
			}

 

Thanks works :)

 

But i have this code: https://pastebin.com/sgD5sX0g

 

In this part:

ACTOR CustomMissileLauncher : Weapon 20029
{
	weapon.ammogive 1
	weapon.ammotype "RocketAmmo"
	weapon.slotnumber 9
	
	states
	{
		spawn:
			LAUN A -1
			stop
		ready:
			LAUG A 1 a_weaponready
			loop
		select:
			LAUG A 1 a_raise
			loop
		deselect:
			LAUG A 1 a_lower
			loop
		fire:
			LAUG A 1 a_playsound("weapons/rocklauncher", 1, 1)
			LAUG A 1 a_firecustommissile("rocklaunchmiss", 0, 1, 0, -8)
			LAUG A 1 a_refire("fire")
			goto ready
	}
}

If i use this:

ACTOR CustomMissileLauncher : Weapon 20029
{
	weapon.ammogive 1
	weapon.ammotype "RocketAmmo"
	weapon.slotnumber 9
	
	states
	{
		spawn:
			LAUN A -1
			stop
		ready:
			LAUG A 1 a_weaponready
			loop
		select:
			LAUG A 1 a_raise
			loop
		deselect:
			LAUG A 1 a_lower
			loop
		fire:
			LAUG A 1
			{
				a_playsound("weapons/rocklauncher", 1, 1);
				a_firecustommissile("rocklaunchmiss", 0, 1, 0, -8);
				a_refire("fire");
			}
			goto ready
	}
}

It's not working.

Share this post


Link to post

My guess is that it's not working due to A_ReFire. A_ReFire will go to the Hold state, which you don't have defined, so it will go into the Fire state instead, and you have it overriden to the Fire state (which is unnecessary due to what I just said). The problem is... it's already IN the Fire state, so it's got nowhere to go.

 

Try removing that (in other words, just use A_ReFire) and it might work, I think. Not too sure; haven't used too much anonymous functions.

 

Alternatively, define a Hold state for the weapon, and then when it hits A_ReFire, it will go to the Hold block instead of trying to do everything in Fire.

 

More info is on the ZDoom Wiki: https://zdoom.org/wiki/Actor_states#Anonymous_functions

Edited by Dark Pulse

Share this post


Link to post

Thanks for the reply.

 

I still need advice:

 

I have this piece of code here:

ACTOR CustomMissileLauncher : Weapon 20029
{
	weapon.ammogive 1
	weapon.ammouse 1
	weapon.ammotype "RocketAmmo"
	weapon.slotnumber 9
	
	states
	{
		spawn:
			LAUN A -1
			stop
		ready:
			LAUG A 1 a_weaponready
			loop
		select:
			LAUG A 1 a_raise
			loop
		deselect:
			LAUG A 1 a_lower
			loop
		fire:
			LAUG A 1 a_playsound("weapons/rocklauncher", 1, 1)
			LAUG A 1 a_firecustommissile("rocklaunchmiss", 0, 2, 0, -8)
			LAUG A 1 a_refire("fire")
			goto ready
	}
}

ACTOR rocklaunchmiss : Actor 20031
{
	projectile
	
	height 16
	radius 6
	speed 25
	damage 9999999
	
	states
	{
		spawn:
			ROCK A -1 bright
			stop
		death:
			MISB B 1 a_playsound("weapons/rocketboom", 1, 1)
			MISB B 1 a_explode(9999999, 15)
			MISB B 5 bright
			MISB CD 5 bright
			stop
	}
}ACTOR CustomMissileLauncher : Weapon 20029
{
	weapon.ammogive 1
	weapon.ammouse 1
	weapon.ammotype "RocketAmmo"
	weapon.slotnumber 9
	
	states
	{
		spawn:
			LAUN A -1
			stop
		ready:
			LAUG A 1 a_weaponready
			loop
		select:
			LAUG A 1 a_raise
			loop
		deselect:
			LAUG A 1 a_lower
			loop
		fire:
			LAUG A 1 a_playsound("weapons/rocklauncher", 1, 1)
			LAUG A 1 a_firecustommissile("rocklaunchmiss", 0, 2, 0, -8)
			LAUG A 1 a_refire("fire")
			goto ready
	}
}

ACTOR rocklaunchmiss : Actor 20031
{
	projectile
	
	height 16
	radius 6
	speed 25
	damage 9999999
	
	states
	{
		spawn:
			ROCK A -1 bright
			stop
		death:
			MISB B 1 a_playsound("weapons/rocketboom", 1, 1)
			MISB B 1 a_explode(9999999, 15)
			MISB B 5 bright
			MISB CD 5 bright
			stop
	}
}

The problem is that in the game the ammo (Rocket Ammo) looks like a rocket that I shoot from the Rocket Launcher. Can you tell me why this is happening?

 

Here is my addon: https://wadhosting.com/Wad/8E944D4BD33363889023F155734AEE3447AFBD9B

Share this post


Link to post
51 minutes ago, sakulmore said:

The problem is that in the game the ammo (Rocket Ammo) looks like a rocket that I shoot from the Rocket Launcher. Can you tell me why this is happening?

Because that's what your code asks it to look like?

 

52 minutes ago, sakulmore said:

ACTOR rocklaunchmiss : Actor 20031
{
	projectile
	
	height 16
	radius 6
	speed 25
	damage 9999999
	
	states
	{
		spawn:
			ROCK A -1 bright

 

You use the sprite ROCK A here. This is the sprite used by RocketAmmo, not the sprite used by Rocket.

 

Also since it's a projectile, there's no real reason to give it an editor number. And in DECORATE, every actor derives from Actor if nothing else is specified, so there's no need to inherit specifically from Actor. You could have just "Actor rocklaunchmiss" as the declaration line.

Share this post


Link to post

Somehow I didn't understand what to edit. Could you please write it for me? I mean the code :D . And can you somehow explain to me how exactly ACTOR works? When what can I put etc... :D

Share this post


Link to post
1 hour ago, Gez said:

Because that's what your code asks it to look like?

 

You use the sprite ROCK A here. This is the sprite used by RocketAmmo, not the sprite used by Rocket.

 

Also since it's a projectile, there's no real reason to give it an editor number. And in DECORATE, every actor derives from Actor if nothing else is specified, so there's no need to inherit specifically from Actor. You could have just "Actor rocklaunchmiss" as the declaration line.

maybe it should inherit from rocket

 

2 hours ago, sakulmore said:

Thanks for the reply.

 

I still need advice:

 

I have this piece of code here:


ACTOR CustomMissileLauncher : Weapon 20029
{
	weapon.ammogive 1
	weapon.ammouse 1
	weapon.ammotype "RocketAmmo"
	weapon.slotnumber 9
	
	states
	{
		spawn:
			LAUN A -1
			stop
		ready:
			LAUG A 1 a_weaponready
			loop
		select:
			LAUG A 1 a_raise
			loop
		deselect:
			LAUG A 1 a_lower
			loop
		fire:
			LAUG A 1 a_playsound("weapons/rocklauncher", 1, 1)
			LAUG A 1 a_firecustommissile("rocklaunchmiss", 0, 2, 0, -8)
			LAUG A 1 a_refire("fire")
			goto ready
	}
}

ACTOR rocklaunchmiss : Actor 20031
{
	projectile
	
	height 16
	radius 6
	speed 25
	damage 9999999
	
	states
	{
		spawn:
			ROCK A -1 bright
			stop
		death:
			MISB B 1 a_playsound("weapons/rocketboom", 1, 1)
			MISB B 1 a_explode(9999999, 15)
			MISB B 5 bright
			MISB CD 5 bright
			stop
	}
}ACTOR CustomMissileLauncher : Weapon 20029
{
	weapon.ammogive 1
	weapon.ammouse 1
	weapon.ammotype "RocketAmmo"
	weapon.slotnumber 9
	
	states
	{
		spawn:
			LAUN A -1
			stop
		ready:
			LAUG A 1 a_weaponready
			loop
		select:
			LAUG A 1 a_raise
			loop
		deselect:
			LAUG A 1 a_lower
			loop
		fire:
			LAUG A 1 a_playsound("weapons/rocklauncher", 1, 1)
			LAUG A 1 a_firecustommissile("rocklaunchmiss", 0, 2, 0, -8)
			LAUG A 1 a_refire("fire")
			goto ready
	}
}

ACTOR rocklaunchmiss : Actor 20031
{
	projectile
	
	height 16
	radius 6
	speed 25
	damage 9999999
	
	states
	{
		spawn:
			ROCK A -1 bright
			stop
		death:
			MISB B 1 a_playsound("weapons/rocketboom", 1, 1)
			MISB B 1 a_explode(9999999, 15)
			MISB B 5 bright
			MISB CD 5 bright
			stop
	}
}

The problem is that in the game the ammo (Rocket Ammo) looks like a rocket that I shoot from the Rocket Launcher. Can you tell me why this is happening?

 

Here is my addon: https://wadhosting.com/Wad/8E944D4BD33363889023F155734AEE3447AFBD9B

You havent specified a custom version of rocket ammo from what I can see here

 

ACTOR rocklaunchmiss : Rocket 20031
{
	projectile
	
	height 16
	radius 6
	speed 25
	damage 9999999
	
	states
	{
		spawn:
			MISL A -1 bright // rock is the default ammo sprite, misl is the default rocket projectile sprite
			stop
		death:
			MISL B 1 a_playsound("weapons/rocketboom", 1, 1) // MISB would need to be a custom sprite
			MISL B 1 a_explode(9999999, 15)
			MISL B 5 bright
			MISL CD 5 bright
			stop
	}
}

ACTOR CustomMissileLauncher : Rocketlauncher 20029  //inherit to get the missing states, also removes the need for some states
{
	weapon.ammogive 1
	weapon.ammouse 1
	weapon.ammotype "RocketAmmo"
	weapon.slotnumber 9
	
	states
	{
		spawn:
			LAUN A -1  // this is the correct sprite for a rockeetlauncher pickup that looks like the default rocketlauncher
			stop
		ready:
			MISG A 1 a_weaponready  // LAUG would need to be a custom defined sprite 
			loop
		select:
			MISG A 1 a_raise
			loop
		deselect:
			MISG A 1 a_lower
			loop
		fire:
			MISG B 1 a_playsound("weapons/rocklauncher", 1, 1)
			MISG B 1 a_firecustommissile("rocklaunchmiss", 0, 2, 0, -8)
			MISG B 1 a_refire("fire")
			goto ready
	}
}

// there is no special ammo defined, but you could do this maybe

actor customrocketammo : RocketAmmo {}

// then you'd need to replace weapon.ammotype "RocketAmmo" with weapon.ammotype "customrocketammo"

this is how the default rocket ammo looks like

 

// default

ACTOR RocketAmmo : Ammo
{
  Inventory.PickupMessage "$GOTROCKET" // "Picked up a rocket."
  Inventory.Amount 1
  Inventory.MaxAmount 50
  Ammo.BackpackAmount 1
  Ammo.BackpackMaxAmount 100
  Inventory.Icon "ROCKA0"
  States
  {
  Spawn:
    ROCK A -1
    Stop
  }
}

// maybe you could do this... remember we already inherit everything from the base definition above,
// therefore we do not specify the code above this line since it is already specified....
// but in customrocketammo we are modding some of the stuff...  (pickupmessage and max inventory amount)

ACTOR CustomRocketAmmo : RocketAmmo
{
  Inventory.PickupMessage "Picked up a custom rocket."
  Inventory.MaxAmount 100
}

 

Edited by CBM

Share this post


Link to post
1 hour ago, sakulmore said:

Somehow I didn't understand what to edit. Could you please write it for me? I mean the code :D . And can you somehow explain to me how exactly ACTOR works? When what can I put etc... :D

He meant that here: 

states
	{
		spawn:
			ROCK A -1 bright

You're saying to your custom rocket to have that ROCKA sprite when spawned, you need to change it to your custom sprite.

To know how to create new actors you can just take a look at the original Doom Actors, then learn the Actor Properties, Flags and Actions.

Share this post


Link to post

thanks for the explanation. I still want to ask, is it somehow possible to create a new weapon that will have the action "a_explode", but it will not take away my health?

Share this post


Link to post
3 hours ago, sakulmore said:

thanks for the explanation. I still want to ask, is it somehow possible to create a new weapon that will have the action "a_explode", but it will not take away my health?

Depends on what you want.

I'm guessing you need a sort of recoil, if that so, then just use A_Recoil.

But, if you need a short-range no damaging explosion (that will eventually push away nearby monsters too), then you can use A_Blast

Share this post


Link to post
11 hours ago, CBM said:

You havent specified a custom version of rocket ammo from what I can see here

Is it really needed? The weapon can work just fine with the standard rockets, and that way there's no need to change the status bar.

 

4 hours ago, sakulmore said:

thanks for the explanation. I still want to ask, is it somehow possible to create a new weapon that will have the action "a_explode", but it will not take away my health?

A_Explode

XF_HURTSOURCE — Hurts the source: if set, the source can be damaged by the explosion. Note that the source is not necessarily the calling actor. This flag is set by default. By using other flags or, if none of the other flags is desired, passing 0 to flags i.e. using 0 in place of the flag, this flag can be cleared.

Edited by Gez

Share this post


Link to post
1 hour ago, Kan3 said:

Depends on what you want.

I'm guessing you need a sort of recoil, if that so, then just use A_Recoil.

But, if you need a short-range no damaging explosion (that will eventually push away nearby monsters too), then you can use A_Blast

I was thinking more along the lines of something like the DontHurtShooter flag, which is currently obsolete.

 

Quote

XF_HURTSOURCE — Hurts the source: if set, the source can be damaged by the explosion. Note that the source is not necessarily the calling actor. This flag is set by default. By using other flags or, if none of the other flags is desired, passing 0 to flags i.e. using 0 in place of the flag, this flag can be cleared.

How can I disable or enable these flags?

Share this post


Link to post

When you use

a_explode(9999999, 15)

you can further define the flags to use like so:

a_explode(9999999, 15, 0)

where that 0 on the end tells it to clear all flags (including the default "hurt shooter" behavior of explosives).

Edited by SMG_Man

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