Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Lumos said:
Variables.txt is not something to be edited manually,

:???: You're a way better coder than me, Lumos, (an understatement) but in all my experience coding, I've always needed to add global variables inside variables.txt. Might be something with my computer. :???:

You're right about locals, though. :smile:
 
Nah, you've just looked for a solution to a problem that is not what you think it is (, and, with a good writing practice, it's probably not really existant or extremely rare, though hard to nail down). Of course, I might be wrong and I could be suffering from a unique case of variabilis non-definitio (people who actually know Latin, feel free to slaughter me right now), but here I go:
- Doing an
Code:
(assign, "$var_name", 0),
at script_game_start or in one of the starting menus is completely enough to resolve the situation. Thing is, the compiler thinks you've not defined a variable if you don't explicitly initialise it in a similar manner, because if it's not initialised, I guess it could potentially fail to return a correct value if called before being locally set for the current usage cycle (excuse me if I'm extremely incomprehensible, it's past 00:40 around here). For a reference, I'm talking about what happens in every other programming language when you manage to call an "undefined" (I think this was the term) variable - an exception is generated (or your program crashes, depending what you're using and/or doing).
Thinking about this, adding something to the variables.txt could actually be a bad idea, you know, because that may cause the compiler to think the var is always initialised without it being so, which could result in the aforementioned error raising its filthy head and biting your buttocks when you least expect.

Ninja'd by cmp, and what he says probably means I'm on the right track.
Now excuse me please, ladies and gentlemen, I'm off to get some sleep.
 
I re-purpose global vars, setting them to be useful in another context. Native has tons of these just for single-step selectors in dialogs and debug menus and such, so I've trimmed them down quite a bit.

Ra'Jiska said:
I wish to get the value from a database on a player before he joins the game.
Normally I'd tell you to make use of the trigger conditions and consequence delay, but those don't seem to work on game triggers. Assuming you want to set-up stats before the player spawns, just prevent the presentation from showing up until stats are loaded, by forcing the player to spectator until the script finishes.
 
Lumos said:
Nah, you've just looked for a solution to a problem that is not what you think it is (, and, with a good writing practice, it's probably not really existant or extremely rare, though hard to nail down). Of course, I might be wrong and I could be suffering from a unique case of variabilis non-definitio (people who actually know Latin, feel free to slaughter me right now), but here I go:
- Doing an
Code:
(assign, "$var_name", 0),
at script_game_start or in one of the starting menus is completely enough to resolve the situation. Thing is, the compiler thinks you've not defined a variable if you don't explicitly initialise it in a similar manner, because if it's not initialised, I guess it could potentially fail to return a correct value if called before being locally set for the current usage cycle (excuse me if I'm extremely incomprehensible, it's past 00:40 around here). For a reference, I'm talking about what happens in every other programming language when you manage to call an "undefined" (I think this was the term) variable - an exception is generated (or your program crashes, depending what you're using and/or doing).
Thinking about this, adding something to the variables.txt could actually be a bad idea, you know, because that may cause the compiler to think the var is always initialised without it being so, which could result in the aforementioned error raising its filthy head and biting your buttocks when you least expect.

Ninja'd by cmp, and what he says probably means I'm on the right track.
Now excuse me please, ladies and gentlemen, I'm off to get some sleep.

Wait, so globals are defined in script_game_start, with (assign, "$new_global_variable", 0), ...?

The reason I've thought I need to define variables in the .txt file is because, the first time when I made a new dialog, (my first time using global variables) it gave me a bunch of errors that I eventually fixed by going into variables.txt and adding the new global variables.

I defer to you're coding awesomeness, so I'll test it tomorrow :smile:. (I'm not on my modding computer so I can't test it right now)
 
If you just compile again it will be appended to variables.txt and the compiler will stop complaining. Or you could just remove the logging routine entirely until the final compilation.
 
Hey all, I'm curious as to how I would add skills to the game, something like increasing weapon swing speed with more points invested. Could someone walk me through that?

Thanks in advance!

P.S., Lumos, I've put the expansive world thing aside. I learned a lot about the mod system, but I wasn't able to solve all of the issues I encountered. Thanks for your help with that project!
 
You don't, there's no operation to induce faster swings other than forcing attacks from a trigger. The agent_set_x_modifier allows you to emulate ironflesh, powerstrike, power draw/throw, athletics, and change reload speed/accuracy/use time.
 
Somebody said:
I'll make a post about using the agent modifiers once I get around to testing it along with some other stuff I don't have time to work on.

Thank you soooo much, I really appreciate your effort.
 
@Lumos
Somebody
cwr

I understand now thanks  :razz:

Diffucult in english  :lol:

By a miracle i don't have bugs in my mod  for the moment :lol:
my codes are not perfect for sure... :???:

but it work  :mrgreen: i do make this better for my futur scripts...
 
Hello,

Does anyone know how to turn your average .dds texture file into a normal map texture file using gimp?

I want to add a new normal map texture to replace the swed_pike normal texture for a better one.

Thank you.
 
Mike12096 said:
Hello,

Does anyone know how to turn your average .dds texture file into a normal map texture file using gimp?

I want to add a new normal map texture to replace the swed_pike normal texture for a better one.

Thank you.


https://drive.google.com/folderview?id=0B-tNwfOFCeY3cW5HTlQtZ3BRbmM&usp=sharing


you need to place the extracted files in your gimp plugins folder in program files or documents  if you use win7
 
Ok, so I'm trying add a battle charge to my mod. Essentially my goal is to make it so that when you hit a button, in this case m, you will jump for an extended period of time, giving the appearance that you are "charging" the enemy. I created a new animation code, using the jump animation. However, when I go to the given mission that the mission template I wrote it in, nothing happens when I press the key. Here is my code:

module_animations:

["charge", acf_enforce_lowerbody, amf_priority_jump|amf_play|amf_client_prediction, [3.0, "anim_human", 22, 46, arf_blend_in_1]],


module_mission_templates:

(0, 0, 10, [(key_clicked, key_u), (play_sound,"snd_man_warcry"),
], [
(try_begin),
    (assign,":player_agent"),
    (agent_set_animation, ":player_agent", "anim_charge"),
(try_end),
]),





This is really my first time trying to create my own codes instead of modifying existing ones. What else do I need to add/change to get it to work?
 
Hartzekar said:
    (assign,":player_agent"),

You need to assign the local variable ":player_agent" to something.

Here's how to use assign variables correctly:

Code:
(assign, ":local_variable", 1),
# or
(assign, ":local_variable", "trp_player"),

If you want to use a global variable, it would be like this:
Code:
(assign, "$global_variable", 1),
# or
(assign, "$global_variable", "trp_player"),


Edit: Does anyone know how to store a specific facecode for a troop? Then, assign the facecode to a certain troop later?

The reason is, the player will battle a troop (but not an companion troop, just a generic one) with a randomized facecode, and I want to store the facecode for when the player talks to that troop later. :smile:

It's not totally necessary, but it would be nice. :smile:
 
New modder here, Would it be possible to make a script that when a player on team 1 dies, they are automatically swapped to team 2 for the rest of the round? And could a check be put in place to stop players from quitting and rejoining to get back on team 1?
 
Darth Audimarl said:
New modder here, Would it be possible to make a script that when a player on team 1 dies, they are automatically swapped to team 2 for the rest of the round? And could a check be put in place to stop players from quitting and rejoining to get back on team 1?
I'm assuming you're talking for MP, and it's possible.

Hartzekar said:
First, your indentation sucks. Always maintain proper indentation, or you'll get lost in your own code pretty quickly.
STILL WILL NOT WORK
Code:
(0, 0, 10, [
	(key_clicked, key_u),
	(play_sound,"snd_man_warcry"), 
   ], [
	(try_begin),
		(assign,":player_agent"),
		(agent_set_animation, ":player_agent", "anim_charge"), 
	(try_end), 
   ]),
Now, let's get to the code.
Firstly, play_sound has no reason to be up there in the conditions block. Put it in the consequences.
Code:
(assign, ":player_agent"),
is utterly and completely useless, since you're not assigning anything to this variable. You should use
Code:
(get_player_agent_no, ":player_agent"),
an operation that is specifically designed for retrieving the player's agent. Also, get rid of the try_ block in the consequences, it doesn't help you in any way.
Here's how I'd make it look (not really, but let's accept that I would do it like this):
Code:
(0, 0, 10, [(key_clicked, key_u)], [
	(play_sound, "snd_man_warcry"), 
	(get_player_agent_no, ":player_agent"),
	(agent_set_animation, ":player_agent", "anim_charge"), 
   ]),
Now, will it work? Nope.
You see, jumping is special. Or at least it was sometime before. AFAIK, you can't modify an agent's Z position if they aren't already jumping, which means that you have to bind your trigger to CTRL+JUMP with a small delay so the agent can already be in the air or something like that.
In other words, I'm really doubting that pressing "u" for a jumping animation will work. Given that your animation is called "charge" though, it might. However, your animation hasn't got the acf_displace_position flag, nor does it state any displacement, which means that your agent will either stand still whilst performing it, or will move, but warp back to his previous position when it's done.
 
Thanks Lumos. I'll work on my indentation, and will keep playing with the code. I basically tried to use the format of the Combat Abilities Kit OSP.

Quite honestly with the assign stuff, I had absolutely no idea what I was doing. I just kinda threw stuff in there that I saw a lot in other similar codes.

Thanks for your help!



Edit: The person just holds their arms out like an idiot for 3 seconds. lol So, how would I have it apply that length increase while they're in the air?

Sorry for sounding like an idiot, I'm trying to figure out how all of this stuff works.
 
Status
Not open for further replies.
Back
Top Bottom