View previous topic :: View next topic |
Author |
Message |
satyrisci ~guo~

Joined: 28 Feb 2007 Posts: 73
|
Posted: Sat Jun 09, 2007 7:50 am Post subject: Damage to player & statistic checks. |
|
|
Hi, I've tried a few times and can't seem to get this working.
Firstly, I would like to have a step on NPC do a stat roll. ie checks a certain stat of the hero and adds a random number. This is then weighted up against a "difficulty value" which also has a random number added to it. If the hero's total equals or betters the difficulty value then the roll is succesful and an appropriate event happens. Likewise in the event of a failed roll.
One example I have is broken glass. I would like the game to test the hero's agility + random number between 0 and 4 against a difficulty of 8 + random (0,6).
If the test is succesful then the player can continue as normal, whereas if the test fails the hero takes damage.
Any easy way of deducting HP through scripting?
Replies appreciated, thanks in advance.  |
|
Back to top |
|
 |
Uncommon His legend will never die

Joined: 10 Mar 2003 Posts: 2503
|
Posted: Sat Jun 09, 2007 2:40 pm Post subject: |
|
|
That sounds like a save roll in D&D. Nice.
What you're after is get hero stat and set hero stat. The first can check the value of any stat (including HP), and the second can change that value. |
|
Back to top |
|
 |
satyrisci ~guo~

Joined: 28 Feb 2007 Posts: 73
|
Posted: Sat Jun 09, 2007 5:14 pm Post subject: |
|
|
With set herostat, what is the best way to get it to deduct a given amount instead of setting hp to a set value.
Thanks. |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Sat Jun 09, 2007 5:36 pm Post subject: |
|
|
As its own script:
Code: | script, lose hp, who, quantity (
set hero stat (stat: HP, who, get hero stat (stat: HP, get hero stat, current stat) -- quantity, current stat)
) |
or you can put that line inside of a larger script. The power is yours! _________________
|
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Sat Jun 09, 2007 10:48 pm Post subject: |
|
|
Moogle means:
Code: | script, lose hp, who, quantity (
set hero stat (who, stat: HP, get hero stat (who, stat: HP, current stat) -- quantity, current stat)
) |
It relies on you importing your HSI file. So if you renamed your HP stat, you'lll need to change that of course. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Sun Jun 10, 2007 8:16 am Post subject: |
|
|
Oh, right, right. Thanks. _________________
|
|
Back to top |
|
 |
satyrisci ~guo~

Joined: 28 Feb 2007 Posts: 73
|
Posted: Sun Jun 10, 2007 12:39 pm Post subject: |
|
|
And you could lose the "current stat" part because it defaults to that anyway.
Cheers for that, no ideas on the D&D style stat roll?
A "damage hp(amount)" command would be a nice addition.
Appreciated. |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Sun Jun 10, 2007 3:39 pm Post subject: |
|
|
Okay, here's a script to check if a stat is above a certain amount:
Code: | script, check stat, who, stat, amt (
return (get hero stat(who, stat) >= amt)
) |
Tying these two together, you might have a script that looks like this:
Code: | if (check stat(leader, stat:Dog, 8 + random(0,6)) == false)
then (lose hp(hero, random(25,50))) |
Or in other words, if the leader's Dodge stat isn't greater than 8-14, he loses 25-50 HP. _________________
Last edited by Moogle1 on Sun Jun 10, 2007 11:57 pm; edited 1 time in total |
|
Back to top |
|
 |
msw188
Joined: 02 Jul 2003 Posts: 1041
|
Posted: Sun Jun 10, 2007 5:14 pm Post subject: |
|
|
Simple mistake, Moogle1 forgot a closing parenthesis after the random(0,6) to close the arguments of his check stat function.
EDIT: Never mind, he edited and fixed it. _________________ My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161
This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com
Last edited by msw188 on Mon Jun 11, 2007 5:22 am; edited 1 time in total |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Sun Jun 10, 2007 11:58 pm Post subject: |
|
|
Fixed, thanks. This is the problem with scripting off the top of my head. _________________
|
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Tue Jun 12, 2007 8:17 pm Post subject: Re: Damage to player & statistic checks. |
|
|
satyrisci wrote: |
One example I have is broken glass. I would like the game to test the hero's agility + random number between 0 and 4 against a difficulty of 8 + random (0,6). |
More exactly, that would be
Code: | if (get hero stat(who, stat) + random(0, 4) >= 8 + random(0, 6))
then (lose hp(hero, random(25,50)))
|
_________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
satyrisci ~guo~

Joined: 28 Feb 2007 Posts: 73
|
Posted: Wed Jun 13, 2007 5:06 am Post subject: |
|
|
Ah, thanks guys. It's working great now. |
|
Back to top |
|
 |
|