Hello. I searched the entire thread but couldn't find the answer to my problem.
First of all, thanks to Terrax for creating what is definitely one of my favorite plugins. Second, I want to say that I am very happy with it and that it worked fine so far. In the game that I'm currently working on I have a torch item that performed fine when it was just a basic on/off. Then I wanted to make the torchlight appear and disappear gradually, and this seems to cause problems (sometimes).
I used the command:
Fire radiusgrow 200 #FFCC00 to activate the torch, and
Fire radiusgrow 0 #FFCC00 to deactivate it. However, when the torch dies, just when the light is down to the last pixel but before it completely disappears the game breaks with the following message:
IndexSizeError
Failed to execute 'createRadialGradient' on 'CanvasRenderingContext2D': The rl provided is les than 0
I worked around this by instead expanding the extinguish code like this. The idea was to let the light dim about halfway down and then cut it off completely.
Fire radiusgrow 50 #FFCC00
Wait: 240 frames
Fire radius 0 #FFCC00
This is where it got weird. What happened was that the game crashed with the same IndexSizeError message again, but this time as soon as I lit the torch in the first place! You can imagine my confusion. So I redid both events back to the basic
Fire radius 200 #FFCC00 and
Fire radius 0 #FFCC00. I tested and this worked fine. Then I changed it back to the growing radius as described above and tested again... And that worked too. I was starting to think that perhaps I'm imagining things or I don't know what, because I could no longer replicate the error - until I edited the chest event that gives you the torch in the first place. This put me back on the error, even though the change has absolutely nothing to do with the codes for creating/destroying light.
Can you help me understand the error better? What is it attached to, exactly? It seems that every time I launch the test there is a chance that the error will happen either when lighting or extinguishing the torch (only when using radiusgrow though, while just radius never creates problems). I wish I could explain it better but I'm completely confused. This seems impossible to reliably replicate. It's acting unstable for some reason. Sometimes I get it to work, but then I change some detail like the value from 200 to 150 -
and nothing else - run game again, crashes on lighting the torch.
Help? [IMG]http://www.hrtolkienboard.org/forums/html/emoticons/sad.gif[/IMG]
EDIT: I finally settled for this variant of code (common event tied to the torch item):
Plugin Command : Fire radiusgrow 50 #FFCC00
Wait : 120 frames
Plugin Command : Fire radius 150 #FFCC00
Text : None, Dim, Bottom
: You light the \c[14]Torch.
The text doesn't even display, which I guess means the game breaks right before that line. If I delete the Wait and radiusgrow commands, leaving only the flat radius command, everything works fine and when it's time to extinguish the torch that code works perfectly even though it is literally the opposite process:
Text : None, Dim, Bottom
: Your torch slowly dies.
Plugin Command : Fire radiusgrow 50 #FFCC00
Wait : 120 frames
Plugin Command : Fire radius 0 #FFCC00
Is this random or what?