Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.


Messages - Winter

Pages: 1 2 3 [4] 5 6 ... 25
46
Onin No Ran / Re: Long-sword VS. Katana
« on: May 11, 2008, 05:23:24 PM »
This topic is over. Doorknob, you're being one, and you're out. I won't tolerate that sort of language on my board.

Let me remind you all that fujiwara's word is law on this subforum. Doorknob, take a break, and watch what you say in future. 3-day ban.

Blademaster, you can go as well. 3-day ban.

Keep it gentlemanly, people.

47
Discussion / Re: Ask Winter
« on: April 17, 2008, 07:28:09 AM »
. . . Okay, so what's the problem? You've still not explained what it is that's wrong with it.

48
Discussion / Re: Ask Winter
« on: April 17, 2008, 01:29:05 AM »
The problem with your spt_mercenary is that it has no new code attached to it. Just because you slapped in a new constant doesn't mean the game knows what to do with it. You have to code in that functionality yourself, for example in the script game_event_party_encounter. The game has several bits that key on party type and I've used them extensively for the Storymod Chapter 2 war system, so believe me they work fine.

49
Storymod / Re: Updated -- Storymod Chapter 2: No More Donations
« on: April 13, 2008, 05:33:21 PM »
Updated.

50
hi everyone I am a M&B fan and now learning how to make a mod

here is my question,is there a way to change the troop's property while the game is running?something like weapons,armors.

when I was playing TLD MOD in 0.808,it's able to inrease  the weapon proficiences when large host of army is defeated,but I have no idea about how it's done,can anyone help?

thanks to winter and all guys here about what I have learned in this forum so far,and sorry about my poor english :-[

Look in header_operations. That's where all the commands are listed.

51
Tutorials / MOVED: Question about skill point managment
« on: April 10, 2008, 11:27:18 AM »

52
Discussion / Re: Script Parameters
« on: April 04, 2008, 09:03:01 AM »
You can't use store_script_param_1 and store_script_param_2 if you are going to use more then two parameters.

In short store_script_param_1 and store_script_param_2 are actually left over clutter in source code...

You CAN still use them, they accomplish the same thing as they always did, the same thing that you can now do with store_script_param for values 1 and 2. They're just outdated, left in for compatibility reasons.

You can use the old ops in the same script as the new store_script_param if you like, it won't cause any problems.

53
Discussion / Re: Need some clarification on store_add, sub, div, mul
« on: April 03, 2008, 03:50:01 AM »
store_div, ":point5", 1, 2 :green:

Don't be an idiot. M&Bscript does not store decimals, but rounds up to the nearest full integer. That's why Armagan implemented the fixed point multiplier in the first place.

The fixed point multiplier automatically multiplies the results of certain operations by the value of the fixed point multiplier, usually 100, until the end of the script or until you set the script to 0. You can also unleash the multiplier manually on values by using convert_to and convert_from_fixed_point. Essentially what it does is multiply everything by 100 (before the value is stored on certain operations) so that the decimal data isn't lost by M&B's automatic rounding. The drawback is that you have to do all the maths a couple of decimal points to the right.

54
Discussion / Re: Some strange, never-before-seen assertions
« on: March 25, 2008, 03:58:48 AM »
Easy way to narrow down the problem -- take the unique flag off all items in your mod and see if the assert goes away.

55
Discussion / Re: Some strange, never-before-seen assertions
« on: March 24, 2008, 09:09:01 AM »


This one is dead easy. One of your operations is getting an invalid party ID fed to it. In this case it's party_add_members (opcode 1610 in header_operations), it's a trigger or simple trigger, and it's getting a party ID of -1 to work with.

56
Discussion / Re: Ask Winter
« on: March 23, 2008, 03:30:03 PM »
That is actually native code, and I put a display message right after it got the value from the slot, and the value was 1.  I have taken the code for the native mercenaries and edited it to my own needs.

Well, in that case, is the town where you're testing it maybe of kingdom_2?

'Cause, um . . .

            (party_set_slot, ":town_no", slot_center_mercenary_troop_amount, 1),

57
Discussion / Re: Ask Winter
« on: March 23, 2008, 02:23:29 PM »
#module_dialogs.py
[trp_necromancer, "start", [(eq, "$talk_context", tc_tavern_talk),
                     (party_get_slot, ":mercenary_troop", "$g_encountered_party", slot_center_mercenary_troop_type),
                     (party_get_slot, ":mercenary_amount", "$g_encountered_party", slot_center_mercenary_troop_amount),
                     (gt, ":mercenary_amount", 0),
                     (assign, reg3, ":mercenary_amount"),
                     (call_script, "script_game_get_join_cost", ":mercenary_troop"),
                     (assign, ":join_cost", reg0),
                     (val_sub, ":join_cost", 5),
                     (store_mul, reg5, ":mercenary_amount", reg0),
                     (party_get_free_companions_capacity, ":free_capacity", "p_main_party"),
                     (val_min, ":mercenary_amount", ":free_capacity"),
                     (store_troop_gold, ":cur_gold", "trp_player"),
                     (try_begin),
                       (gt, ":join_cost", 0),
                       (val_div, ":cur_gold", ":join_cost"),
                       (val_min, ":mercenary_amount", ":cur_gold"),
                     (try_end),
                     (assign, "$temp", ":mercenary_amount"),
                     (str_store_troop_name_plural,s19,":mercenary_troop"),
                     ],
   "I raise the dead for a fee, do you want me to raise {reg3} {s19} for {reg5} silver?", "necro_tavern_talk", []],

You're using val_min pretty indiscriminately here, which is a bad idea, and I think it's making your calculations turn out different from what you intended. I don't have the time nor patience for an in-depth analysis but I'm confident that "$temp" is getting an incorrect value assigned to it because of these val_min ops.

58
Discussion / Re: Syntax error.
« on: March 20, 2008, 09:39:55 AM »
Wait ... I get it now.  In the case of a missing close bracket ( ] ), it doesn't actually crash the compile until after the last close bracket ... where the compiler is then still expecting one more bracket.  So the syntax error will always read as the last line, no matter where the close bracket is missing.

