PDA

View Full Version : Health Blur Script



Rob Oplawar
February 9th, 2009, 06:45 PM
Hey guys, I got contacted by some SP modders (http://www.youtube.com/user/BeachpartyClan) who were interested in my health blur effect (http://www.youtube.com/watch?v=grwKihjjj_c), so I sent them this response, and I figured some people here might like to hear it as well.


This script (along with a ton of other stuff) was going to go public in a month or so anyway, depending on when I finish setting up the new BCE website.

Anyways, it uses (cinematic_screen_effect_set_convolution). I had to reverse engineer how this function works; here's the arguments:

(cinematic_screen_effect_set_convolution a b c d e)
a: integer, number of passes (more makes smoother image, lower framerate)
b: integer, blur type (there are a couple of types that look different; you might play around with that a bit)
c: real, starting blur (percent; the screen will jump instantly to this blur amount)
d: real, ending blur (percent; the screen will then fade to this amount of blur)
e: real, number of seconds for the transition from c to d


In order for this to actually do anything, you need to call
(cinematic_screen_effect_start 1) to enable the blur effect (note, this will break weapon scope bitmaps! I'm still working on a workaround for that)
Just use (cinematic_screen_effect_start 0) to turn it off again when you need to.


The complete health blur script looks like this:



(global real health_blur 0.0)
(global real prev_health_blur 0.0)
(global unit playerunit (unit (list_get (players) 0)))
(script continuous healthblur
(begin
(set health_blur
;if you play with the parameters in this section you can change the amount
;of the blur and its dependency on health and shields
(* 10.0
(* 2.0 (max 0.0 (- 0.7 (unit_get_shield playerunit) ) ) )
(- 1.5 (unit_get_health playerunit ) )
)
)
(if (!= prev_health_blur health_blur)

(begin
(cinematic_screen_effect_set_convolution 1 2
prev_health_blur health_blur 1)
(set prev_health_blur health_blur)
)

)
(sleep 30)
)
)

(script startup main
(cinematic_screen_effect_start 1)
)


The red effect that grows around the edges of the screen is actually a custom shield meter bitmap in the HUD. It's the inverse of your normal shield meter (instead of shrinking when you take damage it grows). When the new BCE site goes live the bitmap and the associated tags will be available, but I think at this point you know enough to figure it out on your own.


I always love hearing people are working on single player campaigns. It took a while, but Halo is finally starting to really mature into the SP modding phase.



Cheers, guys!
-Rob


Update:
So, I want to encourage the sharing of ideas amongst our community (if I wasn't, I'd hoard this script all to myself) so I'm going to specify two conditions for you to use this script and any other items I post related to BCE. Once the website goes up this will be made an official license agreement for most of the available downloads, based on the Gnu General Public License. I'm not going to enforce this in any way except to maybe send you an angry e-mail if you piss me off, but please guys, we're a community; share.

#1: Cite the name of everybody who worked on or otherwise contributed to a resource you explicitly feature. (an example of this is this youtube video (http://www.youtube.com/watch?v=e0Lrc6RM3Pw); if you're making a big deal out of something, please don't imply that it is yours alone)
#2: Share your modified resource. This is the main point here. I'm sharing this and other things with the assumption that it will be shared by the community, so the primary condition for you being allowed to modify anything is that you make the modifications available in the same way the original was. The example here is that if you modify the health blur script, please post your modified version here.


So, I'm not trying to be a copyright nazi or a self-absorbed prick here; the whole reason for these requirements is again to promote sharing of ideas amongst the community. Happy modding!

Inferno
February 9th, 2009, 06:55 PM
I may implement this into the infernal map pack. It's really cool.

il Duce Primo
February 10th, 2009, 05:35 PM
It was terrible when I played the level. Made everything extemely frustrating.

Rob Oplawar
February 10th, 2009, 07:08 PM
Your face is extremely frustrating.

No but seriously.
The purpose of it is to punish the player for trying to fight like the master chief, since ODSTs are not as strong, without actually changing the amount of damage you can take. In other words, it's supposed to encourage you to be more tactical without dooming you to instant death if you make a mistake.

I could maybe add an option in the menu to disable it? I'm not one to force people to do things a certain way, so if people don't like it they should be able to turn it off.

Limited
February 10th, 2009, 08:00 PM
Holy shit thats awesome. If only Bridge was released so I could play this awesomeness myself...

Heathen
February 10th, 2009, 08:03 PM
I like this.

what I like more is the youtube comments on CE videos.

if they arent going OMG SWEET HOLY TITFUCKING JESUS CHRIST! WHERE IS THE DL?

They are debating amongst themselves how this is possible, which Halo it is, or which of the original weapons it is a mod of.

SilentChaos
February 10th, 2009, 08:33 PM
This is awesome, thanks.
Wish i coud play Bridge CE, the video was pretty interesting.

Con
February 10th, 2009, 08:35 PM
I could get used to it.

legionaire45
February 10th, 2009, 08:45 PM
I'm not particularly versed in Halo's scripting capabilities, but would it be possibly to have blur the screen slightly when the player moves to simulate some kind of fake motion blurring? Maybe base it off the player's move speed, if at all possible?

Also, pretty damn smart way of tweaking the gameplay; nice job!

Advancebo
February 10th, 2009, 08:52 PM
Nice script, but BP guy is a nub on halomaps :V
He sometimes takes credit from other people for their content.

Heathen
February 10th, 2009, 09:09 PM
grwKihjjj_c
Sorry, I had to embed it.

For some reason youtube wouldn't load for me.
Looks decent.

Alwin Roth
February 10th, 2009, 09:45 PM
wait... Bridge Ce, what was that?

ThePlague
February 10th, 2009, 11:03 PM
That's a pretty cool thing you made, makes getting shot more...interesting.

Ifafudafi
February 10th, 2009, 11:09 PM
If you could h4x it so that rather than being a lasting screen overlay at low health, it's merely a sort of flash when you get hit (think UT3), it would be even better, but pretty cool as it is.

I've got no idea how to script for Halo, though, so it's not like I know anything. :v:

Rob Oplawar
February 10th, 2009, 11:18 PM
simulate some kind of fake motion blurring? I can't think of a way to do that, but it might be possible. In the early days of BCE I asked a couple of experienced HUD guys to do exactly this for me, and they all said it was impossible, so yeah. Never say never.


Nice script, but BP guy is a nub on halomaps :V
He sometimes takes credit from other people for their content.
Well shucks, y'all know it was me. I'm not too worried.


If you could h4x it so that rather than being a lasting screen overlay at low health, it's merely a sort of flash when you get hit (think UT3)
I could definitely do that. Later on I plan to do some playtests with random people on campus, so I might test a couple of different versions of this effect.

Alwin Roth
February 11th, 2009, 04:10 PM
wait... Bridge Ce, what was that?
-_-

Advancebo
February 11th, 2009, 05:36 PM
Its a custom SP map.

Disaster
February 11th, 2009, 05:39 PM
Hey rob, you still working on BCE?

sdavis117
February 11th, 2009, 08:18 PM
It would be perfect to mash this together with regenerating health.

Rob Oplawar
February 11th, 2009, 11:07 PM
Hey rob, you still working on BCE?yes.

It would be perfect to mash this together with regenerating health.It kinda is regenerating health. In BCE you have no health or shield meters, just the blur and red glow effects. You take damage, you take cover, you heal.

SnaFuBAR
February 12th, 2009, 12:02 AM
yes.
just the blur and red glow effects. You take damage, you take cover, you heal.
COD GOD MODE

Pooky
February 12th, 2009, 11:14 AM
yes.
It kinda is regenerating health. In BCE you have no health or shield meters, just the blur and red glow effects. You take damage, you take cover, you heal.

I thought the blur was your shields :S

Rob Oplawar
February 12th, 2009, 05:07 PM
I've updated my original post (http://www.modacity.net/forums/showthread.php?p=361412#post361412) with "licensing" information.

Sasc
February 12th, 2009, 08:12 PM
Ok well I've been working on a version of Rob Oplawar's BCE health blur effect for multiplayer. And it's pretty much done!

Here's (http://files.filefront.com/health+blurzip/;13272914;/fileinfo.html) the file containing:

Script
Zoom bitmaps
HUD tags
readme

Here's a Youtube vid showing the effect:
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/e0Lrc6RM3Pw&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/e0Lrc6RM3Pw&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>


Here's the raw script (doesn't contain comments, just as a quick look):


(global short num7 0)
(global short num6 0)
(global short num5 0)
(global short num4 0)
(global short num3 0)
(global short num2 0)
(global short num1 0)
(global short numhb 0)

(script continuous zoom_true
(if
(and
(= (player_action_test_zoom) true)
(= (unit_get_health (unit srvr_check)) -1))
(begin
(cinematic_screen_effect_stop)
(player_action_test_reset)
)
)
)

(script continuous fullhealth
(if
(and
(= (unit_get_health (unit (list_get (players) 0))) 1)
(= (unit_get_health (unit srvr_check)) -1))
(begin
(set num7 0)
(set num6 0)
(set num5 0)
(set num4 0)
(set num3 0)
(set num2 0)
(set num1 0)
(set numhb 0)
)
)
)

(script continuous nohealth
(if
(or
(= (unit_get_health (unit (list_get (players) 0))) 0)
(= (unit_get_health (unit (list_get (players) 0))) -1))
(cinematic_screen_effect_stop)
)
)

(script continuous health7bar
(if
(and
(< (unit_get_health (unit (list_get (players) 0))) 1)
(>= (unit_get_health (unit (list_get (players) 0))) 0.876)
(!= (unit_get_health (unit (list_get (players) 0))) 0)
(!= (unit_get_health (unit (list_get (players) 0))) -1)
(= (unit_get_health (unit srvr_check)) -1)
(= num7 0))
(begin
(set num7 1)
(cinematic_screen_effect_start 1)
(cinematic_screen_effect_set_convolution 1 2 3 0 1.4)
)
)
)

(script continuous health6bar
(if
(and
(< (unit_get_health (unit (list_get (players) 0))) 0.875)
(>= (unit_get_health (unit (list_get (players) 0))) 0.751)
(!= (unit_get_health (unit (list_get (players) 0))) 0)
(!= (unit_get_health (unit (list_get (players) 0))) -1)
(= (unit_get_health (unit srvr_check)) -1)
(= num6 0))
(begin
(set num6 1)
(cinematic_screen_effect_start 1)
(cinematic_screen_effect_set_convolution 1 2 5 0 1)
)
)
)

(script continuous health5bar
(if
(and
(< (unit_get_health (unit (list_get (players) 0))) 0.75)
(>= (unit_get_health (unit (list_get (players) 0))) 0.626)
(!= (unit_get_health (unit (list_get (players) 0))) 0)
(!= (unit_get_health (unit (list_get (players) 0))) -1)
(= (unit_get_health (unit srvr_check)) -1)
(= num5 0))
(begin
(set num5 1)
(cinematic_screen_effect_start 1)
(cinematic_screen_effect_set_convolution 2 2 6 0 1.1)
)
)
)

(script continuous health4bar
(if
(and
(< (unit_get_health (unit (list_get (players) 0))) 0.625)
(>= (unit_get_health (unit (list_get (players) 0))) 0.501)
(!= (unit_get_health (unit (list_get (players) 0))) 0)
(!= (unit_get_health (unit (list_get (players) 0))) -1)
(= (unit_get_health (unit srvr_check)) -1)
(= num4 0))
(begin
(set num4 1)
(cinematic_screen_effect_start 1)
(cinematic_screen_effect_set_convolution 5 2 8 0 1.2)
)
)
)

(script continuous health3bar
(if
(and
(< (unit_get_health (unit (list_get (players) 0))) 0.5)
(>= (unit_get_health (unit (list_get (players) 0))) 0.376)
(!= (unit_get_health (unit (list_get (players) 0))) 0)
(!= (unit_get_health (unit (list_get (players) 0))) -1)
(= (unit_get_health (unit srvr_check)) -1)
(= num3 0))
(begin
(set num3 1)
(cinematic_screen_effect_start 1)
(cinematic_screen_effect_set_convolution 8 2 10 0 1.5)
)
)
)

(script continuous health2bar
(if
(and
(< (unit_get_health (unit (list_get (players) 0))) 0.375)
(>= (unit_get_health (unit (list_get (players) 0))) 0.251)
(!= (unit_get_health (unit (list_get (players) 0))) 0)
(!= (unit_get_health (unit (list_get (players) 0))) -1)
(= (unit_get_health (unit srvr_check)) -1)
(= num2 0))
(begin
(set num2 1)
(cinematic_screen_effect_start 1)
(cinematic_screen_effect_set_convolution 8 2 11 0 1.8)
)
)
)

(script continuous health1bar
(if
(and
(< (unit_get_health (unit (list_get (players) 0))) 0.25)
(>= (unit_get_health (unit (list_get (players) 0))) 0)
(!= (unit_get_health (unit (list_get (players) 0))) 0)
(!= (unit_get_health (unit (list_get (players) 0))) -1)
(= (unit_get_health (unit srvr_check)) -1)
(= num1 0))
(begin
(set num1 1)
(cinematic_screen_effect_start 1)
(cinematic_screen_effect_set_convolution 8 2 12 0 2.5)
)
)
)

(script continuous healthheartbeat
(if
(and
(< (unit_get_health (unit (list_get (players) 0))) 0.25)
(!= (unit_get_health (unit (list_get (players) 0))) 0)
(!= (unit_get_health (unit (list_get (players) 0))) -1)
(= (unit_get_health (unit srvr_check)) -1))
;This script repeats as there is no num variable changing
(begin
(if
(= numhb 0)
(begin
(set numhb 1)
(sleep 80)
)
)
(cinematic_screen_effect_start 1)
(cinematic_screen_effect_set_convolution 1 2 8 0 0.5)
(sleep 25)
)

)
)

As some of you may be already be aware, the convolution effect screws up the zoom bitmap. I believe this is because the zoom uses it's own convolution effect and (cinematic_screen_effect_start 1) stops this effect, which also stops the bitmaps. The workaround I have found is to move the bitmaps from the Screen Effect section to the Crosshairs section of the weapons' hud tag. This is done for all weapons that have a zoom.

http://img3.imageshack.us/img3/6056/crosshairsafteryh8.jpg

http://img3.imageshack.us/img3/5653/screeneffectafterul2.jpg

Luckily, the zoom bitmaps look almost exactly the same as the originals.

I was the only one working on this. You guys can do whatever you want with the script, bitmaps and hud tags. Thanks to Rob for explaining the convolution effect and it's script code. ;)

I haven't tested this code on a dedicated server so there *might* be some bugs.

Good luck!

Rob Oplawar
February 13th, 2009, 12:44 AM
As some of you may be already be aware, the convolution effect screws up the zoom bitmap. I believe this is because the zoom uses it's own convolution effect and (cinematic_screen_effect_start 1) stops this effect, which also stops the bitmaps. The workaround I have found is to move the bitmaps from the Screen Effect section to the Crosshairs section of the weapons' hud tag. This is done for all weapons that have a zoom.

Ah, that explains it. Good work!

Limited
February 13th, 2009, 12:49 AM
Hmm I could make this into an app that would work for any map as a side-addon.

Great to hear you still working on Bridge :D

Masterz1337
February 13th, 2009, 01:02 AM
Hmm I could make this into an app that would work for any map as a side-addon.

Great to hear you still working on Bridge :D

Ooooooh you have no idea.

Limited
February 22nd, 2009, 07:02 PM
~ Bump ~

Uses an app I'm currently making to apply the blur, meaning it will work on any map (SP or MP) and you'll be able to change the amount of blurring.
avgGx5A5c1E

Disaster
February 22nd, 2009, 07:48 PM
heh. Thats awesome.

Syuusuke
February 22nd, 2009, 07:51 PM
Coolbeans.

DrunkenSamus
February 22nd, 2009, 08:20 PM
Nine Inch Nails? Why?

bobbysoon
February 22nd, 2009, 08:20 PM
could it be rigged to stun like it is shield level?

Limited
February 23rd, 2009, 05:31 AM
could it be rigged to stun like it is shield level?
Stun as in? Blur appears when shields down?, I will probably add in a health parameter too, so if its low health more blur will be added.

Reason for shields in video is because they automatically regenerate smoothly, whereas with health if I walk over a health pack it just boosts up straight away.

bobbysoon
February 23rd, 2009, 04:50 PM
I was thinking stun damage, for it's culmulative effect, which the shield also has, sure, but not sure it's envelopes(, for lack of a better word/term), are the same as the shields. If it happened to have different recovery times per hit, it'd have a fluxuating recovery, which would be pretty cool i think. I got that impression looking at a dmg_fx tag's "stun time". But now that you mention it, thats 3 variables to throw into the equation, which is even better(, if those offsets aren't too hard to find).

Also, :awesome: BRILLIANT!

Limited
February 23rd, 2009, 05:10 PM
Stun damage, I dont understand exactly what you mean.

Syuusuke
February 23rd, 2009, 05:37 PM
You know when you get hit by the plasma rifle or little plasma shots from the plasma pistol (not overcharged?) they stun you (while you move of course).

Just try it.

If I stun you, I'm afraid I'll do more than just stun.

bobbysoon
February 23rd, 2009, 09:42 PM
the damage_effect tag has the parameters stun, maximum stun, and stun time, in the $DAMAGE$ section. That might mean it has a dynamic array of instances of damage_effects, given that time parameter