...Action scripts on items continue to be repeated whilst the button is held down.
I can't see how this is intended behaviour - the actual effects of an item don't work in this way.
I can post a test-quest if you like, but I think it's reasonably self-explanitory.
I would think it'd be better if you could hold it in to continue the effect.
Couldn't there be added a test to count the number of frames, and then add a stopper after the first frame it's running? I suppose that'd be hard to do because it only runs for one frame though. 😛 So the test wouldn't even have a chance to be run after one frame...
Ah, scripting. *_*
The problem is that if we hold the button to continue the effect, it ruins all existent item action scripts... :shrug:
You can add a chunk in the global script that says 'if you're holding the button, continue the effect', but you can't seem to add anything (or at least, I've had absolutely no luck with making one) that says 'dont allow the script to run again if the button's being held down'.
It really makes more sense... as long as they aren't being fired up at every frame.
It'd be nice if you could stick waitframes in action scripts. Passing it on to a global script is just awkward.
I agree. I really don't understand why this is the case. It would make things soo much easier...
Guys, just use a global script!
If you don't use selectable A-button weapons, then try something very similar to but not exactly this:
bool previousB = false;// Boof only during the frame when InputB changes from false to true
item script Boofer {
void run() {
if (Link->InputB == true && previousB == false) {
Boof();
}
}
}
global script Global {
void run() {
while(true) {
previousB = Link->InputB; // must come before Waitframe.
Waitframe(); // Link->InputB is now a different value.
}
}
}
If your item can be equipped in A or B slots, use something
inspired by this:
int Boofing = 0;item script Boofer {
void run() {
// Only run if Boof() was not called in the previous frame.
if (Boofing == 0) {
Boof();
}
Boofing = 2;
}
}
global script Global {
void run() {
while(true) {
// If button is held down, then Boofing will be reduced from 2 to 1 each frame.
// If button is NOT held down, the Boofing will reduce to 0 two frames after the button was released.
if (Boofing > 0)
Boofing--;
Waitframe();
}
}
}
Hrm...
Well that wasn't the approach I tried to use the global script to get round it, so I'll give that one a go.
I still don't think it should work like it currently does though.