Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Valheru
Newbie


Joined: 26 Jul 2003
Posts: 2
Location: Malaysia

PostPosted: Sat Jul 26, 2003 10:54 pm   

Damage Calculation
 
I would like to know if there's a way to calculate damage based on the following formula.

damage = exp gained per hit/2

The mud could be set to display exp total after each hit but I can't figure out how to set the trigger to keep both old and new exp.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jul 26, 2003 11:02 pm   
 
Assuming that the experience is displayed in the prompt, you need to capture the experience displayed in the prompt and save it in a variable. Then, subtract the value of this variable from the current amount of experience the prompt displays. Example:
#TRIGGER {(%d)exp~>} {#SH Damage was: %eval((%1 - @exp) / 2);#VAR exp %1} "" {prompt|nocr}
Reply with quote
Valheru
Newbie


Joined: 26 Jul 2003
Posts: 2
Location: Malaysia

PostPosted: Sun Jul 27, 2003 5:51 am   
 
The show works but if I want it to display on status ?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Jul 27, 2003 5:34 pm   
 
Define the status bar as follows:
#STATUS {Damage was: @damage}

and then replace the whole #SH command with:
#VAR damage %eval((%1 - @exp) / 2)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot 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

© 2009 Zugg Software. Hosted by Wolfpaw.net