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

different powerlevels

Recommended Posts

how would i give my DECORATE weapon 6 different powerlevels, and it increases for every few seconds you hold down the altfire button.


what i've got now is

actor laser : railgun replaces railgun
{
Weapon.SlotNumber 6
+Weapon.dontbob
Weapon.SlotPriority 2
Weapon.AmmoUse1 5
Weapon.AmmoUse2 3
Weapon.ammotype1 "cell"
Weapon.ammotype2 "cell"

states
{
Ready:
LASR AB 1 A_WeaponReady
loop
Deselect:
LASR A 1 A_Lower
loop
Select:
LASR A 1 A_Raise
loop
Fire:
LASR ABCD 3
LASR A 0 A_FireCustomMissile("dummy",0,true,0,0,0)
LASR DDD 0 A_CustomRailgun(1500,-8,"none","blue",1,0,2)
LASR A 10
goto Ready

AltFire:

AltHold:

LASR a 0 a_CheckForReload(5, "charge5", false)
LASR A 3

charge1:
LASR a 0 a_CheckForReload(1, "charge2", true)
LASR G 5
LASR G 0 a_refire

charge2:
LASR a 0 a_CheckForReload(2, "charge3", true)
LASR H 5
LASR G 0 a_refire
charge3:
LASR a 0 a_CheckForReload(3, "charge3", true)
LASR I 5
LASR G 0 a_refire
charge4:
LASR a 0 a_CheckForReload(4, "charge5", true)
LASR J 5
LASR G 0 a_refire
charge5:
LASR K 3
LASR K 0 a_refire


}

}

Share this post


Link to post

I'm not an expert at DECORATE, and I've never seen A_CheckForReload used, but I do know a way to create the effect you are looking for (courtesy of Stronghold's railgun.)

First of all, it would be much simpler to use a single inventory "charge item", and much cleaner. It would also let you use A_JumpIfInventory, which arguably is more useful.

First, you would start of with a sequence of A_JumpIfInventory states, starting at the highest number of firing modes and working your way down. You need 1 less than the number of fire modes you are looking for. After you have that, use A_GiveInventory to give the player the charge item. The next state would be a state with A_Refire. Anything between those 2 would be the "charging up" sequence. The rest of the state would be the "uncharged" firing sequence (basically, just hitting fire). The final state before returning to Ready would take all the charge items from the player. You can fill in states however you want at this point, just as long as those code pointers don't end up ahead or behind where they are supposed to be.

The rest of the fire modes are everything from A_GiveInventory on copy/pasted, the exception being whatever attack you want that charge to use, and the final charge should not give you a charge item. Also, you can make the final charge fire automatically by removing A_Refire from it.

To help out, here is a rubric/example:

AltFire:
     WEAP A 0 //I believe there is a problem involving the first state and jumping, but I'm not sure. Just in case.
     WEAP A 0 A_JumpIfInventory("ChargeItem",5,"Charge5")
     WEAP A 0 A_JumpIfInventory("ChargeItem",4,"Charge4")
     WEAP A 0 A_JumpIfInventory("ChargeItem",3,"Charge3")
     WEAP A 0 A_JumpIfInventory("ChargeItem",2,"Charge2")
     WEAP A 0 A_JumpIfInventory("ChargeItem",1,"Charge1")
     WEAP A 0 A_GiveInventory("ChargeItem",1)
     //Put a charging up sequence here, if you so desire.
     WEAP A 0 A_Refire
     //First firing sequence goes here.
     WEAP A 0 A_TakeInventory("ChargeItem",5) 
     Goto Ready

Charge1:
     WEAP A 0 A_GiveInventory("ChargeItem",1)
     //Charge sequence.
     WEAP A 0 A_Refire
     //Firing sequence.
     WEAP A 0 A_TakeInventory("ChargeItem",5) 
     Goto Ready

Charge2:
     WEAP A 0 A_GiveInventory("ChargeItem",1)
     //Charge sequence.
     WEAP A 0 A_Refire
     //Firing sequence.
     WEAP A 0 A_TakeInventory("ChargeItem",5) 
     Goto Ready

Charge3:
     WEAP A 0 A_GiveInventory("ChargeItem",1)
     //Charge sequence.
     WEAP A 0 A_Refire
     //Firing sequence.
     WEAP A 0 A_TakeInventory("ChargeItem",5) 
     Goto Ready

Charge4:
     WEAP A 0 A_GiveInventory("ChargeItem",1)
     //Charge sequence.
     WEAP A 0 A_Refire
     //Firing sequence.
     WEAP A 0 A_TakeInventory("ChargeItem",5) 
     Goto Ready

Charge5:
     //Remember, don't give a "charge item" here.
     //Charge sequence.
     WEAP A 0 A_Refire //Removing this makes the final charge fire automatically.
     //Firing sequence.
     WEAP A 0 A_TakeInventory("ChargeItem",5) 
     Goto Ready
All you need after that is to define your "charge item". That doesn't require an explanation, though. A simple look through the ZDoom Wiki would suffice. Hope this helped.

Share this post


Link to post

YYYYYYEEEEEEEESSSSSSSS! that makes sense.
(edit)

never mind. for some odd reason it jumps to the highest state even though there shouldn't be any charge items in my inventory.

can you get the source of this stronghold railgun?

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
×