Blockland Forums > Modification Help
Delayed shell ejection and three-shot burst
A Twig:
For a long time I have been trying to understand where in the hell the sequence parts for delayed shell ejection are. I have looked at many weapons for example the old Weapon_Shotgun, and I have yet to figure out where it is located. If anyone can help show me in this code where I can edit and make the weapon have a delayed ejection. I.E. When I fire a bolt-action, 2 seconds later bolt pulls back and the ejection is set.
--- Code: ---
stateName[0]="Activate";
stateTimeoutValue[0]=0.15;
stateTransitionOnTimeout[0]="AmmoCheck";
stateSequence[0]="use";
stateSound[0]=R700CBDeploySound;
stateName[1]="Ready";
stateTransitionOnTriggerDown[1]="Fire1";
stateAllowImageChange[1]=true;
stateTransitionOnNoAmmo[1]="Empty";
stateName[2]="Fire1";
stateTransitionOnTimeout[2]="AmmoCheck";
stateTimeoutValue[2]="1";
stateFire[2]=true;
stateAllowImageChange[2]=false;
stateWaitForTimeout[2]=true;
stateEmitter[2]=R700CBFlashEmitter;
stateEmitterTime[2]=0.05;
stateEmitterNode[2]="muzzlePoint";
stateSound[2]=R700CBFireSound;
stateScript[2]="onFire1";
stateEjectShell[2]=true;
stateSequence[2]="Fire";
stateName[3]="Fire2";
stateTransitionOnTimeout[3]="AmmoCheck";
stateTimeoutValue[3]="0.1";
stateFire[3]=true;
stateAllowImageChange[3]=false;
stateWaitForTimeout[3]=true;
stateEmitter[3]=R700CBFlashEmitter;
stateEmitterTime[3]=0.05;
stateEmitterNode[3]="muzzlePoint";
stateSound[3]=R700CBFireSound;
stateScript[3]="onFire2";
stateEjectShell[3]=true;
stateSequence[3]="Fire";
stateName[4]="AmmoCheck";
stateTransitionOnTriggerUp[4]="Ready";
stateAllowImageChange[4]=true;
stateScript[4]="onAmmoCheck";
stateName[5]="Reload";
stateTimeoutValue[5]=1.5;
stateSequence[5]="Reload";
stateTransitionOnTimeout[5]="Done";
stateWaitForTimeout[5]=true;
stateSound[5]=R700CBReloadSound;
stateAllowImageChange[5]=true;
stateSequence[5]="Reload";
stateName[6]="Done";
stateTransitionOnTimeout[6]="Ready";
stateTimeoutValue[6]=0.1;
stateAllowImageChange[6]=true;
stateScript[6]="onReload";
stateName[7]="Empty";
stateTransitionOnTriggerDown[7]="EmptyFire";
stateAllowImageChange[7]=true;
stateTransitionOnAmmo[7]="Reload";
stateName[8]="EmptyFire";
stateTransitionOnTriggerUp[8]="Ready";
stateTimeoutValue[8]="0.15";
stateAllowImageChange[8]=false;
stateWaitForTimeout[8]=true;
stateSound[8]=R700CBClickSound;
};
--- End code ---
Second I want to mention is how to get a weapon to fire three shots in one click. The Left 4 Dead 2 weapon pack did it correctly even with the ammo code. I have wanted to have burst fire weapons for a while now, and I still cannot see where to make a weapon act like so. If anyone can show me what to edit or what to add (If it's a function) then please post below. If you do know how to do any of these and wish to help me understand so I can do it, don't be a wiseass and speak in riddles. If you know tell me so I actually get it. It's not a secret since many people know it, so don't act like it is one.
Slicks555:
My weapon coding is a little rusty, but if I remember correctly, stateTimeoutValue is how long it takes for the next state to be called. So, for example, if you wanted a 2 second gap before reloading it would look like this:
--- Quote from: A Twig on May 25, 2012, 02:55:00 PM ---
--- Code: --- stateName[3]="Fire2";
stateTransitionOnTimeout[3]="AmmoCheck";
stateTimeoutValue[3]="2.0"; // I think this value is in seconds.
stateFire[3]=true;
stateAllowImageChange[3]=false;
stateWaitForTimeout[3]=true;
stateEmitter[3]=R700CBFlashEmitter;
stateEmitterTime[3]=0.05;
stateEmitterNode[3]="muzzlePoint";
stateSound[3]=R700CBFireSound;
stateScript[3]="onFire2";
stateEjectShell[3]=true;
stateSequence[3]="Fire";
};
--- End code ---
--- End quote ---
Please, however, correct me if I am wrong.
As for the three shot burst, that's something you have to write in WhateverImage::onFire(). Look at Ephi's shotgun as a reference. Or any shotgun, really.
A Twig:
stateTimeoutValue for onFire deters how long you have to wait until you can fire again. The Sniper Rifle you have to wait about 3-4 seconds until you can fire again, therefore that value is "3.0" or "3". Thank you for your concern though.
Port:
--- Quote from: A Twig on May 26, 2012, 11:04:51 AM ---stateTimeoutValue for onFire deters how long you have to wait until you can fire again.
--- End quote ---
To be precise, it determines how long the delay between entering the state and switching to the state specified by stateTransitionOnTimeout should be.
A Twig:
--- Quote from: Port on May 26, 2012, 11:11:03 AM ---To be precise, it determines how long the delay between entering the state and switching to the state specified by stateTransitionOnTimeout should be.
--- End quote ---
^
This, but I was just using the Fire State as an example.