More struggles with client side scripts

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
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
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
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

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
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
Heroes of Dawn
Blades of Urdual
Alpha Tester
Joined
Dec 31, 2015
Messages
128
Reaction score
11
Location
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
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
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

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
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
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
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

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
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
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
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

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
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
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
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.
 

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
Have another teaser:
 

Monika's_BFFEx0256

Old Skool Apostle
Joined
Mar 9, 2009
Messages
1,359
Reaction score
70
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
Heroes of Dawn
Blades of Urdual
Alpha Tester
Joined
Dec 31, 2015
Messages
128
Reaction score
11
Location
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
Joined
Jan 24, 2013
Messages
638
Reaction score
89
Location
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.
 

Monika's_BFFEx0256

Old Skool Apostle
Joined
Mar 9, 2009
Messages
1,359
Reaction score
70
Yeah, if you cut at an orc's leg and suddenly a skull gib pops out... we're gonna have to talk.
 

TheOysterHippopotami

Active Adventurer
MSS Developer
DarkTide
Joined
Sep 6, 2009
Messages
1,213
Reaction score
42
Age
36
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

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
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

Active Adventurer
The True Followers of the Lost
Crusaders
Blades of Urdual
Alpha Tester
Joined
Feb 28, 2008
Messages
2,581
Reaction score
37
Age
32
Location
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:
 

Monika's_BFFEx0256

Old Skool Apostle
Joined
Mar 9, 2009
Messages
1,359
Reaction score
70
Critical hits on roll would be really cool, and more DnD esque like how the game is trying to be I think
 

Myrlance

Adventurer
Heroes of Dawn
Blades of Urdual
Alpha Tester
Joined
Dec 31, 2015
Messages
128
Reaction score
11
Location
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