Help!

View previous topic View next topic Go down

Help!

Post by Rainman on Sun Feb 27, 2011 3:05 pm

So, I'm working on a project which involves a lot of hefty guns on a craft that wouldn't handle their raw recoil very well. The obvious solution? Cancel the recoil with jets, since cancelling with another gun would cause the craft to shoot itself every time I fire. Now, this isn't particularly hard; all I have to do is set the Step for the gun charge and jet values on one key to be equal to the Option of the gun. A quick tap on the firing key when the gun's ready sees a powerful shot with no recoil.

Here's my problem: If you tap the firing key when the gun is -not- ready to fire, the jets fire anyways and the vehicle lurches horribly out of control. I'm trying to eliminate this problem so that the jets fire only when the gun is charged and the firing key pressed.

I've tried an enormous number of possibilities, and the most promising failure was variations on the following:

Code:
If _E(cannon)<(670000){Trig=(0)}
If Trig<(670000){recoil1=(0)}

Now, here's the odd part- with this coding, the recoiljet won't fire if the gun isn't charged. But if you tap the firing key when its' charged, the recoil jets will not fire, only the gun itself. But if you hold the firing key down before the gun is fully charged, once it charges both the guns and the jets will fire. However this is not a workable solution as the guesswork involved in trying to time this makes it effectively impossible to hit anything.

Bottom line is, I've been wrestling with this for hours and none of the scripting I've tried really works. Anybody have any suggestions or answers for me?
avatar
Rainman
Tank
Tank

Posts : 80
Join date : 2011-02-14
Age : 25
Location : New England, US

View user profile

Back to top Go down

Suggestion

Post by supershade on Sun Feb 27, 2011 5:12 pm

Upload the model with the script in it....that way people can look at it and fix it, or you could try private messaging one of the more experienced users of rigidchips...I am not one of the experienced in wither script or Lua.


Last edited by supershade on Sun Feb 27, 2011 5:17 pm; edited 1 time in total (Reason for editing : Made no sense)
avatar
supershade
Hover
Hover

Posts : 107
Join date : 2011-02-07
Age : 21
Location : Norman,Oklahoma

View user profile

Back to top Go down

Re: Help!

Post by JHaskly on Sun Feb 27, 2011 11:25 pm

I would try:
Code:
if _e(cannon) == _option(cannon) && <whatever your trigger variable is>{
    trig = _option(cannon)+1
    recoil = _option(cannon)
}

A few notes: I'm not an RCScript user, just a Lua user, so it may not be exactly correct. if the "&&" doesn't work, try "and".

_________________
Previously (and currently) known as Juz.

Please do not write "LUA", beause it's "Lua". It's Moon in Portuguese, not a Limited User Account, Last Universal Ancestor, or the Lukla Airport in Nepal.

JHaskly
Admin

Posts : 235
Join date : 2010-07-16
Age : 21
Location : Brisbane

View user profile

Back to top Go down

Re: Help!

Post by Rainman on Wed Jun 06, 2012 11:30 am

I know this is an old topic, but to help out any new folk who might have read it hoping for clues-

I eventually solved this issue. The way I do it is to multiply things by _KEY() in my if-then statements, as that ultimately works out the same as a nested if-then. The other element is to create an arbitrary new variable within the script (I.e. a line saying, "GUNREADY=0") and then specify that when _E() of the cannon I'm working with is at the desired value, Gunready=1.

I can then multiply things in other lines of script by GUNREADY, with the result that those elements will operate normally (identity multiplication) if the condition is met, but be set to zero otherwise.
avatar
Rainman
Tank
Tank

Posts : 80
Join date : 2011-02-14
Age : 25
Location : New England, US

View user profile

Back to top Go down

Re: Help!

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum