brakenwagen Posted April 22, 2017 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. 0 Quote Share this post Link to post
2 Gez Posted April 22, 2017 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 } } 0 Quote Share this post Link to post
0 Arctangent Posted April 22, 2017 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. 0 Quote Share this post Link to post
0 brakenwagen Posted April 22, 2017 (edited) 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") } } Edited April 22, 2017 by brakenwagen 0 Quote Share this post Link to post
0 Empyre Posted April 22, 2017 (edited) 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 April 22, 2017 by Empyre ninja'd 0 Quote Share this post Link to post
0 Gez Posted April 22, 2017 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. 1 Quote Share this post Link to post
0 Empyre Posted April 22, 2017 (edited) 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 April 22, 2017 by Empyre an unwanted empty line was inserted between every line of code 0 Quote Share this post Link to post
Question
brakenwagen
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.