[Solved] Fake console commands in mission script/ Hero health questions
Moderator: Moderators
-
JustSomeGuy
- Private Recruit
- Posts: 16
- Joined: Wed Jul 22, 2020 4:25 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
[Solved] Fake console commands in mission script/ Hero health questions
I know you can set an AI hero's health but I would like to know if you can set a player hero's health value in a mission script so that the hero has different health on different missions. Additionally, I want to know if fake console commands can be preset in the script. More specifically, I want to change the fov on certain missions, and eliminate fall damage from others without creating entirely new versions of the characters, or manually using the fake console commands every time one of those missions are played. Thanks in advance.
Last edited by JustSomeGuy on Mon Sep 07, 2020 9:18 pm, edited 1 time in total.
-
Sporadia
- Corporal

- Posts: 152
- Joined: Thu Jan 24, 2019 11:02 pm
- Projects :: No Mod project currently
- xbox live or psn: No gamertag set
Re: Fake console commands in mission script/ Hero health questions
The answer to your first question is a definitive yes. You can use the mission lua to change any unit's health. Just put some code like this in the ScriptPostLoad() function:
SetClassProperty() changes a class' traits at the spawn screen. If you wanted to get more complicated and start changing the health of units that are already spawned, then you will have to use SetProperty() instead. I wrote something on how to do that in the past (read the spoiler):
http://www.gametoast.com/viewtopic.php? ... 95#p537695
Or there's a simpler thread on the sticky if you want to start there:
http://www.gametoast.com/viewtopic.php?f=27&t=13946
Fake Console commands aren't lua, but there is a lua solution to removing fall damage. It's SetClassProperty() again.
You can use SetProperty() and SetClassProperty() to change any line that appears in an odf. That's what they're for. CollisionScale = "0.0 0.0 0.0" is taken from the jettrooper odf so I hope it's the right line.
I haven't looked into changing fov so can't help you there. There is probably a way of modding fov without using the fake console though.
Edit: Had to fix the links
Code: Select all
SetClassProperty("all_hero_leia", "MaxHealth", 400) -- set leia's max health to 400
SetClassProperty("all_hero_leia", "CurHealth", 400) -- set leia's current health to 400
http://www.gametoast.com/viewtopic.php? ... 95#p537695
Or there's a simpler thread on the sticky if you want to start there:
http://www.gametoast.com/viewtopic.php?f=27&t=13946
Fake Console commands aren't lua, but there is a lua solution to removing fall damage. It's SetClassProperty() again.
Code: Select all
SetClassProperty("all_inf_rifleman", "CollisionScale", "0.0 0.0 0.0")
I haven't looked into changing fov so can't help you there. There is probably a way of modding fov without using the fake console though.
Edit: Had to fix the links
-
JustSomeGuy
- Private Recruit
- Posts: 16
- Joined: Wed Jul 22, 2020 4:25 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
Re: Fake console commands in mission script/ Hero health questions
Wow, I had no idea mission scripting was that powerful or versatile when it came to editing units. This was very helpful, thank you. I'll leave the thread open for a few more days just in case anyone knows an answer to the fov problem, though.
Edit: Never mind, I figured it out
Edit: Never mind, I figured it out
