1) Check power outlet. Re-plug power cable.
2) Rest pmu. It is a small button on the logic board.
3) Check poweron battery. Replace if necessary.
4) detach all devices.
Replacing the battery may or may not help. It depends on the model of your mac.
I am not familiar with intricacies of iMac G4.
complete take apart guide.
You can see the battery in section 2.1