Execute_GiveCurrency
Description
Hands currency from the BaseObject character to the other character of the script (a Zoi-to-Zoi money transfer). S1 points at a GiveCurrency row that owns the currency, the amount and the effects, so designers tune the option without touching code. The two characters must belong to different households, because currency is owned per household.
GiveCurrency.Amount > 0 transfers that fixed amount right away. Amount = 0 instead opens the amount input popup, and only for the possessed payer - for anyone else nothing happens, so autonomy and schedules never move money. The popup accepts UB1CurrencyDataAsset.GiveCurrencyMinAmount at the least and the payer balance at the most.
A transfer holds only while the two characters stand within UB1CurrencyDataAsset.GiveCurrencyMaxDistance, the payer can cover the amount, and the payee can take all of it without hitting UB1CurrencyDataAsset.MaxAmount. All three are checked again at the moment the popup is confirmed, so a transfer that no longer holds is dropped with a system message instead of going through.
GiveCurrency.SuccessScriptIds run only after the money has actually moved (Self = payer, Target = payee), so put the reward side of the interaction there rather than in the talk finish scripts, which also run when the transfer is refused.
Parameters
| Parameter | Description |
|---|---|
| BaseObject | Who pays (Self or Target). The other character receives. |
| S1 | GiveCurrency id (GiveCurrency.Id). |
Examples
| Description | BaseObject | Command | S1 |
|---|---|---|---|
| Self gives target a fixed 50 Mew. | Self | GiveCurrency | GiveMoney_50 |
| Self gives target the amount typed in a popup. | Self | GiveCurrency | GiveMoney_Direct |
| Target gives self a fixed 100 Mew. | Target | GiveCurrency | GiveMoney_100 |