[WB] Warband Script Enhancer v4.9.5 for 1.174

Users who are viewing this thread

The videos made by me isn't working in the game but TaleWorlds intro is working, Paradox trailer is working too. But my videos aren't. Why ? I was made videos with RAD video tools. They aren't even above 30 seconds...

False alarm, Video worked after 30 times click to menu.  :lol: But still I think there is a problem in that command. At least for not playing at first call.

Also, I've spotted there is no limit like 30 seconds for videos, this is great! but still there have some problems with my videos about sounds. I can hear the voice from video if I don't call it from the game. But if I call the video in game, there is no voice-sound. Well, If I can't solve this, I will put texts on videos or play sound from video while it is playing (in screen, the video, in background, sounds of video called from game)  :iamamoron:
 
domipoppe said:
@Sebastian

-Added "missile no" parameter for ti_on_init_missile and ti_on_missile_dive triggers and game_missile_dives_into_water script.
-Added new operations: missile_is_valid, missile_get_cur_position.

this is now way of helping there? What if you get the missile and put it below the map, or isn't it a scene prop instance in that moment?
None of these operations and parameters prevent a missile from spawning... and manipulating a missile's position during flight is also not possible atm.
 
K700 said:
I have an idea to make a separate set of animations for each agent. This will allow easy replacement of standard animations, such as equip dual weapons to replace one-handed weapon's hit and block animations. Replace running animation on lame after legs wounded.  Etc.


This will require hook all places where called action_manager, 16 for client and 13 for dedic. It's a lot of work and I would like to know, someone you need this or not.
This would be great for the new Invasion I am working on, to give boss enemies unique animations/special attacks and attach AoE damage to them. So yea, I would probably make use of it.
 
Interesting the array features. What does the 10 dimensions mean ? Multi dimensional arrays ? Can you make an example of use ? Thanks.
 
Here is some test code I wrote for the arrays. I hope you can learn from it, if you have any questions left please ask me.

Code:
#script_wse_console_command_received
# Called each time a command is typed on the dedicated server console or received with RCON (after parsing standard commands)
# INPUT
# script param 1 = command type (0 - local, 1 - remote)
# s0 = text
# OUTPUT
# trigger result = anything non-zero if the command succeeded
# result string = message to display on success (if empty, default message will be used)
("wse_console_command_received", [
	(store_script_param, ":command_type", 1),

  (assign, ":size", 10),

  (try_begin),
    (str_equals, s0, "@create"),

    (array_create, "$ar", 0, ":size", 2), #integer, 2D array - 10x2

    (try_for_range, ":i", 0, ":size"),
      (try_for_range, ":j", 0, 2),
        (store_random_in_range, ":val", 0, 15),
        (array_set_val, "$ar", ":val", ":i", ":j"), #just some random numbers
      (try_end),
    (try_end),

  (else_try),
    (str_equals, s0, "@free"),

    (array_free, "$ar"),

  (else_try),
    (str_equals, s0, "@sort"),

    (array_sort, "$ar", sort_m_int_asc, 0), #Sort 2D array using [x][0]

  (else_try),
    (str_equals, s0, "@sort2"),

    (array_sort, "$ar", sort_m_int_asc, 1), #Sort 2D array using [x][1]

  (else_try),
    (str_equals, s0, "@psort"),

    (array_create, ":tmp", 2, 0), #positions, 1D array - empty

    (init_position, pos10), #-> 0,0,0

    (display_message, "@--- creating pos array ---"),

    (try_for_range, reg0, 0, 10),
      (store_random_in_range, reg1, 0, 20),
      (store_random_in_range, reg2, 0, 20),
      (store_random_in_range, reg3, 0, 20),

      (position_set_x, pos0, reg1),
      (position_set_y, pos0, reg2),
      (position_set_z, pos0, reg3),

      (array_push, ":tmp", pos0),
      
      (get_distance_between_positions, reg4, pos0, pos10),

      (display_message, "@{reg0} - x: {reg1}, y: {reg2}, z: {reg3}, distance from 0,0,0: {reg4}"),

    (try_end),

    (array_sort_custom, ":tmp", "script_cmp_pos"),

    (display_message, "@--- sorted pos array ---"), #should be in reverse order, since we are poping from the back of the array.

    (try_for_range, reg0, 0, 10),
      (array_pop, pos0, ":tmp"),

      (position_get_x, reg1, pos0),
      (position_get_y, reg2, pos0),
      (position_get_z, reg3, pos0),

      (get_distance_between_positions, reg4, pos0, pos10),

      (display_message, "@{reg0} - x: {reg1}, y: {reg2}, z: {reg3}, distance from 0,0,0: {reg4}"),
    (try_end),

    (array_free, ":tmp"),

  (else_try),
    (str_equals, s0, "@show"),

    (display_message, "@-----------"),

    (try_for_range, reg1, 0, ":size"),
      (str_store_string, s0, "@ - [{reg1}]|"),

      (try_for_range, reg2, 0, 2),
        (array_get_val, reg0, "$ar", reg1, reg2),
        (str_store_string, s0, "@{s0} [{reg2}]: {reg0}"),
      (try_end),

      (display_message, s0),
    (try_end),
  (try_end),
]),

