2 years ago

Here's a tutorial on how to script a discount in shops that activates upon a switch in VX Ace:


screenshot_2022-08-09_152713.png

First go to the script editor and then go to Window_ShopBuy

screenshot_2022-08-09_152900.png

scroll all the way down to line 56 where you will find def price(item)

screenshot_2022-08-09_153100.png

replace it with this:

def price(item)

return @price[item] if $game_switches[7] != true

return @price[item] / 2 if $game_switches[7] == true

end

screenshot_2022-08-09_153548.png

This will half the cost of all items if switch 7 is true/on and returns the cost to normal if switch 7 is false/off.
( != means not equal to and == means equal to)

Now just create an event on the map that puts switch 7 to true and calls the shop command.

screenshot_2022-08-09_153944.png
screenshot_2022-08-09_154127.png
screenshot_2022-08-09_154144.png

If you want to reduce the cost even further than half by dividing with a decimal, write the code like this: return (@price[item] / 1.5).to_i this prevents the item cost from turning into one long decimal number (something like 3.4111111112) and turns it into a regular 3.

#rpgmaker #rpgmakervxace #scripting #rgss



0 comments

Loading...

Next up

Single moms slaughtering criminals in your area.❗

click now!!! --> fakelink.virus.spam <--

Enemies are animated now.

To celebrate 650 members in this community, I made 50 fanworks for games (And an animation for the deception jam winner), each for a person that I vaguely remember seeing a post of here. (in case your name doesn't get mentioned mb)

The new demo for GUIDANCE is finally here!

https://store.steampowered.com/app/3168880/GUIDANCE/

This is a massive gameplay and graphics update, with a completely new progression system, reimagined bossfights, and plenty of tweaks!

#GUIDANCE is an original, meta, story-driven RPG

Savefiles from the demo are now compatible with the Fullversion + the demo can be played in 2 other languages now: German and Simplified Chinese.

A new GUIDANCE demo is coming to Game Jolt and Steam before the end of the month! (next couple days)

https://store.steampowered.com/app/3168880/GUIDANCE/

#GUIDANCEmonthlyDevlog

Menu Transitions. Might still need some changes.

What if it does increase weight 😢

We’re adding a container system allowing interaction with objects like tables and shelves, marked on the map. The "Container" view adapts to the hero’s appearance. This enhances immersion, while classic chests remain unchanged for player convenience.

Made a customizable Navigation Arrow that rotates around the player and points them to the next story location.