Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
How can I store the position of a scrollbar?

There is this (custom) presentation with a scrollable list of all lords and ladies from where you select an NPC and get information or are able to talk to him/her. But for getting the right portrait and information to show up it is needed to restart the presentation (start_presentation, "prsnt_jrider_character_dialog_report"),. When it's done the selection from the list remains but the position of the scrollbar is back to the beginning.
I'd like to save its position so that after the refresh it doesn't change back to the beginning.
 
Hi guys, I've come across something which seems a bit odd. I have this trigger in module_triggers.

(1.0, 0, 0,[],
  [
(call_script, "script_free_company_captain_replace"),
(display_message,"@{!}DEBUG -- Replacing caps."),
                    ]),

in this state, the script is not called and the message isn't displayed. When I comment out the call_script, the message displays, and when I comment out the display_message, nothing happens. This is really weird because just above it, I have set up this trigger:

(0.5, 0, 0, [],
  [
    (call_script, "script_player_party_add_weariness"),
(display_message,"@{!}DEBUG -- Update weariness."),
                    ]),

Which works fine, even though it is basically the same. Whats going on?
 
HyperCharge said:
how can i make an "check for the town is conquered".Because,im making a rebellion system.I wanna to make "conquer and set a new faction.so,the game can be more difficult for AI :grin:.this feature is will be available for player." but i need check the player's faction is founded.if it not,they will not triggered.If it happened,they will spawn in my one of property.

okay.How can i check the town-castle is conquered ?
Operation (store_faction_of_party) gives you current center allegiance. Slots slot_center_original_faction and slot_center_ex_faction hold center's original faction and previous faction. Slot slot_center_culture contains center's culture. Should be enough for your goals. :smile:
 
The_dragon said:
@ChiefNinja2 Start a new game and it should solve the problem.

@Melphiz I believe that you can't do such thing.

Hmm, that doesn't seem to have worked. I'll mess about a bit more, but this really has me stumped.

EDIT: Turns out I forgot a try_end in the script I was calling, I just never got an error when it compiled.
 
Hello, ragdolls for the TLD orcs don't seem to work in my mod. Hitboxes do, though.

Code:
<Skeleton name="skel_orc">
   <Bones>
    <Bone bone_mass="15" bone_cone_max="30" bone_twist_limit="20" name="hb_abdomen">
     <Bodies>
      <body radius="0.115" pos_x="-0.084" pos_y="0.06" pos_z="-0.04" pos2_x="0.084" type="capsule" pos2_y="0.06" pos2_z="-0.04"/>
     </Bodies>
    </Bone>
    <Bone bone_mass="8" bone_cone_max="40" bone_twist_limit="30" rotate_up="-20" name="hb_thigh_l">
     <Bodies>
      <body radius="0.072" pos_x="0.0096221" pos_y="0.119303" pos_z="0.051141" pos2_x="0.106101" type="capsule" pos2_y="0.348232" pos2_z="0.000251191"/>
     </Bodies>
    </Bone>
    <Bone bone_cone_min="-5" socket_dir_x="0.9" socket_dir_y="0.0" bone_mass="15" bone_cone_max="5" bone_twist_limit="45" rotate_side="90" name="hb_calf_l">
     <Bodies>
      <body radius="0.045" pos_x="-0.0121691" pos_y="0.0135371" pos_z="0.0519223" pos2_x="-0.152833" type="capsule" pos2_y="0.376186" pos2_z="0.127512"/>
     </Bodies>
    </Bone>
    <Bone name="hb_foot_l"/>
    <Bone bone_mass="8" bone_cone_max="40" bone_twist_limit="30" rotate_up="20" name="hb_thigh_r">
     <Bodies>
      <body radius="0.072" pos_x="-0.0096221" pos_y="0.119303" pos_z="0.051141" pos2_x="-0.106101" type="capsule" pos2_y="0.348232" pos2_z="0.000251191"/>
     </Bodies>
    </Bone>
    <Bone bone_cone_min="-5" socket_dir_x="0.9" socket_dir_y="0.0" bone_mass="15" bone_cone_max="5" bone_twist_limit="45" rotate_side="90" name="hb_calf_r">
     <Bodies>
      <body radius="0.045" pos_x="0.0121691" pos_y="0.0135371" pos_z="0.0519223" pos2_x="0.152833" type="capsule" pos2_y="0.376186" pos2_z="0.127512"/>
     </Bodies>
    </Bone>
    <Bone name="hb_foot_r"/>
    <Bone bone_mass="10" bone_cone_max="30" bone_twist_limit="25" name="hb_spine">
     <Bodies>
      <body radius="0.14" pos_x="0.0325" pos_y="0.08" pos_z="0.015" pos2_x="-0.0325" type="capsule" pos2_y="0.08" pos2_z="0.015"/>
     </Bodies>
    </Bone>
    <Bone bone_mass="10" bone_cone_max="30" bone_twist_limit="20" name="hb_thorax">
     <Bodies>
      <body radius="0.095" pos_x="-0.0915001" pos_y="0.13" pos_z="0.0299999" pos2_x="0.0915001" type="capsule" pos2_y="0.13" pos2_z="0.0299999"/>
     </Bodies>
    </Bone>
    <Bone bone_mass="6" bone_cone_max="60" bone_twist_limit="60" name="hb_head">
     <Bodies>
      <body radius="0.0700001" pos_x="0" pos_y="0.0488758" pos_z="0.0677827" pos2_x="0" type="capsule" pos2_y="0.155185" pos2_z="0.0396779"/>
     </Bodies>
    </Bone>
    <Bone bone_mass="8" bone_cone_max="10" bone_twist_limit="50" name="hb_shoulder_l">
     <Bodies>
      <body radius="0.0590001" pos_x="-0.04" pos_y="0.10575" pos_z="0.01" pos2_x="-0.04" type="capsule" pos2_y="0.148" pos2_z="0.01"/>
     </Bodies>
    </Bone>
    <Bone bone_mass="4" bone_cone_max="40" bone_twist_limit="20" rotate_side="-60" name="hb_upperarm_l">
     <Bodies>
      <body radius="0.0440001" pos_x="-0.0140276" pos_y="0.0338403" pos_z="-0.00644887" pos2_x="-0.0210124" type="capsule" pos2_y="0.245852" pos2_z="-0.0135502"/>
     </Bodies>
    </Bone>
    <Bone socket_dir_z="1" bone_mass="2" bone_cone_max="5" bone_twist_limit="45" rotate_up="-45" name="hb_forearm_l">
     <Bodies>
      <body radius="0.0400001" pos_x="-0.010001" pos_y="0.0075006" pos_z="-0.00999951" pos2_x="-0.0100015" type="capsule" pos2_y="0.282501" pos2_z="-0.00999965"/>
     </Bodies>
    </Bone>
    <Bone name="hb_hand_l"/>
    <Bone name="hb_item_l"/>
    <Bone bone_mass="8" bone_cone_max="10" bone_twist_limit="50" name="hb_shoulder_r">
     <Bodies>
      <body radius="0.0590001" pos_x="0.04" pos_y="0.10575" pos_z="0.01" pos2_x="0.04" type="capsule" pos2_y="0.148" pos2_z="0.01"/>
     </Bodies>
    </Bone>
    <Bone bone_mass="4" bone_cone_max="40" bone_twist_limit="20" rotate_side="-60" name="hb_upperarm_r">
     <Bodies>
      <body radius="0.0440001" pos_x="0.0140276" pos_y="0.0338403" pos_z="-0.00644887" pos2_x="0.0210124" type="capsule" pos2_y="0.245852" pos2_z="-0.0135502"/>
     </Bodies>
    </Bone>
    <Bone socket_dir_z="-1" bone_mass="2" bone_cone_max="5" bone_twist_limit="45" rotate_up="45" name="hb_forearm_r">
     <Bodies>
      <body radius="0.0400001" pos_x="0.010001" pos_y="0.0075006" pos_z="-0.00999951" pos2_x="0.0100015" type="capsule" pos2_y="0.282501" pos2_z="-0.00999965"/>
     </Bodies>
    </Bone>
    <Bone socket_dir_z="-1" bone_mass="2" bone_cone_max="360" bone_twist_limit="180" name="hb_hand_r">
     <Bodies>
      <body radius="0.025" for_ragdoll_only="1" pos_x="0" pos_y="0.01875" pos_z="0" pos2_x="0" type="capsule" pos2_y="0.065" pos2_z="0"/>
     </Bodies>
    </Bone>
    <Bone bone_mass="100" bone_cone_max="360" bone_twist_limit="180" name="hb_item_r">
     <Bodies>
      <body radius="0.015" for_ragdoll_only="1" pos_x="0" pos_y="-0.00625002" pos_z="0" pos2_x="0" type="capsule" pos2_y="0.17" pos2_z="0"/>
     </Bodies>
    </Bone>
   </Bones>
  </Skeleton>
 
So I've been adding a new faction using Nord Champion's tutorial, and the faction is successfully added to the game, however, when starting the game a naked man runs up to me and starts punching me after I kill the bandit. In addition, the merchants don't sell anything, and the tavern keeper is none existent. I've heard things about initializing the towns economy, how would I do that?

Thanks in advance
 
I don't understand this game, seriously.

I was trying to call the conversations more on the normal way, as I discovered. So it's like:
Menu:
Code:
	  ("minister_dialog",
		[	(gt, "$g_player_minister", 0),
		],"Talk to your minister.",
		[	
			(assign, "$talk_context", tc_party_encounter), # not sure if needed
			(call_script, "script_setup_troop_meeting", "$g_player_minister"),
		 ]
	  ),
Script: (not mine, already exists)
Code:
  ("setup_troop_meeting",
    [
      (store_script_param_1, ":meeting_troop"),
      (store_script_param_2, ":troop_dna"),
      (call_script, "script_get_meeting_scene"), 
      (assign, ":meeting_scene", reg0),
      (modify_visitors_at_site,":meeting_scene"),
      (reset_visitors),
      (set_visitor,0,"trp_player"),
	  (try_begin),
		(gt, ":troop_dna", -1),
        (set_visitor,17,":meeting_troop",":troop_dna"),
	  (else_try),
        (set_visitor,17,":meeting_troop"),
	  (try_end),	
      (set_jump_mission,"mt_conversation_encounter"),
      (jump_to_scene,":meeting_scene"),
      (change_screen_map_conversation, ":meeting_troop"),
  ]),

So, when I click on the menu to start the conversation, it actually starts the conversation with the correct NPC but still gives me an
Code:
SCRIPT ERROR ON OPCODE 22: Invalid Script Parameter ID: 1; LINE NO: 1:
At script setup_troop_meeting
I wonder why?

Oh and is there any other way to get a party id if there is no party id known?
Code:
(troop_get_slot, "$g_encountered_party", "$character_info_id", slot_troop_leaded_party),
I'll use that for the conversation call with lords
Code:
(call_script, "script_setup_party_meeting", "$g_encountered_party"),
works without any error output it seems, but still I wonder if I hadn't found that in the freelancer_game_menus how I would've ever been able to get a party id.
 
Melphiz said:
So, when I click on the menu to start the conversation, it actually starts the conversation with the correct NPC but still gives me an
Code:
SCRIPT ERROR ON OPCODE 22: Invalid Script Parameter ID: 1; LINE NO: 1:
At script setup_troop_meeting
I wonder why?
If you look at the script, you should notice it expects to be calledtwo parameters. You only provide one. Add a second parameter to (call_script) operation, zero should do the trick.

UPDATE: scrap that, use -1 instead of zero.

Melphiz said:
Oh and is there any other way to get a party id if there is no party id known?
Code:
(troop_get_slot, "$g_encountered_party", "$character_info_id", slot_troop_leaded_party),
I'll use that for the conversation call with lords
Code:
(call_script, "script_setup_party_meeting", "$g_encountered_party"),
works without any error output it seems, but still I wonder if I hadn't found that in the freelancer_game_menus how I would've ever been able to get a party id.
Script "script_setup_party_meeting" only requires one parameter, so of course it works without errors.

Now please clarify what you're trying to do: set up conversation with the party leader or with some random troop/hero who might not be a leader of a party? Because in the second case you must use "script_setup_troop_meeting" instead of "script_setup_party_meeting".
 
Tüfekçi Başı said:
I want to use some files of other mods with permission. But there is no developer. Last online was much much ago.

Any rule for this?  :???:
Option 1: PM the dev and co-devs, cross your fingers, hope for the best.
Option 2: the stuff they used may have been 3rd party, investigate, contact original author if it's the case.
Option 3: claim public domain due to author's demise, catch some flak on the forums, plead your case to admins if/when they get involved, hopefully evade getting banned.
Option 4: find analogs.
Option 5: make analogs.

DasSauerkraut said:
So I've been adding a new faction using Nord Champion's tutorial, and the faction is successfully added to the game, however, when starting the game a naked man runs up to me and starts punching me after I kill the bandit. In addition, the merchants don't sell anything, and the tavern keeper is none existent. I've heard things about initializing the towns economy, how would I do that?
Nord Champion's tutorial is far from complete, there's a ton of issues he forgot on the first page of the thread, and there might be more. And you cannot just skip some of that stuff without some serious bugs appearing.
 
I've found and implemented this script for agents to fall off horses:

horse_fall_off = (

ti_on_agent_hit, 0, 0, [],[
#### Knocked off horses script, base by Gaunt, edited by Davee, edited a bit more by ChiefNinja.

(store_trigger_param_1, ":victim_agent"),
#(store_trigger_param_2, ":attacker"),
(store_trigger_param_3, ":eek:rig_damage"),

(display_message,"@Horse script called!"),

    #(ge, ":eek:rig_damage", 15), ### Minimum damage needed
    (store_agent_hit_points,":hp",":victim_agent"),
    (val_sub, ":hp", ":eek:rig_damage"),
    (ge, ":hp", 1), ### So it dosn't run when it's not needed (agent dies anyway)

    (agent_is_human,":victim_agent"),

(store_skill_level, ":skl_level", skl_riding, ":victim_agent"),
(val_add, ":skl_level", 1),
(val_clamp, ":skl_level", 1, 11),
(store_div, ":damage_mul", ":eek:rig_damage", ":skl_level"), ## Chance is now based partially on riding skill.

(store_random_in_range,":chance",0,1), ### Decrease this number (20) for higher chances of knocking riders off (and vice-versa).
    (ge,":damage_mul", ":chance"), ### If damage_mul dealt is over or equal to the ":chance" number, knock-off occurs.

(agent_get_horse,":horse",":victim_agent"),
(neq,":horse",-1),
(agent_get_item_id,":horsetype", ":horse"),
(neq,":horsetype",-1),
(agent_get_position,pos1,":horse"),
#(agent_get_speed, pos2, ":horse"),
(store_agent_hit_points,":horsehp",":horse"),
(entry_point_get_position, pos3, 0),
(agent_set_position,":horse",pos3),
(remove_agent, ":horse"),

    (set_spawn_position, pos1),
    (spawn_horse,":horsetype",0),
    (agent_start_running_away, reg0),
    #(agent_set_horse_speed_factor, reg0, 100), #I don't think this works but it isn't necessary. <- Only changes max speed of the horse
    (agent_set_hit_points,reg0,":horsehp"),

])

It works fine, I figured out how to get it to work. The problem is that, as far as I can tell, once an agent has fallen off his horse, he is unable to deal damage higher than 0 with attacks, or maybe he's unable to receive it. Anyway, once people start falling off horses, no one can be hurt, it seems.

I'd guess this is because I'm using ti_on_agent_hit, but I'm unable to see how I'd resolve this...

EDIT: Yeah it seems like using ti_on_agent_hit means that no one takes damage...
 
Lav said:
If you look at the script, you should notice it expects to be calledtwo parameters. You only provide one. Add a second parameter to (call_script) operation, zero should do the trick.

UPDATE: scrap that, use -1 instead of zero.
Ah, I thought the script would use -1 by default if no second parameter is given.
Code:
  #script_setup_troop_meeting:
  # INPUT:
  # param1: troop_id with which meeting will be made.
  # param2: troop_dna (optional)
as the description says param2 is optional
Lav said:
Script "script_setup_party_meeting" only requires one parameter, so of course it works without errors.

Now please clarify what you're trying to do: set up conversation with the party leader or with some random troop/hero who might not be a leader of a party? Because in the second case you must use "script_setup_troop_meeting" instead of "script_setup_party_meeting".
I'll have to use both for this one
2nlqm50.jpg

I'll have now to make a check to decide which of the two conversations need to be started. Pretenders and ladies must be troop_meeting, of course. But all other lords (which should have parties on the map) shall be called with party_meeting.
Before I had setup a manual scene and jump_to_scene but that missed some parameters like $g_encountered_party_relation so I would never be able to make peace with a great lord / other faction this way.

I didn't know about the two scripts before, but as I now know of them, I find it more clean to call them instead of setting up a custom scene each time.


EDIT: Hm, after some time to try around and check the stuff, it seems there's no need to call the party dialog as I shouldn't set the $talk_context to tc_party_encounter anyway. The whole presentation shall only be for talking to an NPC, not for being able to engage them in battles, too.
So, after all
Code:
			 	(store_troop_faction, "$g_encountered_party_faction", "$character_info_id"),
				(store_relation, "$g_encountered_party_relation", "$g_encountered_party_faction", "fac_player_faction"),
				(call_script, "script_setup_troop_meeting", "$character_info_id", -1),
seems to be the only thing I needed. The $g_encountered_party_relation must exist in order for being able to make peace with a faction leader, else he will always accept peace but my faction will have made peace with Outlaws instead of the faction whose ruler I spoke to.
And that must also exist for having the option to ask I wish to ask you something where (ge,"$g_encountered_party_relation",0), is checked.
 
Lav said:
Option 1: PM the dev and co-devs, cross your fingers, hope for the best.
Option 2: the stuff they used may have been 3rd party, investigate, contact original author if it's the case.
Option 3: claim public domain due to author's demise, catch some flak on the forums, plead your case to admins if/when they get involved, hopefully evade getting banned.
Option 4: find analogs.
Option 5: make analogs.

Thank you, these are very logical.
And you good modder.

I need new animations(especially high jump). I'm working on my mod. I couldn't use Blender and I don't have money for 3DS Max. I found goood animations but impossible to find their modders. :sad:
 
Well, I changed up the script I was using a bit. I now have:

horse_fall_off = (

ti_on_agent_hit, 0, 0,
      [
(store_trigger_param_1,":victim_agent"),
(store_trigger_param_3,":eek:rig_damage"),
(store_random_in_range,":randnum",0,100),
     
#Change/modify these to change your chances of beinh dehorsed, my percentage is twice the damage dealt.
(val_sub,":randnum",":eek:rig_damage"),
(val_sub,":randnum",":eek:rig_damage"), 
 
(agent_get_troop_id,":victim_troop",":victim_agent"),
(store_skill_level, ":riding_level", skl_riding, ":victim_troop"),
#(val_add, ":riding_level", 1),
#(val_clamp, ":riding_level", 1, 11),
#(store_div, ":damage_mul", ":eek:rig_damage", ":riding_level"), ## Chance is now based partially on riding skill.

(store_random_in_range,":chance",0,1), ### Decrease this number (20) for higher chances of knocking riders off (and vice-versa).
 
(store_agent_hit_points,":hp",":victim_agent"),

(try_begin),
 
(agent_is_human,":victim_agent"),
(neg|ge,":randnum",0),
(ge,":hp",1),
(agent_get_horse,":horse",":victim_agent"),
(neg|eq,":horse",-1),
(agent_get_item_id,":horsetype", ":horse"),
(neg|eq,":horsetype",-1),
(agent_get_position,pos1,":horse"),
(agent_get_speed, pos2, ":horse"),
(store_agent_hit_points,":horsehp",":horse"),
(entry_point_get_position, pos3, 0),
(agent_set_position,":horse",pos3),
(remove_agent, ":horse"),
 
(set_spawn_position, pos1),
(spawn_horse,":horsetype",0),
(agent_start_running_away, reg0),
(agent_set_horse_speed_factor, reg0, 100), #I don't think this works but it isn't necessary.
(agent_set_hit_points,reg0,":horsehp"),
 
(try_end),
       
], [])

The problem is that every time I uncomment

(store_skill_level, ":riding_level", skl_riding, ":victim_troop"),

agents are suddenly unable to do damage to one another, which I guess means this line is causing the script to fail somehow. Any ideas?
 
Pretty sure the script is more complex than it needs to be - calling
Code:
agent_start_running_away
on the agent's mount should cause it the rider to dismount without removing the original horse. Also try using "skl_riding" instead of the bare skl_riding - you may not have imported the right headers.
 
You have
(agent_get_troop_id,":victim_troop",":victim_agent"), 
and then
(store_skill_level, ":riding_level", skl_riding, ":victim_troop"),
but you don't have agent_is_human, because when the horse gets hit, then you will have idk what troop id store into ":victim_troop" (you are trying to get the horse's troop id), and getting it's skill causes some problems.

Solution: put (agent_is_human, ":victim_agent") before getting the troop id.
 
Hello guys

I'm looking for a way to keep the damage received in a scene when I go in another scene.
In my mod, when I enter a prohibited scene, I get damage every 4 seconds, I use this code in module_mission_templates:
(0, 0, 4,
[],
    [
(get_player_agent_no, ":agent"),
(agent_deliver_damage_to_agent,":agent",":agent",50),
]),
It works very well.
01_hit.jpg
But when I go in the next scene, the health bar is full, I lost my damage!
I tried many things, but it does not work, and I try, and I try, i can't get no satisfaction...

How can I keep the damage from one scene to another?
Thank you to everyone.

Tchin!
:twisted:


 
Native keeps track of damage (for hero troops at least) by using
Code:
set_party_battle_mode/finish_party_battle_mode
. For missions involving a single agent (the player) store its health with
Code:
store_agent_hit_points
when the player ends a mission (whether through tabbing, passages, or saving the game) and then applying it to the template through
Code:
troop_set_health
between missions or with
Code:
agent_set_hit_points
in the next mission.
 
Status
Not open for further replies.
Back
Top Bottom