Okay, Im trying to make a basic Ki Attack (Dont make any comments about DBZ, or I'll KameHame-Ha you... Grrr...)
but I cant figure out how to do one thing : Divide.
So I have my verb, Ki_Blast, blah blah blah...
So I get to 'var/damage' and I decide to make it so the attack takes a fourth of your 'PL' and then later doubles it for the damage...
My problem lies in the fact that I dont know what the division symbol is.
ID:148781
Oct 1 2002, 10:47 am
|
|
Oct 1 2002, 11:06 am
|
|
Division symbol is '/' I believe.
|
In response to Mertek
|
|
Okay... This is what I've got...
Ki_Blast(mob/M as mob in oview()) set category = "Combat" view() << "HIIIIIII...." (error line) var/damage = 1/2 usr.PL + rand(0,50) sleep(15) view() << "YA!" if(damage <= 0) usr << "[M] dodges your blast!" oview() << "[M] dodges [src]'s blast!" else M.HP -= damage (error line) usr.PL -= 1/4 usr.PL view() << "[M] is hit by [src]'s Ki Blast!" M:DeathCheck() sleep(35) Then I get two errors, both, coincidentally, where the '/' is used... :( Main.dm:48:error: usr: Expected end of statement Main.dm:58:error: usr: Expected end of statement |
In response to Gathin
|
|
It is a coincidence. The slash was correct. The problem is that multiplication does not just happen between two things typed next to each other.
This is not a legal expression: 1/2 varName This is: 1/2 * varName This is more simple: varName/2 |
In response to ACWraith
|
|
Umm, I solved the problem with a stroke of genius a minute ago... I made it like this :usr.PL -= usr.PL / 4
1/4 usr.PL was just plain stupid of me. |
In response to Gathin
|
|
why not usr.PL *= 3/4
|
In response to Garthor
|
|
Garthor wrote:
why not usr.PL *= 3/4Illegal. When you do usr.PL -= Something You mean to subtract Something from the current value of usr.PL -= is the same thing, and = means equals. I don't really know why they don't have *=, but you really don't need += or -= Ex: myvar += 55 is the same as: mayvar = myvar+55 Except it is longer. |
In response to Nova2000
|
|
Gee, that's funny, because last I checked, it not only worked, but was in the reference. I don't see why you're explaining how += and -= work to me, either. Also, += and -= are features of all (as far as I know) programming language. Last I checked, Dan and Tom weren't needlessly chopping off features of C++.
|
In response to Garthor
|
|
Garthor wrote:
Also, += and -= are features of all (as far as I know) programming language. Well, that's not really true... Visual Basic doesn't. But I assume you meant proper programming languages, so in that case you would be correct. :P |