Page 1 of 2

Using items

Posted: 10 Feb 2014, 14:54
by r_populik
I think this is a question to our scripting-magician Alundaio. Which would be the simplest way to add playing animation during using items (assuming that I have done after one hud animation for each item) ?

Re: Using items

Posted: 10 Feb 2014, 15:33
by Alundaio
Smurth created an actor effects script (Used in Misery) with some of my assistance and it can trigger effects when using consumable items.


example:

Code: Select all

   bandage = {
      [0] = "actor_effects.use_weapon(0)",
--      [1] = "level.add_cam_effector('camera_effects\\\\item_use.anm', 8050, false,'')",
      [1040] = "xr_effects.disable_ui_inventory(db.actor, nil)",
      [4150] = "actor_effects.use_weapon(1)"
   },


The number in the brackets is milliseconds and the string is actual code that will be executed during runtime. So it will give you full control to do whatever you want, like hide actor weapon, play the animation along with cam effectors and etcetera.

I may be a magician but my knowledge only extends to areas I have experience with. I have no experience with playing actor HUD animations. Is there even a function for it? If you know of an example from an other mod of playing HUD animations I'll write a function that you can plug into actor_effects_data.script.

Re: Using items

Posted: 10 Feb 2014, 16:48
by r_populik
I am pretty sure there is not a function for playing actor HUD animations. It's probably more complicated. Here are files from GWR mod: https://www.mediafire.com/?rtdhcihg1hdye05
which add such a feature. I don't understand much from these files and I am wondering if it must be so complicated.

Re: Using items

Posted: 10 Feb 2014, 17:07
by Alundaio
Yeah, looks like you have to do some hacky things to play hud animations. Is there reason why you can't just use this?

Also I spotted typos:

Code: Select all

visual            = dynamics\devices\dev_ mineral_water\dev_ mineral_water.ogf


There is a space between dev_ and mineral_water in every instance this line is used. Unless it's intentional.

Re: Using items

Posted: 10 Feb 2014, 17:07
by Swartz
There is no function for adding new HUD animations. I contacted Sin! about GWR a while back and asked the same question you have, and it turns out what you're seeing are for third person animations. HUD animations can't be done (until Gunslinger gets released anyway).

Re: Using items

Posted: 10 Feb 2014, 17:12
by Alundaio
Swartz wrote:There is no function for adding new HUD animations. I contacted Sin! about GWR a while back and asked the same question you have, and it turns out what you're seeing are for third person animations. HUD animations can't be done (until Gunslinger gets released anyway).


How does Gunslinger do it? But if that were true about GWR than why are they activating the binoculars slot and using consumbale items with wpn_binoc as a base with special hud animations?

Re: Using items

Posted: 10 Feb 2014, 17:18
by Swartz
Alundaio wrote:
Swartz wrote:There is no function for adding new HUD animations. I contacted Sin! about GWR a while back and asked the same question you have, and it turns out what you're seeing are for third person animations. HUD animations can't be done (until Gunslinger gets released anyway).


How does Gunslinger do it? But if that were true about GWR than why are they activating the binoculars slot and using consumbale items with wpn_binoc as a base with special hud animations?


Gunslinger is doing it via a new dll written in Delphi that he's using to inject new functions into the game. !Sin wouldn't be more specific than that.

As for that script, I should have downloaded it before saying anything, I thought he was reffering to a different GWR script.
I have no idea how the script is doing, I'm just passing along what he had told me.

Re: Using items

Posted: 10 Feb 2014, 17:21
by Alundaio
Gunslinger is doing it via a new dll written in Delphi that he's using to inject new functions into the game.


Now that sounds like sorcery. Is he keeping it all to himself until he releases his mod?

Re: Using items

Posted: 10 Feb 2014, 17:23
by Swartz
Alundaio wrote:
Gunslinger is doing it via a new dll written in Delphi that he's using to inject new functions into the game.


Now that sounds like sorcery. Is he keeping it all to himself until he releases his mod?


Indeed he is. I asked him if he'd release some functions early but he said no :(

