Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Ritter Dummbatz said:
You mean you still get the same error as you posted before? Did you try a smaller map? Does it crash when you do a specific operation or does it still crash right after loading?

If it is crashing after loading the editor I have no clue. Make sure your editor settings aren't too demanding. Like map density, standard would be 0.5 don't raise it too high. Try a smaller map. Buy more RAM....I have no clue and that error message you posted doesn't really say anything else but that it crashes.
i dont do nothing crash sfter run
i have 4gb ram
and i try to edit map from nativ mode and again crash
 
I'll add restrictions later. At first i only want to get it going... And with this code i have now, everything is fine ingame... The sound is coming correctly with the script as i posted it... In my script, parameter three is given as the sound, or not? And this works fine...
 
Z.Master said:
i dont do nothing crash sfter run
i have 4gb ram
and i try to edit map from nativ mode and again crash

Well,the normal game map is clearly not too big.  :smile: 4GB is more than enough. The program should work if you have done nothing wrong with the install. May be check user rights for the folder you are working with. May be it helps running it as administrator especially on systems like win7 or vista and such. You want rights to be able to modify files of course and not read only, of course.

 
Patta said:
I'll add restrictions later. At first i only want to get it going... And with this code i have now, everything is fine ingame... The sound is coming correctly with the script as i posted it... In my script, parameter three is given as the sound, or not? And this works fine...
I didn't read it very thoroughly the first time - the code posted is more mixed up than I thought: to the server you send in the order agent, sound, but on the server you store agent, event type, and then send to the clients agent (labelled sound), event type. What you need to do is pick one order and use it for all code, and realise that the first int you send is parameter 3, the next is 4. So the code should look like:
Code:
(multiplayer_send_2_int_to_server, event, agent, sound),

(store_script_param, agent, 3),
(store_script_param, sound, 4),

(multiplayer_send_2_int_to_player, player, event, agent, sound),
 
I got it, yes. Changed it. i don't get no errors while compiling anymore, only when executing the script ingame... (it's called on giving an order (charge atm) to bots...) Then i get three errors with "Invalid Agent ID: 132" and with 0 too...
It works, but the messages come... why is this?
 
Is it possible for a party (in this case a town) to have more then one slot?

I'm trying to stick two slots with:

(party_set_slot,"p_town_18", slot_party_type, spt_town_with_gateway),
(party_set_slot,"p_town_18", slot_party_type, spt_town),

Does that set the town_18 to both have the spt_town and spt_town_with_gateway as slots?

I guess I could do it with a variable for gateway otherwise.
 
A slot may contain only one value - for storage purposes you could use bitmasks, but that's not applicable here. Define another slot in module_constants and use (party_set_slot,"p_town_18", slot_town_has_gateway, 1), as opposed to using an existing slot.
 
I want to make it more efficent and apply to town, villages and castles as well as some none-moving parties on the worldmap. Would this code inserted into the encounter script do it?

Code:
(party_slot_eq, "$g_encountered_party", slot_party_type, slot_has_gateway, 1),
			(try_begin)
				(this_or_next|party_slot_eq, "$g_encountered_party", slot_party_type, spt_town),
				(party_slot_eq, "$g_encountered_party", slot_party_type, spt_castle),
		            (jump_to_menu, "mnu_castle_outside"),
			(else_try)
                                (party_slot_eq, "$encountered_party", slot_party_type, spt_village),
                                (jump_to_menu, "mnu_village"),
                        (else_try)
				(jump_to_menu, "mnu_gateway_start"),
			(try_end),

If encounter is town or castle, go to standard town/castle menu. If it is village go to village menu, if it's neither but still has "slot_has_gateway, 1" then goto mnu_gateway_start
 
backstrom said:
(party_slot_eq, "$g_encountered_party", slot_party_type, slot_has_gateway, 1),
This is problematic. There is 1 too many parameters in this operation. Currently you are asking it to check if the slot_party_type for the encountered party equals "slot_has_gateway". You want to get rid of the party type bit.

Like so:
(party_slot_eq, "$g_encountered_party", slot_party_has_gateway, 1),

backstrom said:
If encounter is town or castle, go to standard town/castle menu. If it is village go to village menu, if it's neither but still has "slot_has_gateway, 1" then goto mnu_gateway_start

If there are non-moving parties on the worldmap, what are the values for their slot_party_type?
My suggestion would be to nest your check for a gateway within a check for those specific parties (that specific party type) since you end up ignoring the gateway for towns and castles.

So, you would just add an else_try to the checklist of party types that looks like
Code:
    (else_try),
        (party_slot_eq, "$g_encountered_party", slot_party_type, spt_INSERT_STATIONARY_PARTY_TYPE_HERE),
        (try_begin),
           (party_slot_eq, "$g_encountered_party", slot_party_has_gateway, 1),
           (jump_to_menu, "mnu_gateway_start"),
        (else_try),
           #do whatever you'd normally do for those stationary parties
        (try_end),
    #continue on with the next else try with a different party type
 
I have this code for a system where you press a key and something happens, depending on the Item you're holding. This works fine, but I could need help with something:
Code:
IT_magic_system = (0, 0, 60, #every frame
      [
       (key_clicked, key_h), #could use global var, game_key, or something - see list in header_triggers
       (get_player_agent_no, ":agent"),
       (agent_get_wielded_item, "$staff", ":agent", 0),
      ],
			[
			(try_begin),
	   (eq, "$staff", "itm_heal_staff_1"),			
			(get_player_agent_no, ":player_agent"),
 
				(store_agent_hit_points,":life",":player_agent",1),
				(val_add,":life",20),
				(agent_set_hit_points,":player_agent",":life",1),
               (agent_set_animation, ":player_agent", "anim_defend_shield_right"),
				(particle_system_burst,"psys_heal_1",pos1,100),							   
	(display_message,"@Works!",0x6495ed),       			
			(else_try),
	   (eq, "$staff", "itm_destr_staff_1"),

			(get_player_agent_no, ":player_agent"),
 
				(agent_equip_item,":player_agent","itm_burning_skull"),
                (agent_set_animation, ":player_agent", "anim_defend_shield_right"),		
				(particle_system_burst,"psys_brazier_fire_1",pos1,100),						
	(display_message,"@Works!",0x6495ed),
			(else_try),
	   (eq, "$staff", "itm_curse_staff_1"),

			(get_player_agent_no, ":player_agent"),
               (agent_get_position, pos1, ":player_agent"), 
				(agent_equip_item,":player_agent","itm_burning_skull"),
                (agent_set_animation, ":player_agent", "anim_defend_shield_right"),
				(particle_system_burst,"psys_necromancy_1",pos1,100),				
	(display_message,"@Works!",0x6495ed),	
			(try_end),
			])
So this is the code. What i want now, is another item that gives the user better equipment for a short time when pressing the key. So, i have problems with storing the equipment at the beginning and with a timer... how could i do it best?
 
Code:
give_loot = (0, 30, 0,
  [
     (key_clicked, key_h),
     (get_player_agent_no, ":agent"),
     (agent_has_item_equipped, ":agent", "itm_lewt"),
     (agent_equip_item, ":agent", "itm_phat_lewt"),
  ],
  [
    (get_player_agent_no, ":agent"),
    (agent_unequip_item, ":agent", "itm_phat_lewt"),
  ]),
 
Code:
        (store_random_in_range, ":rand_num", 1,5),	#randomize one number between 1 and 5 and store as :rand_num
	(try_begin),
		(lt, (":rand_num", 3)), #:rand_num < 3. Bad outcome (2/5 chance)
		(store_random_in_range, ":rand_num", 1,5), #random 1 to 5 again
		(try_begin),
			(eq, (":rand_num", 1)),
			(jump_to_menu, "mnu_gateway_bad1"), #bad menu 1...
		(else_try),
			(eq, (":rand_num", 2)),
			(jump_to_menu, "mnu_gateway_bad2"), #bad menu 2...
		(else_try),
			(eq, (":rand_num", 3)),
			(jump_to_menu, "mnu_gateway_bad3"), #bad menu 3... and so on up to 5
		(else_try),
			(eq, (":rand_num", 4)),
			(jump_to_menu, "mnu_gateway_bad4"),
		(else_try),
			(eq, (":rand_num", 5)),
			(jump_to_menu, "mnu_gateway_bad5"),
		(try_end),
	(else_try),
		(eq, (":rand_num", 3)), #:rand_num = 3 good outcome (1/5 chance)
		(store_random_in_range, ":rand_num", 1,5), #random 1 to 5 again
		(try_begin),
			(eq, (":rand_num", 1)),
			(jump_to_menu, "mnu_gateway_good1"), #good menu 1... to 5
		(else_try),
			(eq, (":rand_num", 2)),
			(jump_to_menu, "mnu_gateway_good2"), 
		(else_try),
			(eq, (":rand_num", 3)),
			(jump_to_menu, "mnu_gateway_good3"), 
		(else_try),
			(eq, (":rand_num", 4)),
			(jump_to_menu, "mnu_gateway_good4"),
		(else_try),
			(eq, (":rand_num", 5)),
			(jump_to_menu, "mnu_gateway_good5"),
		(try_end),
	(else_try),
		(gt, (":rand_num", 3)), #:rand_num > 3 neutral outcome (2/5 chance)
		(store_random_in_range, ":rand_num", 1,5), #random 1 to 5 again
		(try_begin),
			(eq, (":rand_num", 1)),
			(jump_to_menu, "mnu_gateway_neutral1"), #good menu 1... to 5
		(else_try),
			(eq, (":rand_num", 2)),
			(jump_to_menu, "mnu_gateway_neutral2"), 
		(else_try),
			(eq, (":rand_num", 3)),
			(jump_to_menu, "mnu_gateway_neutral3"), 
		(else_try),
			(eq, (":rand_num", 4)),
			(jump_to_menu, "mnu_gateway_neutral4"),
		(else_try),
			(eq, (":rand_num", 5)),
			(jump_to_menu, "mnu_gateway_neutral5"),
		(try_end),
	(try_end),

Is there any other way to get a random mnu in the same way as written above? This was good writing to get a handle on syntax, but I figured halfway through there ought to be a better way to handle it.
 
Somebody said:
Code:
give_loot = (0, 30, 0,
  [
     (key_clicked, key_h),
     (get_player_agent_no, ":agent"),
     (agent_has_item_equipped, ":agent", "itm_lewt"),
     (agent_equip_item, ":agent", "itm_phat_lewt"),
  ],
  [
    (get_player_agent_no, ":agent"),
    (agent_unequip_item, ":agent", "itm_phat_lewt"),
  ]),

The Problem is that i want to completely change the equipment, what means to take away the items from the player, and give them back when the timer is done... Anyway, thx.
 
Patta said:
The Problem is that i want to completely change the equipment, what means to take away the items from the player, and give them back when the timer is done... Anyway, thx.
Then, before unequiping the items, store the item ID and its modifier in agent slots. It will take 2 agent slots per item, but seems a fairly straight-forward way to do it. Once you unequip the magic stuff, just get the ID/modifier from the slots and re-equip the agent.

backstrom said:
(lt, (":rand_num", 3)),
First, a note on syntax:
(lt, ":rand_num", 3),

would be the appropriate format for that command.  Too many parentheses here. Similarly for your equality checks.

Second, since all items in the games are indexed and referred to by their numeric equivalents, not their names, you can simplify this greatly.

(store_random_in_range, ":rand_num", 1,5)
...and the subsequent try block

could simply be

(store_random_in_range, ":menu", "mnu_gateway_bad1", "mnu_gateway_bad5" + 1),
(jump_to_menu, ":menu"),

Fully simplified:
Code:
        (store_random_in_range, ":rand_num", 1, 6),	#randomize one number between 1 and 5 and store as :rand_num
	(try_begin),
		(lt, ":rand_num", 3), #:rand_num < 3. Bad outcome (2/5 chance)
		(store_random_in_range, ":menu", "mnu_gateway_bad1", "mnu_gateway_bad5" + 1),
	(else_try),
		(eq, ":rand_num", 3), #:rand_num = 3 good outcome (1/5 chance)
		(store_random_in_range, ":menu", "mnu_gateway_good1", "mnu_gateway_good5" + 1),
	(else_try),
		(gt, ":rand_num", 3), #:rand_num > 3 neutral outcome (2/5 chance)
		(store_random_in_range, ":menu", "mnu_gateway_neutral1", "mnu_gateway_neutral5" +1),
	(try_end),
	(jump_to_menu, "":menu"),
**EDIT: With Somebody pointing out the obvious to me, an addendum: do not take "mnu_gateway_<quality>5" + 1 literally, but rather use the name of the NEXT menu after the fifth gatweay in the game_menus file. Additionally, the above assumes your gateway menus are placed in sequential order in your game_menus file (bad1 through bad5, followed by good1 - good 5, and neutral1 - neutral5).

Third, remember with most ranges in the game, the engine includes the starting value, but stops one shy of the ending value. So you need the top of your range to be 1 more than you actually want the engine to work with.

Also, if you haven't, you might want to peruse the syntax link in my sig.
 
backstrom said:
Is there any other way to get a random mnu in the same way as written above? This was good writing to get a handle on syntax, but I figured halfway through there ought to be a better way to handle it.
There should only ever be one set of brackets enclosing a line of code. First, make sure your menus are categorized.
Code:
        (store_random_in_range, ":rand_num", 1,6),	#randomize one number between 1 and 5 and store as :rand_num
        (assign, ":menu", -1),
	(try_begin),
          (lt, ":rand_num", 3), #:rand_num < 3. Bad outcome (2/5 chance)
	  (store_random_in_range, ":rand_num", 0,5), #random 0 to 4 again
          (val_add, ":menu", "mnu_gateway_bad1"),
        (else_try), #other conditions, similar code
          ...
        (try_end),
        (try_begin),
          (gt, ":menu", -1),
          (jump_to_menu, ":menu"),
        (try_end),
Patta said:
The Problem is that i want to completely change the equipment, what means to take away the items from the player, and give them back when the timer is done... Anyway, thx.
Reverse the code and unequip at the condition, then equip in the consequence. Describe your problem more completely next time.
Caba`drin said:
Then, before unequiping the items, store the item ID and its modifier in agent slots. It will take 2 agent slots per item, but seems a fairly straight-forward way to do it. Once you unequip the magic stuff, just get the ID/modifier from the slots and re-equip the agent.
...
(store_random_in_range, ":menu", "mnu_gateway_bad1", "mnu_gateway_bad5" + 1),
(jump_to_menu, ":menu"),
Unfortunately, agent item operations do not take into account the modifier. There is no reliable way to do so other than parsing through the first four inventory slots in the troop's inventory - but even that is subject to change from picking up items on the battlefield, as the ti_on_item_picked_up/dropped triggers are not functional (in singleplayer at least).
The second suggestion would not work - the menu enclosed in quotes is a reference, not an absolute id. You would either to specify the menu after mnu_gateway_bad5 or use the id.
 
Hello!

When it comes to adding new scene props, what do you gotta change? Cause I went into module_scene_props and added this:

("helmsdeep",0,"helmsdeep","bo_helmsdeep", []),

But when I start up the game gets stuck at "loading setting data" and then I get this error:
]
feilmelding.jpg

Does anyone know what might be causing it?

Help is much appreciated : )
 
Status
Not open for further replies.
Back
Top Bottom