Yep, that's essentially how it works.

59
Discussion / Re: Syntax error.
« on: March 20, 2008, 04:27:06 AM »
You've got a missing bracket. Observe:

 ["sniper_crossbow", "english musket", [("bessindian_bayonet",0), itp_type_musket |itp_merchandise|itp_two_handed|itp_primary ,itcf_shoot_musket|itcf_reload_pistol|itcf_carry_sword_back, 250 , weight(1.5)|difficulty(0)|spd_rtng(45) | shoot_speed(100) | thrust_damage(90 ,pierce)|max_ammo(1)|accuracy(80),imodbits_none,
 [(ti_on_weapon_attack, [(play_sound,"snd_pistol_shot"),(position_move_x, pos1,27),(position_move_y, pos1,36),(particle_system_burst, "psys_pistol_smoke", pos1, 15)])]],

It's easy to misread the line numbers the compiler gives, because you have to remember that it doesn't count blank lines, and multi-line tuples only count as 1 line.

60
Discussion / Re: Definitive Array Scripts
« on: March 08, 2008, 02:52:14 PM »
Okay, here's my first go at the array scripts, may be intensely buggy but you get the idea. Any testing would be very welcome.

It doesn't wrap around like the old scripts do, but it will go on forever in linked arrays.

Constants:

slot_array_length   = 0
slot_array_read_index   = 1
slot_array_write_index   = 2
slot_array_last_pushed   = 3
slot_array_link   = 255

array_null_value   = -1

array_first_index   = 5
array_last_index   = 254


Code: [Select]
  ("array_init",
   [
# (store_script_param_1,":array_length"),

(set_spawn_radius,5),
(spawn_around_party,"p_main_party","pt_none"),
(call_script,"script_array_clear",reg0),
]),
  ("array_nexus",
   [
(store_script_param_1,":id"),
(store_script_param_2,":value"),

(store_sub,":max_array_cap",array_last_index,array_first_index),

(assign,":loops",1),
(try_for_range,":unused",0,":loops"),
(gt,":value",array_last_index),
(party_get_slot,":new_id",":id",slot_array_link),
(gt,":new_id",0),
(val_sub,":value",":max_array_cap"),
# (val_add,":value",array_first_index),
(assign,":id",":new_id"),
(val_add,":loops",1),
(try_end),

(assign,reg0,":id"),
(assign,reg1,":value"),
]),
  ("array_set_range",
   [
(store_script_param,":id",1),
(store_script_param,":low_value",2),
(store_script_param,":high_value",3),

(call_script,"script_array_nexus",":id",":low_value"),
(assign,":low_id",reg0),
(assign,":low_value",reg1),

(call_script,"script_array_nexus",":id",":high_value"),
(assign,":high_id",reg0),
(assign,":high_value",reg1),

(assign,reg0,":low_id"),
(assign,reg1,":low_value"),
(assign,reg2,":high_id"),
(assign,reg3,":high_value"),
]),
  ("array_destroy",
   [
(store_script_param_1,":id"),

(assign,":current_id",":id"),
(troop_set_slot,"trp_temp_array_a",0,":current_id"),
(assign,":slot",1),
(assign,":loops",1),
(try_for_range,":unused",0,":loops"),
(party_get_slot,":new_id",":current_id",slot_array_link),
(gt,":new_id",0),
(assign,":current_id",":new_id"),
(troop_set_slot,"trp_temp_array_a",":slot",":current_id"),
(val_add,":slot",1),
(val_add,":loops",1),
(try_end),

(try_for_range_backwards,":range",0,":slot"),
(troop_get_slot,":current_id","trp_temp_array_a",":range"),
(gt,":current_id",0),
(party_is_active,":current_id"),
(remove_party,":current_id"),
(val_add,":loops",1),
(try_end),
]),
  ("array_clear",
   [
(store_script_param_1,":id"),

# (party_get_slot,":array_length",":input_array",slot_array_length),
(try_for_range,":range",0,255),
(party_set_slot,":id",":range",array_null_value),
(try_end),
(party_set_slot,":id",slot_array_length,0),
    (party_set_slot,":id",slot_array_write_index,array_first_index),
    (party_set_slot,":id",slot_array_read_index,0),
(assign,reg0,":id"),
]),
  ("cf_array_push_front",
   [
(store_script_param_1,":id"),
(store_script_param_2,":value"),
   
    # Get array data
(party_get_slot,":write_index",":id",slot_array_write_index),
(party_get_slot,":read_index",":id",slot_array_read_index),
(party_get_slot,":length",":id",slot_array_length),     

  (assign,"$pout_value",array_null_value),
  (assign,reg0,array_null_value),

    # Make sure the array isn't full
(neq,":write_index",":read_index"),

    # Set the local write_at as being one less than the read-index
    # Wrap around if necessary
(store_sub,":write_at",":read_index",1),

(ge,":write_at",array_first_index),

    # Write the value
(party_set_slot,":id",":write_at",":value"),

    # Update read-index to point to the write_at
    # (Start of the queue will point to the newly added value)
(assign,":read_index",":write_at"),

    # Update array-data
(val_add,":length",1),
   
    # Store the new array-data
(party_set_slot,":id",slot_array_read_index,":read_index"),
(party_set_slot,":id",slot_array_last_pushed,":value"),   
  (party_set_slot,":id",slot_array_length,":length"),
  ]),
  ("cf_array_push_back",
   [
    # Store script parameters
(store_script_param_1,":id"),
(store_script_param_2,":value"),

(assign,":current_id",":id"),

    # Get array data
(party_get_slot,":write_index",":current_id",slot_array_write_index),
(party_get_slot,":length",":current_id",slot_array_length),

(store_add,":work_var",":write_index",array_first_index),
(try_begin),
(gt,":work_var",array_last_index),
(call_script,"script_array_nexus",":current_id",":work_var"),
(try_begin),
(gt,reg0,0),
(assign,":current_id",reg0),
(assign,":work_write_index",reg1),
(else_try),
(call_script,"script_array_init"),
(assign,":new_id",reg0),
(party_set_slot,":current_id",slot_array_link,":new_id"),
(assign,":current_id",":new_id"),
(assign,":work_write_index",array_first_index),
(try_end),
(try_end),

    # Get array data
(party_get_slot,":read_index",":current_id",slot_array_read_index),
(party_get_slot,":work_length",":current_id",slot_array_length),

    # Make sure the array isn't full
(neq,":work_write_index",":read_index"),

    # Write the value
(party_set_slot,":current_id",":work_write_index",":value"),

    # If this is the first push update the read-index
(try_begin),
(eq,":work_length",0),
(assign,":read_index",array_first_index),
(try_end),

    # Increment write-index
(val_add,":work_write_index",1),

    # Update array-length
(val_add,":work_length",1),

(try_begin),
(neq,":current_id",":id"),
(val_add,":write_index",1),
(party_set_slot,":id",slot_array_write_index,":write_index"),
(val_add,":length",1),
(party_set_slot,":id",slot_array_length,":length"),
(party_set_slot,":id",slot_array_last_pushed,":value"),
(try_end),

    # Write the array-data back to the array
(party_set_slot,":current_id",slot_array_length,":length"),
(party_set_slot,":current_id",slot_array_last_pushed,":value"),
(party_set_slot,":current_id",slot_array_read_index,":read_index"),
(party_set_slot,":current_id",slot_array_write_index,":write_index"),
]),
  ("cf_array_pop",
   [
    # Store script-parameters
(store_script_param_1,":id"),

(store_sub,":max_array_cap",array_last_index,array_first_index),

(assign,":current_id",":id"),

    # Get array data
(party_get_slot,":write_index",":current_id",slot_array_write_index),
(party_get_slot,":length",":current_id",slot_array_length),


(try_begin),
(gt,":length",":max_array_cap"),
(store_add,":work_var",":length",array_first_index),
(call_script,"script_array_nexus",":current_id",":work_var"),
(try_begin),
(gt,reg0,0),
(assign,":current_id",reg0),
(else_try),
(call_script,"script_array_init"),
(assign,":new_id",reg0),
(party_set_slot,":current_id",slot_array_link,":new_id"),
(assign,":current_id",":new_id"),
(try_end),
(try_end),


    # Read initial array-data
(party_get_slot,":work_length",":current_id",slot_array_length),
(party_get_slot,":read_index",":current_id",slot_array_read_index),
(party_get_slot,":write_index",":current_id",slot_array_write_index),

    # Initialize return-data
(assign,"$pout_value",array_null_value),
(assign,reg0,array_null_value),
   
    # Make sure the array isn't empty
(gt,":work_length",0),

# (try_begin),
# (gt,":work_length",0),
# (store_add,":last_index_range",":last_index",1),
# (try_for_range, ":range", ":read_index", ":last_index_range"),
# (party_get_slot, ":temp_var", ":current_id", ":range"),
# (store_sub, ":dest", ":range", 1),
# (party_set_slot, ":current_id", ":dest", ":temp_var"),
# (try_end),
# (try_end),

    # Update array-work_length
(val_sub,":work_length",1),

# Update the read-index
(store_add,":last_index",":read_index",":work_length"),
(val_sub,":last_index",1),
(val_sub,":write_index",1),

(try_begin),
(neq,":current_id",":id"),
(val_sub,":write_index",1),
(party_set_slot,":id",slot_array_write_index,":write_index"),
(val_sub,":length",1),
(party_set_slot,":id",slot_array_length,":length"),
(try_end),

    # Get the value to return
(party_get_slot,"$pout_value",":current_id",":read_index"),

    # Write array-data back
(party_set_slot,":current_id",slot_array_read_index,":read_index"),
(party_set_slot,":current_id",slot_array_write_index,":write_index"),
(party_set_slot,":current_id",slot_array_length,":work_length"),

    # Reset array if empty and destroy linked arrays
(try_begin),
(eq,":work_length",0),
(party_get_slot,":new_id",":current_id",slot_array_link),
(try_begin),
(gt,":new_id",0),
(call_script,"script_array_destroy",":new_id"),
(try_end),
(call_script,"script_array_clear",":current_id"),
(try_end),

(assign,reg0,"$pout_value"),   
   ]),
  ("cf_array_peek",
   [
    # Store script-parameters
    (store_script_param_1,":id"),

    # Get array-length
    (party_get_slot,":length",":id",slot_array_length),

    # Initialize return-value
    (assign,"$pout_value",array_null_value),
    (assign,reg0,array_null_value),

    # Make sure the array isn't empty
    (gt,":length",0),

    # Read necessary array-data
    (party_get_slot,":read_index",":id",slot_array_read_index),

    # Get the return-value
    (party_get_slot,"$pout_value",":id",":read_index"),
    (assign,reg0,"$pout_value"),
   ]),
  ("cf_array_read_at",
   [
    # Store script parameters
    (store_script_param_1,":id"),
    (store_script_param_2,":index"),

(store_sub,":max_array_cap",array_last_index,array_first_index),

(assign,":current_id",":id"),

(val_add,":index",array_first_index),
(try_begin),
(gt,":index",array_last_index),
(call_script,"script_array_nexus",":current_id",":index"),
(try_begin),
(gt,reg0,0),
(assign,":current_id",reg0),
(assign,":work_index",reg1),
(else_try),
(call_script,"script_array_init"),
(assign,":new_id",reg0),
(party_set_slot,":current_id",slot_array_link,":new_id"),
(assign,":current_id",":new_id"),
(store_sub,":work_index",":index",":max_array_cap"),
# (val_add,":work_index",array_first_index),
(try_end),
(try_end),

    # Get array length
    (party_get_slot,":length",":current_id",slot_array_length),

    # Initialize return value
    (assign,"$pout_value",array_null_value),
    (assign,reg0,array_null_value),

    # Make sure the array isn't empty
    (gt,":length",0),

    (party_get_slot,":value",":current_id",":work_index"),
    (assign,"$pout_value",":value"),
    (assign,reg0,":value"),     
   ]),
  ("cf_array_write_at",
   [
    # Store script parameters
    (store_script_param_1,":id"),
    (store_script_param_2,":index"),
    (store_script_param,":value",3),

(store_sub,":max_array_cap",array_last_index,array_first_index),

(assign,":current_id",":id"),

(val_add,":index",array_first_index),
(try_begin),
(gt,":index",array_last_index),
(call_script,"script_array_nexus",":current_id",":index"),
(try_begin),
(gt,reg0,0),
(assign,":current_id",reg0),
(assign,":work_index",reg1),
(else_try),
(call_script,"script_array_init"),
(assign,":new_id",reg0),
(party_set_slot,":current_id",slot_array_link,":new_id"),
(assign,":current_id",":new_id"),
(store_sub,":work_index",":index",":max_array_cap"),
# (val_add,":work_index",array_first_index),
(try_end),
(try_end),

    # Get array length
    (party_get_slot,":length",":id",slot_array_length),

    # Initialize return value
    (assign,"$pout_value",array_null_value),
    (assign,reg0,array_null_value),

    # Make sure the array isn't empty
    (gt,":length",0),

    (party_set_slot,":id",":work_index",":value"),
  ]),

Pages: 1 2 3 [4] 5 6 ... 25