Variables

Hi how can I put number I variable I'm struggling to understand the concept of them....

What I want to do is:

 

set var player strength to 100                                        #this is not for the battle system just for ordinary gameplay

Call  to check var player                                                  #during event for example cutting tree's

If var player is > then 0 perform action                           #cut the tree

Decrease var player                                                        # do math(100-1=99) and store value in var player 

else 

display message "you are tired, go to bed!!!"                # not enough strength

 

I hope that make sense 🙂
If I understand it correctly, you would do this at the start:

x_61.png


Then, for the Wood Chop event, do this:

x_62.png


Is that what you are trying to achieve?
 
Yes!!!

But when I try your method I got just message I am tired......

I putt:

I common events TAB name: strength ,var strength =100

 

then in tree event I putt:

conditional branches var strength > 0

          control variables  strength -=1

          self switch A= on                                      #rest of chopped tree sprite on screen

Else 

text : you are tired 

branch end

 

 

BUT WHEN I APPROACH TREE I got just get  message you are tired.....
please show a screenshot of your event
Now I delete everything and starting from scratch...

 

I wont a value to by stored..... Strength = 100 in variable                      #I what that to be common event so I can cal for it easy 

 

when I approach tree:                                                                              # or other object(event) 

I wont to check for stored variable strength in common event 

and if strength is more then 0 or points needed for action, perform action 

subtract   from variable Strength  (or whatever value depending what  I want to do ) from var Strength and store new value in var Strength                       

if else 

text message "you are tired need to rest "

 

 

it look like for my that variables in RPG maker are unable to store value to start with they can only increase initial value, but I don't know  so maybe am wrong....
Variables can be set to any number you like when they start.  

It really would be much easier to help you if you did what Andar suggested and post a screenshot of your event so that we can see it.
like i said i delate everythint.....

i wotn "x" to be 100

when "x" interact with "y" chech "x" if greyter then 0

if YES perform action 

decrise "x" by 1 

else 

if "x" les the 0 

message box "you are tired"

 

 

 

 

 


imagine you are in the forest and you got 10 swings with an axe  you swing your axe 10 times cuting  trees then ( if swing axe = 0) measge is displeyed "you are tired"

that is it......
In logic sequences, every tiny step and command counts - and if you simply write the commands as text, you often forget or misspell the commands, especially if your first language isn't english.

Your description of what you claim how you made the event doesn't help us because you're not describing everything that affects the event. That's why we're asking for screenshots.

How to take a Screenshot:

You've heard people say to take a screenshot, but how does one take a screenshot of their game? Simple, while the game is running, hit the Prt Scr button on your keyboard, which is located right next to your F12 key. If you're using a laptop, you might have to use the Fn key in combination with the Prt Scr key to get it to work.


Now that you've pressed the button, it's time to paste this screenshot into an image editing software. If you don't have anything fancy such as Adobe Photoshop, GIMP or Paint.NET, no worries; you can use MS Paint instead. Open up your image editing software, create a new file, and then hit ctrl+v on your keyboard, or simply right click on the screen and select paste. This should instantly paste the screenshot into your image editing software. You can go ahead and crop the image to suit your needs, or if you don't even know what that means, you can just upload it as it is.


Save the image as a PNG, or if you really need to, as a high quality JPG.


How to upload the image to the forums
Now that you have you have an image on your computer you'd like to show us, how can you get it to show up on the forums? Firstly, you need to find an image hosting site, photobucket.com or imageshack.us are popular ones. If you have another image uploading website, great - use that one! Either way, upload it to the site, and then get the direct link. Don't get the resized link, or the thumbnail link, but the direct URL. You'll know you have the direct URL if the URL ends with the file extension you saved your image in (which will hopefully be .png).

Once you have this direct URL to your image, simply use the IMG tags in your forum post and paste the URL in between them. If this image is big, please leave the image in spoiler tags.


IMG tags:
image.png
my common events

http://www.hostfoto.pl/show-image.php?id=7d89c23bf52afd6d3fb48cc84931bcd8

http://www.hostfoto.pl/show-image.php?id=1052dd66c115eeb8a1c0d5c4d371941e

http://www.hostfoto.pl/show-image.php?id=727f4ade3cd800572c9faeb0d9ff1ef2

http://www.hostfoto.pl/show-image.php?id=c000e372a438e59c720188768ad1867b

my events  for the rock

http://www.hostfoto.pl/show-image.php?id=17ff33544c1f2f306c28ec2524845597

http://www.hostfoto.pl/show-image.php?id=cff9c4017818de4b57cffe8581d59ff5

So if I go to an rock it is checking for pickaxe if I got pickaxe I can mine rock and get XP for the pickaxe 

if pickaxe XP is above 2 upgrade pickaxe to lv 2 and so on 

so I'm able to store somehow initial value of 0 for XP and add to it check that value and upgrade weapon accordingly 

 

but how to do that opposite way set initial value and subtraction from it???

I hope that is more clear.....

Original thread: https://forums.rpgmakerweb.com/threads/variables.41446/