Hi,
The code is to check if actor have the 100 gold required, display message if not enough gold
and if enough gold, play a SE and deduct the gold.
If the actor have the gold, it will deduct it. But it will not check for not enough gold and not display message and instead carry on to allow further action even when actor do not have enough gold.. it did not show error message either.
I have also set the correct variables to use which is 7.
$gameVariables.setValue(7,100)
invgold=$gameVariables.value(7);
if($gameParty.gold() < invgold){
$gameMessage.add("Gold is not enough")
this._index = this._list.length
}else{
AudioManager.playSe({"name":"Coin","volume":90,"pitch":100,"pan":0})
$gameParty.loseGold(invgold)
}
Can someone help ?
Thanks!
The code is to check if actor have the 100 gold required, display message if not enough gold
and if enough gold, play a SE and deduct the gold.
If the actor have the gold, it will deduct it. But it will not check for not enough gold and not display message and instead carry on to allow further action even when actor do not have enough gold.. it did not show error message either.
I have also set the correct variables to use which is 7.
$gameVariables.setValue(7,100)
invgold=$gameVariables.value(7);
if($gameParty.gold() < invgold){
$gameMessage.add("Gold is not enough")
this._index = this._list.length
}else{
AudioManager.playSe({"name":"Coin","volume":90,"pitch":100,"pan":0})
$gameParty.loseGold(invgold)
}
Can someone help ?
Thanks!