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

Sound Sequence/loop problem

Question

Hello!
Yes, I know, it's me again. I wasn't lying when I told that I'm still a noob at editing.

I'm trying to make an inventory item that play the same sound roughly 3 times before going to the next step. I just can't do it.

Here's what I tried so far:

 

Spoiler

ACTOR FuelSpawner : CustomInventory
{
  Inventory.PickupSound "slime"
  Inventory.PickupMessage "You found a fuel tank!"
  Inventory.Icon GASOB0
  Inventory.InterHubAmount 1
  Inventory.MaxAmount 1
  Scale 0.7
  +Inventory.InvBar
  +FloorClip
  States
  {
  Spawn:
    GASO A -1
    Loop
  Use:
    TNT1 A 0 A_JumpifInventory("sawselected", 1, "SawFuel")
    TNT1 A 0 A_JumpifInventory("FlameCannonselected", 1, "Napalm")
    TNT1 A 0 A_Print("You can only refill chainsaws, flamethrowers and napalm launchers. Select one of them first.")
    TNT1 A 0 A_SpawnItemEx("FuelSpawner", 30, 0, 0, 0, 0, 0, 0)
    Stop
  SawFuel:
    GASO A 5 A_PlaySound("slime",0,10,1)
    GASO A 5 A_GiveInventory("SawFuel", 120)
    GASO A 5
    Goto StopFilling
  Napalm:

    GASO A 5 A_PlaySound("slime",0,10)
    TNT1 A 1 A_GiveInventory("Gas", 40)
    GASO AAA 5

    GASO A 5 A_PlaySound("slime",0,10)
    TNT1 A 1 A_GiveInventory("Gas", 40)
    GASO AAA 5

    GASO A 5 A_PlaySound("slime",0,10)
    TNT1 A 1 A_GiveInventory("Gas", 40)
    Goto StopFilling
  StopFilling:
    TNT1 AA 5 A_PlaySound("slime",0,10,1)
    TNT1 A 10 A_StopSound(0)
  }
}

 As you can see, I tried two methods:
In the Chainsaw's case, the "Stop Filling" state is reached immediately, even before the loop can actually start and making the sound play just once. In the flamethrower's case, I tried using the A_PlaySound command multiple times, but setting a frame duration doesn't work, and the state is read so fast that even the 40+40+40 is given to me all at once, and the sound still plays just once. What could I do?

 

Share this post


Link to post

3 answers to this question

Recommended Posts

  • 1

In the Use state, call an ACS script, and have the script do everything else.  In the ACS wiki page I linked for you earlier, there is a link to a page full of built-in ACS functions, including GiveInventory and Delay.  There is also a link to a really nice quick beginner's guide, which will teach you, among other things, how to use If statements.  Try to make the script yourself with the wiki as a reference tool, and if you need help, I and others are here for you.

Share this post


Link to post
  • 0

First, all states in inventory actors take 0 tics no matter what number you use.  Second, you say it goes through the loop in SawFuel just once, but there is no loop there.  The only solution I can think of is to have the actor call an ACS script, which can take non-zero time.

Share this post


Link to post
  • 0

The "1" in the A_PlaySound("slime",0,10,1) means that the sound loops. It actually does loop if don't put an A_StopSound to make it stop. The problem is it happens too soon.

 

EDIT: By the way I found a solution putting the A_StopSound when the chainsaw does the refill check, But I was wondering if there was another way to put pauses among states, so I could make the 40+40+40 ammo gain refill the weapon gradually.

Edited by Grey_Wolf

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
×