("cmp_pos", [ #sorts by distance from origin (0,0,0)
  (init_position, pos10),

  (get_distance_between_positions, ":a", pos0, pos10),
  (get_distance_between_positions, ":b", pos1, pos10),

  (try_begin),
    (le, ":a", ":b"),
    (return_values, 1),
  (else_try),
    (return_values, 0),
  (try_end),
]),

The position sorting example won't work at the moment due to a bug. I fixed it, but you'll have to wait until K700 releases the update.
 
So your example will return an array like this ?
Code:
array(array([0] => int, [1] => int),
          array([0] => int, [1] => int),
          array([0] => int, [1] => int),
          array([0] => int, [1] => int),
          array([0] => int, [1] => int),
          array([0] => int, [1] => int),
          array([0] => int, [1] => int),
          array([0] => int, [1] => int),
          array([0] => int, [1] => int),
          array([0] => int, [1] => int)
)

So they've a predefined size ?
About perfomances, how much they differ from slots ?
Thanks.
 
Basically - yes.
The size is set with array_create, you can however change dim 0's size with array_pop and array_push afterwards.
I have no idea how the engine handles slots.. A 1D-array for comparison however is more or less a C++ std::vector, which should be fast enough. With each dimension the array has, access time grows linearly.
 
So at this point is better i use slots. I wanted to use arrays to cut the amount of loops. For example if i've to find scene props with some specific features, i've to loop all of them each time. With arrays i would have stored the instances in array and with a single loop iterated all of them. But i can't if they work like that. Practically your arrays work like slots filling all indexes when it's created, right ?
 
K.A. said:
So at this point is better i use slots. I wanted to use arrays to cut the amount of loops. For example if i've to find scene props with some specific features, i've to loop all of them each time. With arrays i would have stored the instances in array and with a single loop iterated all of them. But i can't if they work like that. Practically your arrays work like slots filling all indexes when it's created, right ?

Seems you don't know the different between arrays, lists, linkedlists, queues, ... which is fine. OSP section has a few options for systems (and some mods also have a few implementations).

For example check this one: https://forums.taleworlds.com/index.php/topic,335511.msg7953775.html#msg7953775



 
Thanks for the suggestion, but i'm more confused. What i know is the game has slots which are "similar" to arrays. I don't know how you call them, but to me they reminds the arrays. If i remember correctly here some dev said when you store a value in a slot all positions before that are filled too. So if i store a value to position 13, all positions from 0 to 12 are filled with a value (-1 ?). Tell me if i'm wrong and, please, explain better. The topic you linked seems a slots "hack". :smile:
 
K.A. said:
please, explain better

you can visit the Q&A thread to ask questions, or the threads on OSP solutions. This one is about WSE, so it would be off-topic (wrong place) to discuss this

If you want to learn more about data types and how you can use them with MBScript you can also research the topic. Its a programming concept, if you don't know about it just makes harder to understand the specific application for Warband.
 
Code:
(array_create, "$special_props_array", 0, 0), #integer type, empty for now 

(try_for_prop_instances, ":instance_no", "your_prop"),
  (has_specific_feature, ":instance_no"),
  (array_push, "$special_props_array", ":instance_no"), #increase array size by 1 and store instance_no in the free index
(try_end),

...

(array_get_dim_size, ":size", "$special_props_array", 0),

(try_for_range, ":i", 0, ":size"),
  (array_get_val, ":instance_no", "$special_props_array", ":i"),
  (do_whatever_you_want, ":instance_no"),
(try_end),
 
Since i use wse i can see the crash logs. Time to time my server crashs with following error:
Type: EXCEPTION_ACCESS_VIOLATION (0xC0000005, 0x00000001, 0x42689FD:cool:
> Stack trace
0x35DC2D18 ??+0x35DC2D18 (??+0x0)
0x00000007 ??+0x7 (??+0x0)

It happens with and without wse. It often happens at end of same maps. It happens with all numbers of players (40/80/120 ecc.). Do you know by what it may depend ? Memory corruption ?
 
Back
Top Bottom