Page 1 of 2
Debugging Combat
Posted: August 26th, 2012, 11:44 pm
by Lou
Hi,
I followed the tutorials and created my melee combat scenario and I can kill my mob, Yay!!!
Now I want to be able to see the effects of combat in my console and I wanted to know, how
do I see the stats and values for the critter and the combat with the critter? Is there a debug command I can put around the
scripts to print out the data to the console?
Regards,
Lou
Re: Debugging Combat
Posted: August 27th, 2012, 10:59 pm
by Hirato
Turn on the status, projectile and entity debug channels.
You'll find most of the details in the "status effect" submenu anyhoo
Re: Debugging Combat
Posted: August 28th, 2012, 1:55 pm
by Lou
Hi,
Thanks for the info, I had most of this stuff on, I turned on the "status effects" but I did not
get any more data printed out.
Now worries I am going to keep digging and coding.
Lou
Re: Debugging Combat
Posted: August 28th, 2012, 2:55 pm
by Lou
Hi,
Okay it looks like it did add more but I found it in the STDOUT file.
Code: Select all
DEBUG: pushed rpgchar type 0A7D5890 onto reference self
DEBUG: registering end-of-stack reference 00000000 to name actor
DEBUG: reference actor set to null
DEBUG: searching for reference ent, via reference self:0
DEBUG: reference "self" found, returning 0A8A2480
DEBUG: searching for reference obj, via reference player:0
DEBUG: reference "player" found, returning 06EAA298
DEBUG: reference "self" found, returning 0A8A2480
DEBUG: clearing AI directives for entity 0A7D5890
DEBUG: reference "self" found, returning 0A8A2480
DEBUG: reference "player" found, returning 06EAA298
DEBUG: adding attack directive to entity 0A7D5890; target 025BDFE8 priority 1
DEBUG: popping stack...
DEBUG: freeing reference actor
DEBUG: freeing reference self
DEBUG: new depth is 1
DEBUG: reference hover set to null
DEBUG: freeing reference examine
DEBUG: freeing reference inventory
DEBUG: freeing reference curmap
DEBUG: freeing reference talker
DEBUG: freeing reference trader
DEBUG: freeing reference looter
DEBUG: freeing reference hover
DEBUG: freeing reference player
I can see the attack directive kicked off, but I was hoping for the stats and values too.
Lou
Re: Debugging Combat
Posted: August 28th, 2012, 3:21 pm
by Lou
WOOT!!!!
I got one step closer to what I needed!!!
I modified the hud_standard file with the following:
Code: Select all
//Mod by Lou
r_hud [
if (!= (r_get_state player) $CS_DEAD) [
if (!= (r_reftype hover) $REF_INVALID) [
local str
local str2 //<---------Add a second local variable here
case (r_reftype hover) $REF_ITEM [
r_select_item hover [
str = (format "%1 (%2)" (r_item_name_get) (r_item_quantity_get))
]
] $REF_CONTAINER [
if (|| (= (r_get_faction hover) -1) [= (r_get_faction player) (r_get_faction hover)] [r_hostile player hover]) [
str = (r_get_name hover -1)
] [
//not yours and faction friendly - warn
str = (concatword "^f3" (r_get_name hover -1))
]
] () [
str = (r_get_name hover -1)
str2 = (r_get_health hover) //<--------Get the health of the critter you hover over
]
//Add the string to the end of the display so that it shows after the name------------|
r_hud_text (divf (-f $hud_right (text_width $str)) 2) (+f (divf $hud_bottom 2) 16) 1 0xFFFFFF $str $str2
]
//**This is the Minimap HUD placement code
//old hud_bottom 456)
r_hud_minimap player (- $hud_right 288) (- $hud_bottom 1200) 256 256
Now when I mouse over the Enemy as I swing my sword I see his health drop as well as see him REGEN his health!!!!
Enjoy
Lou
Re: Debugging Combat
Posted: August 29th, 2012, 11:12 pm
by Lou
Hi,
Can you please give me a break down of the Status Bar Parms. I want to try and put a health bar above the head instead of a number.
So far I have this:
Code: Select all
//This is the standard text above the head and the bar will be ontop of this for now.
r_hud_text (divf (-f $hud_right (text_width $str)) 2) (+f (divf $hud_bottom 2) 16) 1 0xFFFFFF $str $str2
//Try to put a status health bar above the hover target
statusbar (divf (-f $hud_right) 2) (+f (divf $hud_bottom 2.5) 5) 1 (r_get_health hover) (r_get_maxhealth hover) 0xFF0000 1 0
The max health works but there is no bar in red so I must not have something right with the parms?
I searched around and I cannot find any DOC on the status bar is this a new GUI feature?
Regards,
Lou
Re: Debugging Combat
Posted: September 1st, 2012, 4:55 pm
by Lou
Hi,
In order to hover over items and not have them show the health too, you can add a check for a $REF_CHAR type.
Code: Select all
if (r_reftype) $REF_CHAR [
str2 = (r_get_health hover)
] [ //Else path for character check
str2 = " "
]
Have Fun,
Lou
Re: Debugging Combat
Posted: September 3rd, 2012, 10:29 pm
by Lou
I see now. The status bar is defined right in the hud file.
I totally missed it.
Re: Debugging Combat
Posted: September 3rd, 2012, 11:00 pm
by Hirato
the HUD stuff is a 2.7.1 feature, the HUD in its entirety is defined in the cfg, excepting the "hudlines"
http://www.svn.kids.platinumarts.net/32 ... rpghud.cpp
Code: Select all
ICOMMAND(r_hud_minimap, "sffff", (const char *r, float *x, float *y, float *dx, float *dy),
ICOMMAND(r_hud_horizbar, "sfffffii", (const char *i, float *x, float *y, float *dx, float *dy, float *p, int *col),
ICOMMAND(r_hud_vertbar, "sfffffi", (const char *i, float *x, float *y, float *dx, float *dy, float *p, int *col),
ICOMMAND(r_hud_text, "fffis", (float *x, float *y, float *sz, int *col, const char *s),
ICOMMAND(r_hud_image, "sffffi", (const char *i, float *x, float *y, float *dx, float *dy, int *c),
ICOMMAND(r_hud_solid, "ffffi", (float *x, float *y, float *dx, float *dy, int *c),
ICOMMAND(hudline, "C", (const char *t), hudline("%s", t));
ICOMMAND(r_hud, "e", (uint *body),
those are the prototypes - they're the closest to actual documentation that currently exists.
key
- e - requires code/script
- s/C - string
- i - integer
- f - floating point
- *i - I should've used *tex - refers to an image file
- x/y+dx/dy | sz - refers to offsets and size
- *c - colour, eg 0xFFFFFF for white
Re: Debugging Combat
Posted: September 6th, 2012, 1:32 pm
by Lou
Thanks Hirato that helps a bunch,
I wanted to add a portrait of the player instead of just his name so I will add that and post back with a sample.
Lou