| I have recently tried to create a chargeable weapon, here are my desired specifications and TNNs instructions:
 
 YinYin Falcon said:a chargeable weapon:
 -first left mouse button fires normally
 -if held a bar increases up towards a maximum (during that time the player animation is changed and/or particles are released at the tip of the weapon)
 -if released below maximum the bar resets and nothing further happens
 -if released at maximum the bar resets and a special projectile is shot
 TNN17 said:Two versions of this are possible, one that fires or can be held to interrupt firing and charge up.
 
 Weapon 1: Charges whilst firing. It also fires particles, which are long lived and fired by Weapon 2 - a short range dummy weapon with a wide spread and short range. This should scatter more and more particles as the weapon charges.
 
 Wield Script on the Weapon's Item:
 Run every X milliseconds. Doesn't Run By Itself.
 Run three other scripts with conditions (Effect 35 or something, if you need particular numbers I can go get them, I just remember most effects and conditions by what they do rather'n the number).
 
 #1:
 Condition 37: Player's Left Mouse Button is pressed.
 Increase Player's Charge Bar by Y.
 If you want a disable weapon to charge: Disable this particular weapon for X+1 ms.
 And since you're disabling the weapon, you'll need to add the firing of the SFX weapon to generate the charging particles (you can also add more scripts to fire more particles if the Charge bar is higher).
 
 #2: Another Condition 37: Player's Left Mouse Button is DE-pressed.
 Charge Bar > Z (Maximum).
 Fire Charged Weapon, normal direction 1 time.
 Set Charge Bar to 0. (It's usually simpler to just -999 with Effect 4 and respect limits for this).
 Again, you can have other scripts after this one with partway charges Megaman style, where 50% charge fires a smaller blast, 100% fires a bigger one.
 
 #3: 37 again.
 Charge Bar < Z
 Set Charge Bar to 0.
 
 And add an effect on use to the item just in case that force sets Charge to 0. This should only apply the first time you equip it (rather than being reapplied constantly), so it will ensure you can't charge, switch out to another gun, then switch back and instantly fire.
 The only thing I am having heavy problems with is effect 45 (prevent using charge laser).
 It reacts very randomly:
 The bar charging always works, but
 if I set the prevent time too high the weapon will not fire normally at all,
 if I set it too low it will fire all the time (even during charging).
 Setting the prevent time empirically somewhere in between doesn't help either,
 then it will sometimes fire all the time and sometimes not fire at all.
 
 Thinking about it I figured it would be better to generally disable the weapon (without timer) and then reenable it again when the left mouse button is not pressed anymore.
 Is there a solution like that?
 
 Here is what the three scripts look like right now:
 
 Charge Laser;//name64;//identifier
 1;//run without calling (set to 0 if you use the script for example as a wield script)
 0;//call position, 0=player location, 1=mouse location
 0;//calling creature 0=player, 1=creature nearest to the mouse, 2=player controlled creature
 1;//run every n milliseconds
 ;//message
 0;//message type, 0=quick message, 1=journal
 ;//sound, none for nothing
 0;//delay script for n seconds after conditions met
 0;//disabled after first use, 0=no, 1=yes
 begin_conditions;
 37;//condition
 0.000000;//condition parameter0
 0.000000;//condition parameter1
 11;//condition
 210.000000;//condition parameter0
 0.000000;//condition parameter1
 end_conditions;
 begin_effects;
 45;//effect number
 83.000000;//parameter1
 15.000000;//parameter2
 83.000000;//parameter3
 0.000000;//parameter4
 4;//effect number
 5.000000;//parameter1
 1.000000;//parameter2
 1.000000;//parameter3
 0.000000;//parameter4
 end_effects;
 Charge Laser Fail;//name
 65;//identifier
 1;//run without calling (set to 0 if you use the script for example as a wield script)
 0;//call position, 0=player location, 1=mouse location
 0;//calling creature 0=player, 1=creature nearest to the mouse, 2=player controlled creature
 1;//run every n milliseconds
 ;//message
 0;//message type, 0=quick message, 1=journal
 ;//sound, none for nothing
 0;//delay script for n seconds after conditions met
 0;//disabled after first use, 0=no, 1=yes
 begin_conditions;
 11;//condition
 210.000000;//condition parameter0
 0.000000;//condition parameter1
 5;//condition
 1.000000;//condition parameter0
 100.000000;//condition parameter1
 37;//condition
 0.000000;//condition parameter0
 1.000000;//condition parameter1
 end_conditions;
 begin_effects;
 4;//effect number
 -999.000000;//parameter1
 1.000000;//parameter2
 1.000000;//parameter3
 0.000000;//parameter4
 end_effects;
 Charge Laser Release;//name
 66;//identifier
 1;//run without calling (set to 0 if you use the script for example as a wield script)
 0;//call position, 0=player location, 1=mouse location
 0;//calling creature 0=player, 1=creature nearest to the mouse, 2=player controlled creature
 1;//run every n milliseconds
 ;//message
 0;//message type, 0=quick message, 1=journal
 ;//sound, none for nothing
 0;//delay script for n seconds after conditions met
 0;//disabled after first use, 0=no, 1=yes
 begin_conditions;
 11;//condition
 210.000000;//condition parameter0
 0.000000;//condition parameter1
 3;//condition
 1.000000;//condition parameter0
 100.000000;//condition parameter1
 37;//condition
 0.000000;//condition parameter0
 1.000000;//condition parameter1
 end_conditions;
 begin_effects;
 4;//effect number
 -999.000000;//parameter1
 1.000000;//parameter2
 1.000000;//parameter3
 0.000000;//parameter4
 24;//effect number
 56.000000;//parameter1
 1.000000;//parameter2
 0.000000;//parameter3
 0.000000;//parameter4
 end_effects;
 any chance to implement something like a spoiler feature into this forum (click to view/expand)?
 |