Isn't the spark effect based on the power usage of the vehicle it's attached to ?
If it is then that vehicle wont be using a lot of power since it's been changed to a non powered vehicle .
The original script could of been set up by Jivebunny on the basis that this vehicle is powered which would mean the locomotive entry in the script was correct (or botched that way to get it to work )?
It gets the power usage from the frontmost loco (the 'the_loco' variable that needed fixing), so it shouldn't be affected by changes to the non-power cars.
It does however function differently in DCC mode and Cab mode, and on AI trains it'll always be DCC mode. In DCC mode it pretty much directly uses the throttle level as the power, it probably needs some scaling.