Store a random variable and assign a different particle system based on the result. Or, preferably, use the list-based indexing of the entire ModSys: put all of the particle systems you need in order, then (pseudo MBscript):
Code:
(assign, ":psys_to_use", "psys_lanse"), # The first one in the list = offset 0
(store_random_in_range, ":offset", 0, 4), # offset ∈ [0, 3] IIRC
(val_add, ":psys_to_use", ":offset"),
(particle_system_burst, ":psys_to_use", pos1, 3),
Everything is essentially a list, and (almost) everything can be iterated in a similar manner. It's one of the few really neat things about the ModSys in general.
That however requires a dummy field at the end, or being extra careful when adding stuff later. Would one or two operations really make that much of a difference when it comes to performance?
Not that much, but imagine those little optimizations all over the MS... it would result a noticeable performance boost.
However, both variants work and thats what matters... for the most people.
That's an interesting question, because I'm not quite sure what you mean. I'll assume you've got a regular fraction with a numerator, line, and denominator. If you want to convert it to a decimal, feed it through a calculator or perform manual division number by number. But I usually prefer keeping things in fractionals. It's more useful in general.
If you've got a large numerator and you want to convert it into a mixed fraction, as in 23/4: Divide the numerator by the denominator with remainder. The remainder is now the numerator, and the number you got is the quotient. 23/4 = 5 (rem. 3) => 23/4 = 5*(3/4). Easy peasy!
That doesn't "remove" the fraction per se, but changes the way it's written. Removing a fraction usually involves rounding up or down, but that leads to data corruption and loss of precision. 23/4 is 5.75, which you could usually round up to 6. Still, it's a bit less precise, but that might be okay depending on what you want your number for.
And if you want to remove factions instead, use Google and imbibe the wisdom of the mentors past and current:
Lav said:
Delete their culture and kingdom entries in module_factions.
Then, for each module_*whatever*.py file, open it and search for "fac_kingdom_" text. Wherever you find it, edit/remove as appropriate. For module_items you want to remove all faction assignments from items (and maybe set new ones). With module_troops you'll probably want to do a complete make-over, also lords and other NPCs need to be edited. In all other files, just find the code which assumes there are 6 factions in the game, and fix the code to run properly with just 2 factions.
(The answer references "just 2 factions", which was in relation to the original question; you'll obviously edit it to fit however many factions you want.)
I use agent_set_scripted_destination_no_attack to make sure that the agent is at pos1, but how do I make him rethink where he is then move back to pos1 if he is no longer there?
(try_begin),
(store_time_of_day, ":cur_hour"),
(ge, ":cur_hour", 21), #greater then 9 PM
(lt, ":cur_hour", 5), #lower then 5 AM
(store_random_in_range, ":random_in_range_1_10", 1, 10), #1 in a 10 chance of item being assigned
(try_begin),
(assign, ":rand", "random_in_range_1_10"),
(eq, ":rand", 1),
(assign, "itm_torch", trp_player), #Obtain item slot 0-4 and replace in here (Not sure what im doing here)
(else_try),
#Else try
(try_end),
(try_end),
What I need help with is: the actual assign above, i'm not sure on how to assign to slot 0 to 4, as you can see itm_torch is the itm I want assigned.
(Sorry, I just wanted an excuse to use that smiley "properly". Besides, you deserve it. Use google or your eyes next time.)
@troycall: When you want to do something, search for the relevant operations in header_operations. That file is your Bible and Encyclopaedia Britannica combined in one. Searching for "inventory_slot" might be a good idea here.
1) Please use proper indentation. Much easier to read . Check the process_line_correction.py to make it automatic ...
Code:
(try_begin),
(store_time_of_day, ":cur_hour"),
(ge, ":cur_hour", 21), #greater then 9 PM
(lt, ":cur_hour", 5), #lower then 5 AM
(store_random_in_range, ":random_in_range_1_10", 1, 10), #1 in a 10 chance of item being assigned
(try_begin),
(assign, ":rand", "random_in_range_1_10"),
(eq, ":rand", 1),
(assign, "itm_torch", trp_player), #Obtain item slot 0-4 and replace in here (Not sure what im doing here)
(else_try),#Else try
stuff ...
(try_end),
(try_end),
2) You are missing the ":" on this line
Code:
(assign, ":rand", "random_in_range_1_10"),
3) If you want 10% (1 in 10), you need to change that range. Its 0 (zero) based, and (end-1). So a
(range, 1, 10) -> [1,2,3,4,5,6,7,8,9] -> no 10 in there. That makes 1/9 (11.1%)
Usually you will see this
Code:
(store_random_in_range, ":random", 0, 10),
If you really want use 1, then go to 11
Code:
(store_random_in_range, ":random", 1, 10+1),
4) Not sure why you are reassing the rand to another variable to use it. That is not necessary. Why:
Code:
(assign, ":rand", "random_in_range_1_10"),
?
5) Troop inventory starts counting from the gear (weapons, armor, horse, food) and then moves to the backpack/chest/whetever you want to call it. See the constants on header_items.py
ek_item_0 is the first weapon (top right), and so on...
A agent follows the same system for the gear. And you have operations to remove/add items to a agent (just as you do to a troop). The important part here is that the agent is temporary, so you won't affect the savegame.
Download Lav's module and check section Z22. Remember you need to remove a item (if it is there) before giving a new one.
6) Your time test won't work. Check this operation:
Code:
is_between = 33 # (is_between, <value>, <lower_bound>, <upper_bound>),
# Checks that lower_bound <= value < upper_bound
or
Code:
is_currently_night = 2273 # (is_currently_night),
# Checks that it's currently night in the game on worldmap
I got this error after replacing swadian_recruit with kedalin_peasant_levy in every place I could find... what do I do I want to cry
http://imgur.com/MyZA5Br
What does Illegal Identifiers mean
Also how do I associate sublime with the py, it says i Have to associate with the defualt programes used to open it? how?
It worked thanks so much!
I use agent_set_scripted_destination_no_attack to make sure that the agent is at pos1, but how do I make him rethink where he is then move back to pos1 if he is no longer there?
I got this error after replacing swadian_recruit with kedalin_peasant_levy in every place I could find... what do I do I want to cry
http://imgur.com/MyZA5Br
Read the error message. It usually gives you a good idea of where things are broken.
You said you replaced the troop everywhere.
But the compiler is still trying to use it a few times. That means you did not replaced it everywhere
Search for it and finish your first step. Use a proper IDE/Text Editor like Sublime, Visual Studio Code, Notepad++ With Project Explorer plugin, etc
Sublime, as a example: CTRL+SHIFT+F will search in ALL files of your project
Khamukkamu said:
Hi, I'd like to bump my question
Khamukkamu said:
How can I make sure that an agent moves back to the position I want him to be in IF he gets moved (by a kick or by being pushed around)?
I use agent_set_scripted_destination_no_attack to make sure that the agent is at pos1, but how do I make him rethink where he is then move back to pos1 if he is no longer there?
Err best not to bump unless your question is burried a few pages back
Are you sure the troop is moving from position? As in, do you have data showing it? Did the troop changed AI behaviour after?
I don't have your code, so a workaroud that may work (quick and dirty) is to put a trigger checking every few seconds for that troop position, and ordering it back to where you want if it moved away.
Code:
agent_is_in_special_mode
is it?
Code:
agent_get_position
did it move away?
Code:
agent_set_position
can you teleport it back? If its a invisible troop (this is a teleport, not a walk back there!)
did you try make it a statue?
Code:
agent_set_no_dynamics
did you calculate AI after giving scripted orders?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.