More struggles with client side scripts

greatguys1

Renowned Adventurer
MSC Developer
Warriors of the North
Apr 20, 2013
309
47
21
Yes
I'm trying to get a blood spurt sfx to work, but while it does, color doesn't seem to work all of the time, resulting in NPCs spurting gray blood. It seems viewing it from certain angles will only allow you to see the red.

The script in question:
Code:
//statotionary, temporary sprite (why is there no function for this?)
//- remember to precache sprite
#scope client
{ client_activate //<owner index> <sprite_name> <render_props> <duration> <model height> <model width>
    //render props format: fadeout:0|1;scale;renderamt;rendermode;rendercolor;framerate;frames

    setvard SFX_OWNER PARAM1
    setvard SPRITE_NAME PARAM2
    setvard RENDER_PROPS PARAM3
    setvard SPRITE_DURATION PARAM4
    setvard MODEL_HEIGHT PARAM5
    setvard MODEL_WIDTH PARAM6

    setvard ANG_OFFSET $rand(-100,100)

    callevent 0.1 spurt_blood
    callevent SPRITE_DURATION remove_me
}

{ spurt_blood

    local L_POS $getcl(SFX_OWNER,origin)
    vectoradd L_POS $vec(0,0,$math(multiply,0.6,MODEL_HEIGHT))

    cleffect tempent sprite SPRITE_NAME L_POS setup_temp_sprite redo_color
    callevent 0.1 spurt_blood
}

{ setup_temp_sprite

    local L_VEL $relvel($vec(0,$math(add,ANG_OFFSET,$getcl(SFX_OWNER,angles.yaw)),0),$vec(0,$math(add,MODEL_WIDTH,30),20))

    cleffect tempent set_current_prop death_delay 1
    if ( $get_token(RENDER_PROPS,0) == 1 ) cleffect tempent set_current_prop fadeout lifetime
    cleffect tempent set_current_prop scale $get_token(RENDER_PROPS,1)
    cleffect tempent set_current_prop renderamt $get_token(RENDER_PROPS,2)
    cleffect tempent set_current_prop rendermode $get_token(RENDER_PROPS,3)
    cleffect tempent set_current_prop rendercolor $get_token(RENDER_PROPS,4)
    cleffect tempent set_current_prop framerate $get_token(RENDER_PROPS,5)
    cleffect tempent set_current_prop frames $get_token(RENDER_PROPS,6)
    cleffect tempent set_current_prop velocity L_VEL
    cleffect tempent set_current_prop gravity 0.3
    cleffect tempent set_current_prop collide none
    cleffect tempent set_current_prop update 1
}

{ redo_color

    cleffect tempent set_current_prop rendercolor $get_token(RENDER_PROPS,4)
}

{ remove_me

    removescript
}
Params sent to it:
Code:
local L_RENDER_PROPS "0;0.15;255;color;"
        stradd L_RENDER_PROPS $clcol(255,0,0)
        stradd L_RENDER_PROPS ";10;10"
        clientevent new all effects/sfx_bleed $get(PARAM1,index) bloodspray.spr L_RENDER_PROPS 10 $get(PARAM1,height) $get(PARAM1,width)
 

Thothie

Administrator
Staff member
Administrator
Moderator
Lead MSC Developer
MSC Developer
Apr 8, 2005
15,987
198
lost
Few things...

- There's already a command for this, "bleed <target> <red|green|yellow> <amt>". (Example usage in monsters/worm_abyssal_head.script) It also handles scaling, scatter, and decaling.

- If you're going to be generating a sprite regularly, ya probably don't want to be sending so many bytes of data to the client each time (particularly when the server's gotta send it to all the clients). Better to have it set in the client script, since they already have that. This dynamic "tell them everything" method is intended for occasional sprites, not the sort that are gonna crop up every strike/every dot tick, potentially on multiple mobs - better that they already know.

- $clcol(<RBG>) is for converting an RBG integer color (eg. 255,0,0) to an RBGA float color (eg. 1.0,0,0,1.0). Sprites, however, use RBG integer colors. This is probably what's bjorking it (beyond the more fundamental issues mentioned above).
 

greatguys1

Renowned Adventurer
MSC Developer
Warriors of the North
Apr 20, 2013
309
47
21
Yes
- There's already a command for this, "bleed <target> <red|green|yellow> <amt>". (Example usage in monsters/worm_abyssal_head.script) It also handles scaling, scatter, and decaling.
This'll be a neat addition to the effect, but it's not a replacement for what I want out of it.
It seems, however, green and yellow are the same, but red doesn't work correctly. The video below shows how red looks.

- $clcol(<RBG>) is for converting an RBG integer color (eg. 255,0,0) to an RBGA float color (eg. 1.0,0,0,1.0). Sprites, however, use RBG integer colors. This is probably what's bjorking it (beyond the more fundamental issues mentioned above).
i shouldve mentioned i tried it without clcol but it turns out the whole problem was me using color instead of normal. normal colors the sprites correctly but color doesn;t. see the video pls
uugh
i
am
very
upset

The first clip shows how the blood command looks when the color is red, the second clip shows the sprites reacting when the rendermode is color, and the color being (255,0,0).
In case it's hard to tell in the video, the blood command spews out white, red, and yellowish particles.

 
Last edited:

Myrlance

Adventurer
Blades of Urdual
Heroes of Dawn
Alpha Tester
Dec 31, 2015
120
9
United States
This'll be a neat addition to the effect, but it's not a replacement for what I want out of it.
It seems, however, green and yellow are the same, but red doesn't work correctly. The video below shows how red looks.


i shouldve mentioned i tried it without clcol but it turns out the whole problem was me using color instead of normal. normal colors the sprites correctly but color doesn;t. see the video pls
uugh
i
am
very
upset

The first clip shows how the blood command looks when the color is red, the second clip shows the sprites reacting when the rendermode is color, and the color being (255,0,0).
In case it's hard to tell in the video, the blood command spews out white, red, and yellowish particles.

Is this in some attempt for implementing critical hits?
 

Thothie

Administrator
Staff member
Administrator
Moderator
Lead MSC Developer
MSC Developer
Apr 8, 2005
15,987
198
lost
re-implemented
Never, had, jagged arrow bleeding. :p

The first clip shows how the blood command looks when the color is red, the second clip shows the sprites reacting when the rendermode is color, and the color being (255,0,0).
In case it's hard to tell in the video, the blood command spews out white, red, and yellowish particles.
Hrmm... Might be a overflow/datatype issue in the bleed command sequence or some such (thus randomizing color), will need to examine the code. (edit: Seem to have fixed that - some odd thing about how UTIL_BloodStream works.)

As for the clscript... Looking at bloodspray.spr, it seems that's a {solid render sprite (alphatest), so ya wanna use rendermode alpha on that.
 

greatguys1

Renowned Adventurer
MSC Developer
Warriors of the North
Apr 20, 2013
309
47
21
Yes
Hrmm... Might be a overflow/datatype issue in the bleed command sequence or some such (thus randomizing color), will need to examine the code. (edit: Seem to have fixed that - some odd thing about how UTIL_BloodStream works.)
Could I get the update that fixes that?

As for the clscript... Looking at bloodspray.spr, it seems that's a {solid render sprite (alphatest), so ya wanna use rendermode alpha on that.
Done

Thanks again
 

Thothie

Administrator
Staff member
Administrator
Moderator
Lead MSC Developer
MSC Developer
Apr 8, 2005
15,987
198
lost
Could I get the update that fixes that?
Sent...

For some reason UTIL_BloodStream needs to receive 70 instead of BLOOD_COLOR_RED (247), but the decal still needs to receive BLOOD_COLOR_RED, so, weird.

Also, this is the simplified script I was using for testing:
Code:
#scope client
{ client_activate //<owner index> 

    setvard SFX_OWNER PARAM1
    setvard SPRITE_DURATION 10.0

    callevent 0.01 spurt_blood
    callevent SPRITE_DURATION remove_me
}

{ spurt_blood

    local L_POS $getcl(SFX_OWNER,origin)
	local L_HEIGHT $getcl(SFX_OWNER,height)
    if ( !$getcl(FX_OWNER,isplayer) ) vectoradd L_POS $vec(0,0,$math(multiply,0.6,L_HEIGHT))

    cleffect tempent sprite bloodspray.spr L_POS setup_temp_sprite
    callevent 0.1 spurt_blood
}

{ setup_temp_sprite

	local L_RND_ANG $randf(0,359.99)
	local L_RND_PITCH $randf(-100,100)
	local L_RND_FORCE $randf(100,200)
    local L_VEL $relvel($vec(L_RND_PITCH,L_RND_ANG,0),$vec(0,0,L_RND_FORCE))

    cleffect tempent set_current_prop death_delay 1
    cleffect tempent set_current_prop scale $randf(0.15,0.2)
    cleffect tempent set_current_prop renderamt 255
    cleffect tempent set_current_prop rendermode alpha
    cleffect tempent set_current_prop rendercolor (255,0,0)
    cleffect tempent set_current_prop framerate 20
    cleffect tempent set_current_prop frames 10
    cleffect tempent set_current_prop velocity L_VEL
    cleffect tempent set_current_prop gravity 0.3
    cleffect tempent set_current_prop collide none
}

{ remove_me

    removescript
}
Just, worth noting you can get the model height from an client side index, as well as whether the target is a player, and thus has a different origin. Thinking ya may as well just start from the center, as it's gonna exit randomly from the model.
 
Last edited:

greatguys1

Renowned Adventurer
MSC Developer
Warriors of the North
Apr 20, 2013
309
47
21
Yes
Also, this is the simplified script I was using for testing:
I'll check this out, but I dunno if it'll quite give the effect I want. I do plan on cutting down the params sent, as you suggested.

Just, worth noting you can get the model height from an client side index, as well as whether the target is a player, and thus has a different origin.
Can you rephrase this? I'm not sure I quite understand. I can't get other monster's width or height via $getcl
 

Thothie

Administrator
Staff member
Administrator
Moderator
Lead MSC Developer
MSC Developer
Apr 8, 2005
15,987
198
lost
I can't get other monster's width or height via $getcl
Ya should be able to. Should return the height of the model index.

Should I be on crack, you can also try $getcl(<index>,center) - though I can't recall what problems that causes, if any.
 

greatguys1

Renowned Adventurer
MSC Developer
Warriors of the North
Apr 20, 2013
309
47
21
Yes
$getcl(SFX_OWNER,height)
$getcl(SFX_OWNER,width)
each return 0

$getcl(SFX_OWNER,center), however, seems to work as intended.
 

Thothie

Administrator
Staff member
Administrator
Moderator
Lead MSC Developer
MSC Developer
Apr 8, 2005
15,987
198
lost
Blah, it's the crack again, apparently.

Center should work - only circumstance where I see it might not is if the mob involved has no collision box, like maybe Wraiths (though they don't bleed, so not an issue here). I suppose it might be a tad screwy if the model has an oversized submodel, like the Mummy's aura (again, bloodless, but I'm sure there's others). Possibly also if the model is oriented off center, but can't think of a mob that does that, off hand, saving when "burrowing" and invulnerable.

Given that it finds its center using mins/maxs bounds, thinking of tweaking that up to return height/width.
 

Lucifer Majiskus

Active Adventurer
Sons of Babel
Alpha Tester
Mar 9, 2009
1,165
29
23
An igloo far up North.
I like the concept, although the gibbing looks a little silly. It is a cool thought that you're cutting out chunks of their organs, but without a physical model change (Brainbread does this well) it looks a bit silly.
 

Myrlance

Adventurer
Blades of Urdual
Heroes of Dawn
Alpha Tester
Dec 31, 2015
120
9
United States
I like the concept, although the gibbing looks a little silly. It is a cool thought that you're cutting out chunks of their organs, but without a physical model change (Brainbread does this well) it looks a bit silly.
Is it possible to have a chance of it happening, greatguys?

Instead of every hit you do .. gibs/bleeds them with the satisfactory sound of medieval combat and grandeur ingame.. maybe it can be random/stat-based chanced and forged into critical hits?
 

Kanta

Old Skool Apostle
Alpha Tester
Jan 24, 2013
503
68
ms_swamp
I think the gibs look fine, so long as the chunks match up at least a little with what you're butchering. Skeletons could give off hunks of bone.

Edit: Pleeeeaaase keep the original gib sound effect, it's so great.
 

TheOysterHippopotami

Active Adventurer
MSS Developer
MSC Developer
RiP
DarkTide
Sep 6, 2009
1,141
27
31
Is it possible to have a chance of it happening, greatguys?

Instead of every hit you do .. gibs/bleeds them with the satisfactory sound of medieval combat and grandeur ingame.. maybe it can be random/stat-based chanced and forged into critical hits?
I agree with this.


Edit: Pleeeeaaase keep the original gib sound effect, it's so great.
And this.
 

greatguys1

Renowned Adventurer
MSC Developer
Warriors of the North
Apr 20, 2013
309
47
21
Yes
Is it possible to have a chance of it happening, greatguys?

Instead of every hit you do .. gibs/bleeds them with the satisfactory sound of medieval combat and grandeur ingame.. maybe it can be random/stat-based chanced and forged into critical hits?
It'll be on a chance, but I dunno if it should be based on a stat, or what stat it'd be based on. I don't think we need a critical hit system, at least not now.

I think the gibs look fine, so long as the chunks match up at least a little with what you're butchering. Skeletons could give off hunks of bone.

Edit: Pleeeeaaase keep the original gib sound effect, it's so great.
Yeah, if you cut at an orc's leg and suddenly a skull gib pops out... we're gonna have to talk.
I've excluded the skull gib specifically because of this. Depending on how stuff turns out, I'll play with the sounds and gibs a bit more.
 

zeus9860

Adventurer
Blades of Urdual
Crusaders
The True Followers of the Lost
Alpha Tester
Feb 28, 2008
2,536
10
27
lolwut
Tbh, i think gib should be used only demonstrate heavy hits on a target, perhaps related to weakness if any. If there was a critical hit system, would make sense for the gib to be there but rarelly, in some sort of case you land a very high critical hit. Some games use critical systems that have multiple tiers, i believe warframe has this from what i remember a few years ago. Or landing a critical final blow to the enemy wouldn't be bad either.

The bleeding effect is on point though. I'm wondering if the blood splash/trail can be changed into something more... excessive in some occasions.

Like this:
 

Myrlance

Adventurer
Blades of Urdual
Heroes of Dawn
Alpha Tester
Dec 31, 2015
120
9
United States
It'll be on a chance, but I dunno if it should be based on a stat, or what stat it'd be based on. I don't think we need a critical hit system, at least not now.



I've excluded the skull gib specifically because of this. Depending on how stuff turns out, I'll play with the sounds and gibs a bit more.
Critical hits on roll would be really cool, and more DnD esque like how the game is trying to be I think
I think it would be awesome to have those random critical hits either boosted or less-chanced based on skill and/or enemy hp, or just entirely random.
 
Top