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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Hogwash
Newbie


Joined: 09 Jun 2020
Posts: 2

PostPosted: Tue Jun 09, 2020 4:32 pm   

Advice on scripting strategy
 
Hi,
I'm not a trained coder, but I can manage logic from excel use etc. I'm looking for some advice if I'm on the right track.

I want to work out an NPC's hp when the only info I am given is a damage message that corresponds to a range.
I think I can do it via multiple sampling (ie killing things a lot)

I thought I could do this by:
Trigger on damage message creates an upper and lower damage variable
Repeat summing in the variables
Trigger on death and write the variables to a database
Refine the database over time with a formula field

Before I spend ages trying to write this, can any gurus see a problem?
Reply with quote
hpoonis2010
Wanderer


Joined: 18 Jun 2019
Posts: 96

PostPosted: Tue Jun 09, 2020 5:01 pm   
 
I know your frustration. I don't think it is possible to gauge such a thing accurately. I tried on a mud. Naked and in combat; slowly killed same mobs and applied buffs and eq but the results varied up and down throughout. Unless you can cajole the bod in charge to cough up base/average damage stats all you can do is guess and that may not be accurate enough to stop you getting walloped.
Reply with quote
chaossdragon
Wanderer


Joined: 09 Apr 2008
Posts: 70

PostPosted: Tue Jun 09, 2020 10:16 pm   
 
Just curious but what damage messages are you getting for the NPC's health?

I had done something on a mud that more or less had the same issue... It wasn't perfect but worked well enough for my needs.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4190
Location: Pensacola, FL, USA

PostPosted: Wed Jun 10, 2020 12:56 pm   
 
Assuming you get regular prompts showing you your current HP, this should not be TOO hard.

Code:
#TR {HP: (%d)/(%d)} {
  $newHp=%1
  $hpChange=(@hpCurrent-$newHP)
  #IF ($hpChange>0) {#RAISE onTookDamage $hpChange}
  hpCurrent=%1
  }

#TR {Some damage message} {
  lastDamage=%line //or some unique keyword for the dbVar
  $this=%db(@damageTable, @lastDamage)
  $low=%db($this, "Low")
  $high=%db($this, "High")
  #SAYADD { -- took from $low to $high}
  }

#EVENT onTookDamage {
  $damage=%1
  $key=@lastDamage
  $this=%db(@damageTable, $key)
  #IF (($damage<%db($this, Low)) OR (%db($this, Low)=%null)) {#ADDKEY $this Low $damage}
  #IF (($damage>%db($this, High)) OR (%db($this, High)=%null)) {#ADDKEY $this High $damage}
  #ADDKEY damageTable $key $this
  }
_________________
Discord: Shalimar#3679
Reply with quote
Hogwash
Newbie


Joined: 09 Jun 2020
Posts: 2

PostPosted: Wed Jun 10, 2020 3:55 pm   
 
Thanks for replies.

@hpoonis 2010 Unless the NPC has dynamic hp the stats will work out eventually. How many samples you need, I can't say because I don't know the damage range compared to the hp. However, given that a lot of MUDS were based off Dungeons and Dragons in some way, dynamic hp based on level x d8 is not a silly thought. In any case, I will find out :)

@chaossdragon The messages are for how damaging the attack is. I believe they are correct after modification for armour and they are not dynamic. So "smashed" always means 10-19 damage, "mangled" always means 20-29 etc.

@shalimar I do get hp at prompt for my character, but that isn't what I want to collect. I just want to collect the upper and lower potential damage ranges done every round until the beasty dies. But thanks for the code! I will take it away and try to work it out.
Reply with quote
chaossdragon
Wanderer


Joined: 09 Apr 2008
Posts: 70

PostPosted: Wed Jun 10, 2020 10:42 pm   
 
Ah... then I completely mis-understood what you wanted. :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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