Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Iterator
(5 posts) bio
|
| Date |
Sun 12 Feb 2012 08:56 PM (UTC) [ quote
] |
| Message |
Hi everyone. I'm new to MUSH scripting (and scripting in general) but do have a background in Java.
I'm currently playing a mud where a certain ability rages you and you can't see your HP. I'm wanting to have a script that I can call from triggers and have it tally how much damage I've taken.
I've figured out an average of which hit takes how much: very hard, extremely, pulverized, etc. So these triggers would call the script and the script would add this value to the total and some how display this to the user.. or possibly deduct it from that characters total hp and return that.
Is this possible, and if so could someone point me in the right direction?
Thanks!
/iterator
| top |
|
| Posted by |
Kyrock
(20 posts) bio
|
| Date |
Reply #1 on Fri 08 Jun 2012 09:26 PM (UTC) [ quote
] |
| Message |
don't know if you're still wanting an answer.
var rageTracker = {
hp: 0,
veryHard: 5,//don't know avg damages so I'm making them up
extremely: 10,
pulverized: 20,
etc: 40,
init: function(currentHp) {
this.hp = currentHp;
}
//this function treats its argument as a string.
hpMod: function(gotHit) {
//replace any white space with no space
//then make it lower case.
var hitSeverity = gotHit.replace(" ","").toLowerCase();
//if passed veryhard then hitSeverity is equal to 5 and etc.
hitSeverity = this[hitSeverity];
//hp is modified and then noted in the world
this.hp = this.hp - hitSeverity;
world.Note(this.hp);
}
}
When you log in you'd set your hp with an alias with the code:
or what ever your current hp is. then in your triggers...if the message is something like: "you get hit very hard" you'd send to script:
rageTracker.hpMod("very hard");
then you'd get a note saying 75 (80 - 5 = 75) | top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
650 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )