Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
How do you deal with a negative OPCODE? Like:

Code:
OPCODE -2147481944

Also, would love it if someone could show me how to make this piece of code:

Code:
common_weapon_break = (0.4, 0, 0, [], [
   (try_for_agents, ":agent_id"),
       (agent_get_attack_action, reg0, ":agent_id"),
       (eq,reg0,3),    #completing attack
#Cruger MODIFICATION BEGIN----------------------------------------------------------------------------
#Cruger MODIFICATION END------------------------------------------------------------------------------

       (agent_get_wielded_item,":breakweapon",":agent_id",0),
       (gt,":breakweapon",itm_no_item),

       (item_get_type, ":weapontype", ":breakweapon"),

       (store_random_in_range,":weaponbreakchance",1,100),
       (try_begin),

           (eq,itp_type_polearm,":weapontype"),
           #       (display_message, "@Polearm"),

           (val_mul,":weaponbreakchance",3.01),
       # (else_try),
           # (eq,itp_type_two_handed_wpn,":weapontype"),
           # #       (display_message, "@2 hander"),
           # (val_mul,":weaponbreakchance",1),
       # (else_try),
           # (eq,itp_type_one_handed_wpn,":weapontype"),

           # #       (display_message, "@1 hander"),
           # (val_mul,":weaponbreakchance",1),
       (try_end),


       (agent_get_horse,":agent_mounted",":agent_id"),
       (try_begin),
           (ge,":agent_mounted",0),
           #      (display_message, "@Mounted."),
           (val_mul,":weaponbreakchance",3.01),

       (try_end),

       (try_begin),
           (ge,":weaponbreakchance",20), #chief cambiado

           (agent_unequip_item,":agent_id",":breakweapon"),
#Cruger MODIFICATION BEGIN----------------------------------------------------------------------------
           (get_player_agent_no, ":player_agent_id"),
           (try_begin),
               (eq, ":agent_id", ":player_agent_id"),

               (play_sound,"snd_shield_broken",),

               (display_message, "@Hah! Your weapon broke. This can not be repaired until the end of the battle"),
           (try_end),
#Cruger MODIFICATION END------------------------------------------------------------------------------

           (lt,":agent_mounted",0),
           (agent_set_animation, ":agent_id", "anim_strike_chest_front"),
       (try_end),
   (try_end),
   ])

only effect certain items, rather than ALL. Pretty much just want it to apply to wooden clubs and lances.
 
@FantasyWarrior
That is very strange, where is this party template located in the party template file, try pasting it directly after the standard bandit party templates. Also what operation are you using to spawn these party templates? I would guess you use this  (spawn_around_party,<party_id>,<party_template_id>)?


You could also try copy and pasting one of the standard bandit party templates to see if they are visible, e.g do something like the following

Code:
("sea_raiders_TEST","Sea Raiders TEST",icon_axeman|carries_goods(2),0,fac_outlaws,bandit_personality,[(trp_sea_raider,5,50)]),

The above should not be visible beyond the players field of view at all.

There is nothing obviously wrong with your code so I am unsure  :???:


@Cozur, after the line    (agent_get_wielded_item,":breakweapon",":agent_id",0), you could have a list of lines which say
Code:
(this_or_next|eq,":breakweapon", LANCE_1),
(this_or_next|eq,":breakweapon", LANCE_2),
(this_or_next|eq,":breakweapon", LANCE_3),
(this_or_next|eq,":breakweapon", CLUB_1),
(eq,":breakweapon", YOUR LAST CLUB),
ect and then just list all the weapons you want to be able to break. Or if you have a long list of weapons you could use

Code:
(this_or_next|is_between,":breakweapon","LANCE_1","WEAPON AFTER YOUR LAST LANCE"),
(is_between,":breakweapon","CLUB_1","WEAPON AFTER YOUR LAST CLUB"),
althought this method would require that all your breakable weapons are located in continuous sections in module_items


If you didnt want clubs to break and only wanted all polearms to break you could do it much easier and quicker by just checking the item type was a polearm, but as you want only certain lances and clubs to break you will need to do either of the above methods
 
Cozur said:
How do you deal with a negative OPCODE? Like:

Code:
OPCODE -2147481944

How did you got that? Does the error tells you the script/trigger and the line?
After some calculations (actually one calculation: removing the sign bit), I believe that it is opcode 1704, which is agent_is_human operation.

In binary:
10000000000000000000011010101000 = -2147481944 (if it is unsigned, then it equals to 2147485352)
00000000000000000000011010101000 = 1704
^ that is the sign bit

Binary/decimal/hex converter
 
The_dragon said:
Cozur said:
How do you deal with a negative OPCODE? Like:

Code:
OPCODE -2147481944

How did you got that? Does the error tells you the script/trigger and the line?
After some calculations (actually one calculation: removing the sign bit), I believe that it is opcode 1704, which is agent_is_human operation.

In binary:
10000000000000000000011010101000 = -2147481944 (if it is unsigned, then it equals to 2147485352)
00000000000000000000011010101000 = 1704
^ that is the sign bit

Binary/decimal/hex converter
(unsigned int)-2147481944 = 2147485352; 2147485352 = 0x800006A8; 0x800006A8 = neg|agent_is_human;
 
Initializing...
Compiling all global variables...
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Exporting map icons...
Creating new tag_uses.txt file...
Creating new quick_strings.txt file...
Exporting faction data...
Exporting item data...
Exporting scene data...
Exporting troops data
Exporting particle data...
Exporting scene props...
Exporting tableau materials data...
Exporting presentations...
WARNING: Usage of unassigned global variable: $g_conversation_offerer
WARNING: Usage of unassigned global variable: $g_conversation_offer_type
WARNING: Usage of unassigned global variable: $g_conversation_offer_type

Exporting party_template data...
Exporting parties
Exporting quest data...
Exporting info_page data...
Exporting scripts...
Exporting mission_template data...
Exporting game menus data...
exporting simple triggers...
exporting triggers...
exporting dialogs...
Checking global variable usages...
WARNING: Global variable never used: $g_conversation_offerer
WARNING: Global variable never used: $g_conversation_offer_type
WARNING: Global variable never used: $g_conversation_offer_type

Exporting postfx_params...

______________________________

Script processing has ended.
Press any key to exit. . .

Why this is happening? It says I used $g_conversation_offer_type which is unassigned. But also says I never used $g_conversation_offer_type after assigning it? What could be wrong with this?
 
Ok, those were just old variables that I don't use anymore. My stupidity. It was confused me because I'm using variables which has too similiar names.

But I have a real question now: I suggests, game changes a missile's mesh while it's flying.(I have seen a mesh named flying_missile in a brf file.) How can I change it with any other mesh (e.g. stone_ball, bridge_a, viking_house_a)?
 
Whoops, ninjaed. :smile:

HyperCharge said:
Can i show the city's-Castle's owner on menu's south-east when i come to the city or castle ?
If i can,How ?
You should be able to add a portrait with (set_game_menu_tableau_mesh). There are several tableau meshes that display character with different settings/equipment. Not sure if it won't conflict with (set_background_mesh) operation that is used to set town/castle picture. If there's a conflict, you will have to create your own tableau which will include both background image and troop picture.
 
Lav said:
Nameless Warrior said:
Thanks Lav, so I used the reserved slots without considering the numbers. What was the calculation you did? as I need to do it with the power strike as well.
You can use these formulas:

Code:
knows_power_strike_11 = 11 << (skl_power_strike << 2)
knows_trade_14 = 14 << (skl_trade << 2)

Essentially:

Code:
knows_[color=blue]pretty_much_any_skill[/color]_[color=green]LEVEL[/color] = [color=green]LEVEL[/color] << (skl_[color=blue]pretty_much_any_skill[/color] << 2)

Same results as all those meaningless numbers, but much better readable and extendable.

For as long as LEVEL is within 1..15 range, otherwise you'll have values overflow into other skills.

Though to be on the safe side, you could always use:

Code:
knows_[color=blue]pretty_much_any_skill[/color]_[color=green]LEVEL[/color] = ([color=green]LEVEL[/color] & 0xF) << (skl_[color=blue]pretty_much_any_skill[/color] << 2)

I had to move away from the game and modding for a while but want to say a belated thank you for this post. The information here was a massive help.
 
Are all the scene props which has sokf_dynamic_physics flag act like a box? I'm testing with a full sphere mesh but it acts so strange. I believe it is hardcoded, and all dynamic objects are supposed to act like a box ( because only a box using sokf_dynamic_physics flag in original module_scene_props file). Is it true?
 
Lav said:
Whoops, ninjaed. :smile:

HyperCharge said:
Can i show the city's-Castle's owner on menu's south-east when i come to the city or castle ?
If i can,How ?
You should be able to add a portrait with (set_game_menu_tableau_mesh). There are several tableau meshes that display character with different settings/equipment. Not sure if it won't conflict with (set_background_mesh) operation that is used to set town/castle picture. If there's a conflict, you will have to create your own tableau which will include both background image and troop picture.
To module scripts ?
Thanks for answer. :smile:
 
is it possible to make a weapon only useable on horseback, like if you try to use it on the ground it would say "you must be on a horse to use this" or something like that.
 
ScreamingCommie said:
is it possible to make a weapon only useable on horseback, like if you try to use it on the ground it would say "you must be on a horse to use this" or something like that.
You could probably make an unusable item duplicate and run a repeating mission template trigger to check agent's mounted/footed status and swap the two as necessary.
 
Lav said:
ScreamingCommie said:
is it possible to make a weapon only useable on horseback, like if you try to use it on the ground it would say "you must be on a horse to use this" or something like that.
You could probably make an unusable item duplicate and run a repeating mission template trigger to check agent's mounted/footed status and swap the two as necessary.

sounds simple enough, thanks again Lav!
 
You can also remove the dismounted item capability flags, for example
Code:
["arena_sword_two_handed",  "Two Handed Sword", [("arena_sword_two_handed",0)], itp_type_two_handed_wpn|itp_two_handed|itp_primary, itcf_horseback_slashright_onehanded|itcf_horseback_slashleft_onehanded|itc_parry_two_handed|itcf_carry_sword_back,
 670 , weight(2.75)|spd_rtng(93) | weapon_length(110)|swing_damage(30 , blunt) | thrust_damage(24 ,  blunt),imodbits_sword_high ],
Note that the AI will still try to use their weapon while dismounted in this fashion.
 
So, in Native, when you skip slots in the item slots {Weapon Slot 1, 2, 3 and 4}, it moves the lower items into the previous slots. So if I put an item in Weapon Slot 1 and another item in Weapon Slot 3, the item in Weapon Slot 3 will automatically move up to Weapon Slot 2 after I spawn.

Is there a way to disable this, particularly in multiplayer, where if I skip slots, it doesn't do what is mentioned above?
 
Status
Not open for further replies.
Back
Top Bottom