Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Damage to player & statistic checks.

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
satyrisci
~guo~




Joined: 28 Feb 2007
Posts: 73

PostPosted: Sat Jun 09, 2007 7:50 am    Post subject: Damage to player & statistic checks. Reply with quote

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. Happy
Back to top
View user's profile Send private message
Uncommon
His legend will never die




Joined: 10 Mar 2003
Posts: 2503

PostPosted: Sat Jun 09, 2007 2:40 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address
satyrisci
~guo~




Joined: 28 Feb 2007
Posts: 73

PostPosted: Sat Jun 09, 2007 5:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Sat Jun 09, 2007 5:36 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sat Jun 09, 2007 10:48 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Sun Jun 10, 2007 8:16 am    Post subject: Reply with quote

Oh, right, right. Thanks.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
satyrisci
~guo~




Joined: 28 Feb 2007
Posts: 73

PostPosted: Sun Jun 10, 2007 12:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Sun Jun 10, 2007 3:39 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Sun Jun 10, 2007 5:14 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Sun Jun 10, 2007 11:58 pm    Post subject: Reply with quote

Fixed, thanks. This is the problem with scripting off the top of my head.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Jun 12, 2007 8:17 pm    Post subject: Re: Damage to player & statistic checks. Reply with quote

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
View user's profile Send private message Send e-mail
satyrisci
~guo~




Joined: 28 Feb 2007
Posts: 73

PostPosted: Wed Jun 13, 2007 5:06 am    Post subject: Reply with quote

Ah, thanks guys. It's working great now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group