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

Spawn something on top of another spawn

Question

Ok here is what I want to do I want to take an actor (a gun) and make it spawn with the BFG NOT REPLACE IT but spawn with it so that when you pick up the BFG you get both guns.

Share this post


Link to post

6 answers to this question

Recommended Posts

  • 2

No, don't spawn what you replace. You'll just go through an infinite loop of spawning more of your "WeaponGiver" class.

 

Arctangent referred to an actual WeaponGiver class.

Actor BFGReplacement : WeaponGiver replaces BUG_FUCKING_GUN
{
	DropItem "BUG_FUCKING_GUN"
	States
	{
	Spawn:
		BFUG A -1 nodelay A_SpawnItemEx("RailGun")
		Stop
	}
}

 

Share this post


Link to post
  • 0

You replace the BFG with a WeaponGiver that gives the BFG and also calls A_SpawnItemEx in the Spawn state, which spawns the additional weapon.

Share this post


Link to post
  • 0

could you give me an example I'm trying to use the WeaponGiver but it just makes the game crash this the code i have so far (this is meant for brutal doom by the way).

 

ACTOR WeaponGiver Replaces BIG_FUCKING_GUN
{
    States
    {
    Spawn:  
        BFUG A 0 A_SpawnItemEx ("BIG_FUCKING_GUN")
        BFUG A 0 A_SpawnItemEx ("RailGun")
    }
        
}

Share this post


Link to post
  • 0

Try this:

ACTOR WeaponGiver Replaces BIG_FUCKING_GUN

{
    DropItem "BIG_FUCKING_GUN"
    States
    {
    Spawn:  
        BFUG A -1 A_SpawnItemEx ("RailGun")
        Stop
    }
}

DropItem is the usual way for a WeaponGiver to give a weapon. Also, you need the sprite to stay indefinitely in the spawn state, so use the duration -1. If it works, this will result in there being both your BFG and a rail gun in the same spot.

 

Now, if you want there to be only the BFG pick-up sprite without the rail gun sprite in the same place, here's an idea to experiment with, but I can't guarantee it will work. In the code for your custom BFG, add a Pickup state with TNT1 A 0 A_GiveInventory("RailGun") and then Goto Select. There are possible problems with this approach: I am not sure that a weapon CAN have a Pickup state, and I am not sure that Goto Select is the right thing to do at the end of a weapon's Pickup state.

 

IMPORTANT: Make a back-up copy of your file before you try this experiment.

 

EDIT: Ninja'd! If Gez says to use nodelay, then do it. I am much newer to DECORATE than he is. In fact, just use his code and not mine. I goofed in other ways, too.

 

@Gez, how did you get your code to do DECORATE highlighting?

Edited by Empyre : ninja'd

Share this post


Link to post
  • 0

Actors run their codepointers when they enter a new state, but they don't enter their spawn state, they're created already in it. Without nodelay, it wouldn't run the A_SpawnItemEx command, so you'd have to do something like A 0 on the first line then another line with A -1 A_SpawnItemEx.

 

As for color highlighting, I didn't do anything special and it appears to have disappeared anyway. I'm pretty sure DECORATE syntax highlighting isn't available anyway, it might have used C/C++ or PHP or whatever.

Share this post


Link to post
  • 0

I figured out the solution to what I was trying to do, give the player both weapons while only displaying one pick-up sprite: CustomInventory. Since this actor replaces BFG9000, you will need to make your BIG_FUCKING_GUN not replace the BFG9000.

ACTOR BFGandRailGiver : CustomInventory replaces BFG9000

{
  Inventory.PickupMessage "You got the BFG and the Rail Gun!"
  Inventory.PickupSound "misc/w_pkup"
  +COUNTITEM
  states
  {
  Spawn:
    BFUG A -1
    stop
  Pickup:
    TNT1 A 0 A_GiveInventory ("BIG_FUCKING_GUN")
    TNT1 A 0 A_GiveInventory ("RailGun")
    stop
  }
}
Edited by Empyre : an unwanted empty line was inserted between every line of code

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
×