umm guys i already got it working,should have posted the result i guess but though this is a help only thread,well whatever:
YoraeRasante helped me with the user._stateTurns
The custom turn end effect is so that the turns don't go down unless the target affected by ice spikes takes dmg and it does now work as intended.
Thanks!
<Custom Apply Effect>
user._stateTurns[24] = 10;
</Custom Apply Effect>
<Custom Respond Effect>
var org = target.stateOrigin(24);
var min = Math.round(org.atk * 0.5);
var max = Math.round(org.atk);
var value = Math.floor(Math.random()*(max-min+1))+min;
user.gainHp(-value);
target._stateTurns[24] -= 1;
</Custom Respond Effect>
<Custom Turn End Effect>
user._stateTurns[24] += 1;
</Custom Turn End Effect>
user._stateTurns[24] = 10;
</Custom Apply Effect>
<Custom Respond Effect>
var org = target.stateOrigin(24);
var min = Math.round(org.atk * 0.5);
var max = Math.round(org.atk);
var value = Math.floor(Math.random()*(max-min+1))+min;
user.gainHp(-value);
target._stateTurns[24] -= 1;
</Custom Respond Effect>
<Custom Turn End Effect>
user._stateTurns[24] += 1;
</Custom Turn End Effect>
The custom turn end effect is so that the turns don't go down unless the target affected by ice spikes takes dmg and it does now work as intended.
Thanks!