Try this.
Last edited by t3h m00kz; September 29th, 2015 at 05:33 PM.
The name of the animation that the keyframe belongs to, the time (e.g. 1000 for 1 second into the animation), the value for the transform and the transform type.
For example, from the Halo 4 script:
This animates the size of the medal over the first 90ms of the animation. It starts off at 200% size and stays that way for the first 30ms. It then shrinks to normal size (1.0) over the subsequent 60ms.Code:add_keyframe("h4_ani", 0, 2.0, 0) add_keyframe("h4_ani", 30, 2.0, 0) add_keyframe("h4_ani", 90, 1.0, 0)
The transform types are:
There are two other versions of add_keyframe that you'll see elsewhere in the other scripts that take more arguments.Code:KEYFRAME_SCALE, (0, does this X and Y at the same time) KEYFRAME_SCALE_X, (1) KEYFRAME_SCALE_Y, (2) KEYFRAME_ROTATION, (3) KEYFRAME_OPACITY, (4) KEYFRAME_RED, (5) KEYFRAME_GREEN, (6) KEYFRAME_BLUE, (7) KEYFRAME_POSITION_X, (8) KEYFRAME_POSITION_Y (9) };
The tween type allows you to control the interpolation between keyframes and the accepted values are:Code:add_keyframe(same, same, same, same, tween type)
If none of the provided tween types given you the animation that you want, you can provide your own bezier curve values. You can find a nice little tool over at http://cubic-bezier.com. Just mess around with the curve there, find something you like and then plug the values in.Code:LINEAR, (0) EASE_IN, (1) EASE_OUT, (2) EASE_IN_OUT (3)
Code:add_keyframe(same, same, same, same, curve value #1, curve value #2, curve value #3, curve value #4)
Quick mockup. Lots of unnecessary lines.
https://dl.dropboxusercontent.com/u/...arkers_1.0.zip
I don't have HCE installed on my PC at home hilariously enough, but it functions!! Though my game exceptions every now and then... Not certain if it's caused by the pack or what
Code:api_version = "1.0.0" --[[ I did add a hacky way for you to add hms but I didn't enable it in the release version. Here's a test build with it enabled; rename it to hac.dll and drop it into your Halo folder. To use it, have your Lua script register for the 'HIT_DETECT' event. If you want your hms to be animated, you'll have to use a spritesheet. Since I haven't documented that function anywhere, here's the signature: const std::string& name, bool loop, int rows, int columns, int fps, // framerate for playback int blanks, // number of blank frames at the end of the spritesheet int loopBegin // frame # to begin loop playback from There's an example of using them in the Halo 4 medal script. create_animation("blue_flash") add_keyframe("blue_flash", 0, 0.85, 4) add_keyframe("blue_flash", 0, 1.3, 0) add_keyframe("blue_flash", 150, 1.0, 0) create_sprite("blue_flash", "images/h4glowsprite.png", "blue_flash") sprite_properties("blue_flash", false, 1, 4, 30, 0, 0) ]]-- function register_callbacks() create_animations() register_callback(cb['HIT_DETECT'], "hit_detect") --register_callback(cb['PLAYER_KILLS'], "player_kills") end function display(message, name, sound, low_priority) low_priority = low_priority or false hud_message(message) queue_audio(sound, low_priority) display_medal(name) end function hit_detect(event, killer, victim, player, timestamp) if(killer == player) then --if weapon has small ret --display("Hit!", "hm_Small", "audio/hm_default.wav") --if weapon has large ret display("Hit!", "hitmarker_small_medal", "audio/hm_default.wav") end end --[[function player_kills(event, killer, victim, player, timestamp) if(killer == player) then display("Kill!", "hitmarker_large_medal", "audio/hm_killshot.wav") end end]]-- function create_animations () create_animation("h4_ani") --add_keyframe("h4_ani", 0, 2.0, 0) --add_keyframe("h4_ani", 30, 2.0, 0) --add_keyframe("h4_ani", 60, 1.5, 0) ----add_keyframe("h4_ani", 90, 1.3, 0) --originally commented --add_keyframe("h4_ani", 90, 1.0, 0) --add_keyframe("h4_ani", 0, 0.2, 4) --add_keyframe("h4_ani", 30, 0.2, 4) --add_keyframe("h4_ani", 90, 0.75, 4) --add_keyframe("h4_ani", 1620, 0.75, 4) --add_keyframe("h4_ani", 1710, 0.0, 4) --add_keyframe("h4_ani", 1710, 0.5, 0.5) add_keyframe("h4_ani", 0, 0.49, 8) add_keyframe("h4_ani", 0, 0.52, 9) add_keyframe("h4_ani", 0, 1.5, 0) add_keyframe("h4_ani", 100, 2, 0) add_keyframe("h4_ani", 0, 1, 4) --Main animation create_animation("main") add_keyframe("main", 100, 1, 4) --add_keyframe("main", 0, 0.010, 8) --add_keyframe("main", 0, 0.49, 9) add_keyframe("main", 0, 1.0, 0) add_keyframe("main", 1710, 1.0, 0) --Slide animation --create_animation("slide") --add_keyframe("slide", 0, 0.0, 8) --HitMarker Large create_sprite("hitmarker_large", "images/hm_large.png", "h4_ani") create_medal("hitmarker_large_medal", "main") attach_sprite("hitmarker_large_medal", "hitmarker_large") --attach_sprite("hitmarker_large_medal", "blue_flash") --medal_slide_animation("hitmarker_large_medal", "slide") --HitMarker Small create_sprite("hitmarker_small", "images/hm_test2.png", "h4_ani") create_medal("hitmarker_small_medal", "main") attach_sprite("hitmarker_small_medal", "hitmarker_small") -- attach_sprite("hitmarker_small_medal", "blue_flash") -- medal_slide_animation("hitmarker_small_medal", "slide") end
Last edited by t3h m00kz; September 29th, 2015 at 09:39 PM.
Updated Hitmarkers. Got Kill Markers working!!! Cleaned up the code a ton
I'm still running into occasional exceptions. Like one every two to four games. I wouldn't really feel safe releasing this to too many people in this state.. Uncertain if it's Optic or my script
![]()
![]()
https://dl.dropboxusercontent.com/u/...markers1.1.zip
You like that shit Rent?Code:api_version = "1.0.0" kills = 0; function register_callbacks() create_animations() register_callback(cb['HIT_DETECT'], "hit_detect") register_callback(cb['PLAYER_KILLS'], "player_kills") end function display(message, name, sound, low_priority) low_priority = low_priority or false hud_message(message) queue_audio(sound, low_priority) display_medal(name) end function hit_detect(event, killer, victim, player, timestamp) if(killer == player) then if(kills == 1) then display("Kill!", "killmarker_medal", "audio/hm_kill.wav") kills = 0; else display("Hit!", "hitmarker_medal", "audio/hm_hit.wav") end end end function player_kills(event, killer, victim, player, timestamp) if(killer == player) then kills = 1; end end function create_animations () --Hitmarker Ani create_animation("hitmarker_ani") add_keyframe("hitmarker_ani", 0, 0.49, 8) -- x pos add_keyframe("hitmarker_ani", 0, 0.52, 9) -- y pos add_keyframe("hitmarker_ani", 0, 1.5, 0) -- scale add_keyframe("hitmarker_ani", 100, 2, 0) -- scale add_keyframe("hitmarker_ani", 0, 1, 4) -- opacity --Main Hitmarker create_animation("main_hitmarker") add_keyframe("main_hitmarker", 0, 1.0, 0) -- scale add_keyframe("main_hitmarker", 1710, 1.0, 0) -- scale add_keyframe("main_hitmarker", 100, 1, 4) -- opacity --HitMarker create_sprite("hitmarker", "images/hm_hit.png", "hitmarker_ani") create_medal("hitmarker_medal", "main_hitmarker") attach_sprite("hitmarker_medal", "hitmarker") --killmarker Ani create_animation("killmarker_ani") add_keyframe("killmarker_ani", 0, 0.49, 8) -- x pos add_keyframe("killmarker_ani", 0, 0.52, 9) -- y pos add_keyframe("killmarker_ani", 0, 1.5, 0) -- scale add_keyframe("killmarker_ani", 100, 2, 0) -- scale add_keyframe("killmarker_ani", 0, 1, 4) -- opacity --Main killmarker create_animation("main_killmarker") add_keyframe("main_killmarker", 0, 1.0, 0) -- scale add_keyframe("main_killmarker", 1710, 1.0, 0) -- scale add_keyframe("main_killmarker", 100, 1, 4) -- opacity --killMarker create_sprite("killmarker", "images/hm_kill.png", "killmarker_ani") create_medal("killmarker_medal", "main_killmarker") attach_sprite("killmarker_medal", "killmarker") end
E: Fixed video..
E2: Pix
Last edited by t3h m00kz; October 6th, 2015 at 11:26 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks