This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-09-27 01:41:15

RyuHimora
Scratcher
Registered: 2009-09-13
Posts: 7

Using an equation.

Posting in here because this isn't something a lot of people can handle.

I'm trying to implement a damage system using a math equation (or expression, since I'm not trying to solve anything.) to try and recreate the systems used in normal RPG games. The equation is thus:

Damage= (((Attackstat * Attackpower/defensestat)/50)+2)*Random Number from 85-100/100

The problem I am having is getting a result from this equation and modifying a variable based on that result. I can't find any way to do this on my own, so my question is, is what I'm trying to possible in Scratch? I'm using version 1.4, apparently.

Last edited by RyuHimora (2009-09-27 01:41:51)

Offline

 

#2 2009-09-27 09:00:11

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Using an equation.

I may be completely wrong, but is what you are trying to do this:

Damage= (((Attackstat * Attackpower/defensestat)/50)+2)*Random Number from 85-100/100

Health = health - damage

?????

Offline

 

#3 2009-09-27 09:10:01

RyuHimora
Scratcher
Registered: 2009-09-13
Posts: 7

Re: Using an equation.

Essentially, yes. What I'm having trouble doing is getting is number for damage.

Offline

 

#4 2009-09-27 09:24:19

RyuHimora
Scratcher
Registered: 2009-09-13
Posts: 7

Re: Using an equation.

Ha HA! Fixed it by myself.

I was trying to do this:
[blocks]
<if>Damage= (((Attackstat * Attackpower/defensestat)/50)+2)*Random Number from 85-100/100
<end>

(but in the weird spikey hole thingy)

What I just figured out to do was this:

<change{ damage }by( (((Attackstat * Attackpower/defensestat)/50)+2)*Random Number from 85-100/100 )

It works perfectly. I hope this helps some other people.

Last edited by RyuHimora (2009-09-27 09:24:45)

Offline

 

Board footer