You can view videos of some of the stuff being done on this guy's channel: http://www.youtube.com/user/WolfKOTTO

Re: Using items

Posted: 10 Feb 2014, 17:27
by Alundaio
That's bullshit. I hate when people hold on to shit that can help the entire modding community like a dragon sitting on a pile of treasure.

Re: Using items

Posted: 10 Feb 2014, 17:52
by r_populik
Alundaio wrote:That's bullshit. I hate when people hold on to shit that can help the entire modding community like a dragon sitting on a pile of treasure.

Yeah, you are right, but probably they just want to exert the greatest impression, when their mod will be released. The fact is they are talented and they are making great stuff.

Re: Using items

Posted: 10 Feb 2014, 18:14
by Alundaio
WolfKOTTO wrote:Is made with scripts. We don't released it cause is made for gunslinger mod :)


Revolucas wrote:+WolfKOTTO Can you at least explain how it is done? Do you activate a fake consumable that is really a weapon to play the HUD animations or are you using dll injection to rewrite engine functions, like what xRay extensions does?

WolfKOTTO wrote:+Revolucas First. Is made on binocular class - wp_binoc. Can't say enything more cause i'm not programmer, is made by Sin! as you can see in description.


Looks like what those GWR scripts do is what they are using.

Re: Using items

Posted: 12 Feb 2014, 16:55
by ikdoemaarwat
If you have additional hud models and at least a use animation, you can pretty much replicate it into the game ad infinitum. Am I not seeing the obvious here? You have the vodka/medkit using animations working right?

Re: Using items

Posted: 20 Apr 2014, 04:10
by Bangalore
I just found this mod on AMK forums, but it's for SOC.

Hud for conserv, bred, PDA and vodka using by Akella-96 aka SvD:

http://yadi.sk/d/nZ9JlPRJMmYDT

Re: Using items

Posted: 15 Jun 2015, 10:50
by ddraig
Just thought I'd give my two cents.

Lost Alpha has this, kind of. There's several segments in game where they have the actor's hands showing, doing animations.

What I believe they do is they have created a special instance of the bolt weapon that has special draw/idle animations that do whatever they want the first person 'hands' to do.

They've then determined the time it take for the animation to finish, then they release that special weapon and go about normal.

http://pastebin.com/sA0Xvqsp

This is the code for the intro

The specific animations for the hands are as such:

Code: Select all

anim_show         = hands_show
anim_hide         = hands_hidden_once
anim_idle         = hands_transform_full_new
anim_playing      = hands_transform_full_new
anim_throw_begin   = hands_hidden
anim_throw_idle      = hands_hidden
anim_throw_act      = hands_hidden_once
anim_throw_end      = hands_hidden_once


It's very hacked in but it is technically possible with a bit of work.

Re: Using items

Posted: 18 Jun 2015, 00:04
by Alundaio
This wouldn't be too hard to do now with source. It's theoretically possible to play hud animation whenever you want or trigger an animation state without player input. For example, playing hud animation from script, if it exists, when the player uses an item. Is this something that is still in desire?


Here is a good example of what I can do, through lua:


Code: Select all

local itm = db.actor:active_item()
itm:play_hud_motion("anim_idle",true)


or

Code: Select all

itm:set_hud_item_state(2) -- eHiding state, which plays hiding anim

Re: Using items

Posted: 19 Jun 2015, 13:22
by Beacon
Yes please!

Re: Using items

Posted: 21 Jun 2015, 19:14
by ikdoemaarwat
This has been possible for years, been posted on gsc even.
Can you give me a random animation for testing, so I can check if I'm not a retard?

Re: Using items

Posted: 21 Jun 2015, 20:14
by Alundaio
It is not possible to play hud animations at will. You can make fake weapon items and replace their animations with you want to do. Then activate or deactivate them to trigger hiding/showing or idle animations. That is about it.

Re: Using items

Posted: 23 Jun 2015, 15:45
by ikdoemaarwat
Can you give me an animation you can't trigger?
I'll post back the result.