Several coding questions regarding troops (might be a bit advanced) [SOLVED]

Users who are viewing this thread

Yukisuna

Recruit
Hello, im completely new to this modding community, and to modding this game.

I've recently picked up modding for my now favourite game. I've been modding Star Wars Battlefront II for a couple years and they are very similar in the file-and-code setup. I just have some simple questions regarding strings and the like.

First of all, as i have no clue to what extent strings and scripts can make operations happen. Is it possible to make the players name show up in Troop names, like a title? I'm working on a troop tree for the player faction, that can be recruited once you have established a faction for yourself. I would like to have the name alter based on the name of the player. I understand that > {playername} troop_name < will not work, but is this possible to change this without writing a hundred lines of code?

Secondly, (and this is probably advanced) would it be possible to create a script to make the AI soldiers under your command aim where you are aiming? I'm creating spearmen with throwing spears (REAL Throwing spears, not the tiny Jarid replica) and to keep it somewhat realistic i had to slow down the projectile velocity, resulting in the spears falling to the ground rather quickly and an uncomfortably short range. (of course, this is in fact very balanced considering how strong the spears ended up being compared to other throwing items) I know the advanced commands are easy to implement (i have already done so) but would it be able to chain the "fire on my command"-string with a "fire at my target"-esque script? This would allow for, say, "our arrows will blot out the sun"-style volleys. Accuracy is of no value as long as the soldiers start throwing the spears before the enemy forces crash head to head with them.
 
No reason (troop_set_name, "trp_whatever", "@{playername} troop_name"), won't work.
In response to the second, agent_set_look_target_position will allow you to force an attack in a certain direction if used in conjunction with agent_set_attack_action. The trick is to find out where exactly the player is looking.
 
Somebody said:
No reason (troop_set_name, "trp_whatever", "@{playername} troop_name"), won't work.
In response to the second, agent_set_look_target_position will allow you to force an attack in a certain direction if used in conjunction with agent_set_attack_action. The trick is to find out where exactly the player is looking.

Thank you for the quick and factual response, my main issue is that i've already tried using playername in the troop title. It showed up exactly the way it was written, symbols and all. About the second answer, where would i input these commands? i'll do some research to find a way to activate this script ingame, but in the meantime, what file exactly would i input the lines you specified?
 
Do (str_store_string, s1, "@{playername} name"), followed by (troop_set_name, "trp", s1),
You need to add a trigger within the mission template to have agents do custom volleys.
 
Somebody said:
Do (str_store_string, s1, "@{playername} name"), followed by (troop_set_name, "trp", s1),
You need to add a trigger within the mission template to have agents do custom volleys.

Thank you so much, these are the answers i was looking for! :grin: Now i can finally get started for real!
 
Back
Top Bottom