ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Clear Sky Forum » Mod discussion
S.T.A.L.K.E.R: The Faction War

« Previous 10 events | 1 ... 3 4 5 6 7 8 9 10 11 ... 209 | Next 10 events »
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  13:48:30  1 February 2011
profilee-mailreply Message URLTo the Top
mnn
Senior Resident
 

 
On forum: 06/12/2009
 

Message edited by:
mnn
02/01/2011 13:55:16
Messages: 2694

---QUOTATION---
Btw, mnn, I have a question for you. Do you know if it's possible to bind a script to a weapon shot or left mouse button click? We'll be adding sniper rifles with manually operated bolt action and need to bind a script that will be executed after each shot. Do you know of any shot callbacks maybe? Or any function that runs when the player shoots?
---END QUOTATION---


I doubt I know something more than you in this area

All (usable) callbacks are already used in bind_stalker.script - with one exception. I know that it is possible to bind hit callback on actor, although a DLL hack is required.

CS lua_help.script:
C++ class callback {
    const action_animation = 21;
    const action_movement = 18;
    const action_object = 24;
    const action_particle = 23;
    const action_removed = 20;
    const action_sound = 22;
    const action_watch = 19;
    const actor_sleep = 25;
    const article_info = 12;
    const death = 8;
    const helicopter_on_hit = 27;
    const helicopter_on_point = 26;
    const hit = 16;
    const inventory_info = 11;
    const inventory_pda = 10;
    const level_border_enter = 7;
    const level_border_exit = 6;
    const map_location_added = 14;
    const on_item_drop = 29;
    const on_item_take = 28;
    const patrol_path_in_point = 9;
    const script_animation = 30;
    const sound = 17;
    const take_item_from_box = 34;
    const task_state = 13;
    const trade_perform_operation = 3;
    const trade_sell_buy_item = 2;
    const trade_start = 0;
    const trade_stop = 1;
    const trader_global_anim_request = 31;
    const trader_head_anim_request = 32;
    const trader_sound_end = 33;
    const use_object = 15;
    const weapon_no_ammo = 35;
    const zone_enter = 4;
    const zone_exit = 5;
};

As you can see engine apparently doesn't even provide such callback. The only thing that might actually help is serious DLL hacking.

Here's compared SoC and CS callback class.

http://img199.imageshack.us/img199/5690/luahelpcallbackcssoccom.png

As you can see, there are a few changes (notably action_removed was added, and ascending constants were shifted).

And afterall they're just numbers, so you can always try some numbers, that are not used there
  14:32:16  1 February 2011
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
 

Message edited by:
smoq2
02/01/2011 14:32:33
Messages: 2433
No, that would be looking for a needle in a haystack. Guess I can try a script_binder parameter in the weapon's config and do an ammo reduction check in the updating function. Maybe if it updates fast enough, it would seem as if the shot triggered the script. The script is suppose to trigger a sound sample of bolt manipulation and disable the scope zoom for a period of time(another obstacle) so there can be no delays between the script's running and a shot.
  16:05:10  1 February 2011
profilee-mailreply Message URLTo the Top
Rm4g3dD0v
Appointed Destroyer
(Resident)

 

 
On forum: 03/28/2010
Messages: 206

---QUOTATION---
@ Rm4g3dD0v - Sorry to use you like that, but I need some more testing from you. Download this script and put it in the gamedata/scripts folder:

http://www.filefactory.com/file/b53d935/n/tools.script

and post back any C stack overflow errors. Thanks, you're doing a great job here.
---END QUOTATION---


dont sweat about it, i actually needed some encouragement these days...
  20:50:42  1 February 2011
profilee-mailreply Message URLTo the Top
gannebamm
has abondened XRay and uses Unity3D now
(Resident)

 

 
On forum: 05/02/2007
Messages: 1077

---QUOTATION---
No, that would be looking for a needle in a haystack. Guess I can try a script_binder parameter in the weapon's config and do an ammo reduction check in the updating function. Maybe if it updates fast enough, it would seem as if the shot triggered the script. The script is suppose to trigger a sound sample of bolt manipulation and disable the scope zoom for a period of time(another obstacle) so there can be no delays between the script's running and a shot.
---END QUOTATION---


i would use the update function from bind_stalker.script and check for current ammo in mag of active wpn. The check could be run every cycle which should be very precise (though not absolutly).
How you bind a script to a weapons config?
  21:02:13  1 February 2011
profilee-mailreply Message URLTo the Top
mnn
Senior Resident
 

 
On forum: 06/12/2009
Messages: 2694
Most likely he meant script_binding inside weapon's config. Just as actor.ltx has one pointing to bind_stalker.actor_init. Interesting...
  21:43:17  1 February 2011
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
 

Message edited by:
smoq2
02/01/2011 21:45:16
Messages: 2433

---QUOTATION---
Most likely he meant script_binding inside weapon's config. Just as actor.ltx has one pointing to bind_stalker.actor_init. Interesting...
---END QUOTATION---



Yes, that's what I ment. You can bind a script to any object by adding "script_binding = script_name.init" to the object's config. Then you create a scripted class in the script file. It can have it's own updating function using this method. I could use the bind_stalker script to achieve what I want, but I believe the way I mentioned is a bit more appropriate for this. I still wonder how I'll disable scope usage during bolt manipulation.
  15:02:54  2 February 2011
profilee-mailreply Message URLTo the Top
fitzroy_doll
(Senior)
 
On forum: 01/06/2008
Messages: 102
Congratulations on getting a new version out. I look forward to trying it sometime soon.
  20:52:52  2 February 2011
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
Messages: 2433
Does anyone have any idea on how to play a sound via script without having to create a sound theme in the configs?
  21:28:23  2 February 2011
profilee-mailreply Message URLTo the Top
mnn
Senior Resident
 

 
On forum: 06/12/2009
 

Message edited by:
mnn
02/02/2011 21:28:39
Messages: 2694

-- root is gamedata\sounds folder
local snd = sound_object("path_to_sound\\some_sound")
snd:play_at_pos(db.actor, vector():set(0,0,0), 0, sound_object_s3d)

lua_help.script:
C++ class sound_object {
    const looped = 1;
    const s2d = 2;
    const s3d = 0;
    
    property frequency;
    property max_distance;
    property min_distance;
    property volume;
    
    sound_object (string);
    sound_object (string, enum ESoundTypes);
    
    function set_position(const vector&);

    function stop_deffered();

    function get_position() const;

    function stop();

    function play_no_feedback(game_object*, number, number, vector, number);

    function play_at_pos(game_object*, const vector&);
    function play_at_pos(game_object*, const vector&, number);
    function play_at_pos(game_object*, const vector&, number, number);

    function attach_tail(string);

    function length();

    function play(game_object*);
    function play(game_object*, number);
    function play(game_object*, number, number);

    function playing() const;

};

  22:12:06  2 February 2011
profilee-mailreply Message URLTo the Top
smoq2
Forklift operator
(Resident)

 

 
On forum: 09/08/2008
 

Message edited by:
smoq2
02/02/2011 23:01:38
Messages: 2433
@ mnn - Thanks friend! A six-pack of beers for you!

[EDIT]

		local snd = sound_object(path)
		snd:play(db.actor, 0, sound_object.s2d)


This worked better.
Btw, does anyone have an idea how to disable the scope for a period of time eg. like 0.5 second? Or maybe force the player out of scope zoom?
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Clear Sky Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2019 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.