How to make AI attack player Jedi without getting rid of invincibility?

Started by Bluetothestars, November 18, 2020, 08:42:32 PM

Previous topic - Next topic
Carried on from another post since no one was answering. Basically if I make say Mace Windu's health 1000, he will still block and such, however he'll die from grenades as well as turrets like on BES Platforms. If I keep his health at the 100000, no one will attack him. Why is this?


It's a hard coded limitation because you don't need AI attacking a target with no hope of destroying it.  There's a threshold that I think is based on weapon damage - but I don't know this for sure.  What I do know is that you can't change that behavior.

Generally, if you're not getting an answer, it's because we don't know. Keep the double posting about the same topic to a minimum please.
The BOBclan:  A Rich History


Quote from: Unit 33 on November 29, 2014, 03:44:44 AM
'Please, tell me more about the logistics of the design of laser swords being wielded by space wizards' - Some guy on the internet.

Quote from: Dark_Phantom on November 19, 2020, 04:55:54 AM
It's a hard coded limitation because you don't need AI attacking a target with no hope of destroying it.  There's a threshold that I think is based on weapon damage - but I don't know this for sure.  What I do know is that you can't change that behavior.

Generally, if you're not getting an answer, it's because we don't know. Keep the double posting about the same topic to a minimum please.
Okay, sure. I'd appreciate it if you would at least let me know if you don't know, I think it's a ridiculous to assume I'd know that, the forums don't seem very active so I thought there just weren't people looking.

But yeah, I'd actually wonder why it's hard coded for other units though, since they still attack the Jedi Heroes.

Quote from: Bluetothestars on November 18, 2020, 08:42:32 PM
Carried on from another post since no one was answering. Basically if I make say Mace Windu's health 1000, he will still block and such, however he'll die from grenades as well as turrets like on BES Platforms. If I keep his health at the 100000, no one will attack him. Why is this?

Well, if they only attack if his health is at 1000, but you want to keep him alive, then why not use AddHealth to just constantly restore his health?

Example:

MaxHealth   = 1000.0
AddHealth       = 999

I haven't tested this, but it might work as the addhealth happens every second.




Quote from: Napseeker on November 20, 2020, 02:25:10 PM
Well, if they only attack if his health is at 1000, but you want to keep him alive, then why not use AddHealth to just constantly restore his health?

Example:

MaxHealth   = 1000.0
AddHealth       = 999

I haven't tested this, but it might work as the addhealth happens every second.
Hey, sorry for late reply, for some reason I'm not getting notifications.

I have tried the AddHealth method, however it only works on the ground, where as when a turret launches you in the air your health doesn't regenerate. Even then, most of the time it won't actually be fast enough since larger turrets and vehicles do way more damage.

Has any modders here tried to make it so that the player can gain "Jedi Hero Status"? If that were possible, then we wouldn't need to change anything. That way it'd make a true Jedi hero mod.

You can't change the state of the units after they are loaded in, unlike BF2.
For example:
At load time, the units are called in.  For the purposes of BF1, they are done.  You also can't lock classes out like in BF2.  Now, in BF2, with the award system/hero spawning, you could do this, but none of this dynamic code existed for the first game.

Melee combat and Jedi were not a focus of BF1.  That's why you see such limited support for it.  Also, if AddHealth isn't working, please check for typos.  AddHealth should be adding once a second if I remember correctly (like Napseeker said), even if you are in the air (I could be wrong here).
The BOBclan:  A Rich History


Quote from: Unit 33 on November 29, 2014, 03:44:44 AM
'Please, tell me more about the logistics of the design of laser swords being wielded by space wizards' - Some guy on the internet.

Quote from: Dark_Phantom on November 22, 2020, 06:20:41 PM
You can't change the state of the units after they are loaded in, unlike BF2.
For example:
At load time, the units are called in.  For the purposes of BF1, they are done.  You also can't lock classes out like in BF2.  Now, in BF2, with the award system/hero spawning, you could do this, but none of this dynamic code existed for the first game.
Right, but what I mean is making it so the player has the "hero class", and if I'm correct only 1 hero can spawn, however I may be off the mark here.

Quote from: Dark_Phantom on November 22, 2020, 06:20:41 PM
Melee combat and Jedi were not a focus of BF1.  That's why you see such limited support for it.  Also, if AddHealth isn't working, please check for typos.  AddHealth should be adding once a second if I remember correctly (like Napseeker said), even if you are in the air (I could be wrong here).
Yeah, no, I did that. I tested it against less harmful items like grenades, and the "AddHealth" only activates when on the ground, while being launching in the air with the falling animation, the "AddHealth" doesn't activate.

There's two options here:
AddUnitClass(ALL,"all_inf_luke/whatever",0)
or use this:
http://www.swbfgamers.com/index.php?topic=12549.msg117130#msg117130

It's not the same, but maybe someone else has a better solution.
The BOBclan:  A Rich History


Quote from: Unit 33 on November 29, 2014, 03:44:44 AM
'Please, tell me more about the logistics of the design of laser swords being wielded by space wizards' - Some guy on the internet.

Quote from: Dark_Phantom on November 22, 2020, 09:18:56 PM
or use this:
http://www.swbfgamers.com/index.php?topic=12549.msg117130#msg117130

It's not the same, but maybe someone else has a better solution.
Wow, I looked at that and tried it, it really is basically a true Jedi Herp mod/trainer, however, it spawns in two Heroes instead of one (that being the player).

Is the 6th class an actual class in the game, being the hero class? If so then you basically were able to successfully make it so we can play as a true Hero, now there's only one more thing to fix, that being there's an additional hero that spawns in. Would there be a way to fix that?

The technical explanation is that the game assigns the character select for human and AI in slots 0-4 in the base game.  Slot 5 (or if you start at 1, number 6) is assigned to the hero.  This was never meant to be selectable, but in my testing for a way to make more than 5 units work on the spawn screen, I came across this minor discovery.  It was fun and so I released it as a trainer.

I don't have any practical way to stop the AI from spawning as the hero though.  I ran into this issue on another map I did a long time ago.  If you don't spawn in quickly enough, the AI will compensate to balance teams - think of a hero as a +1, if there's already a hero, then it shouldn't spawn as one.  You could lengthen the time until the AI spawn by changing SetSpawnDelay(10.0, 0.25) to something higher, like SetSpawnDelay(20.0, 0.25), but then you'll be waiting longer for the AI to pop in.  However, the AI shouldn't spawn as a hero then.

For actual additional spawn screen units, see here: http://www.swbfgamers.com/index.php?topic=13140.msg119800#msg119800
TL;DR - the spawn screen only natively uses 5 units and any more than that is unstable and janky, but possible.

The BOBclan:  A Rich History


Quote from: Unit 33 on November 29, 2014, 03:44:44 AM
'Please, tell me more about the logistics of the design of laser swords being wielded by space wizards' - Some guy on the internet.

Quote from: Dark_Phantom on November 23, 2020, 06:02:25 AM
The technical explanation is that the game assigns the character select for human and AI in slots 0-4 in the base game.  Slot 5 (or if you start at 1, number 6) is assigned to the hero.  This was never meant to be selectable, but in my testing for a way to make more than 5 units work on the spawn screen, I came across this minor discovery.  It was fun and so I released it as a trainer.

I don't have any practical way to stop the AI from spawning as the hero though.  I ran into this issue on another map I did a long time ago.  If you don't spawn in quickly enough, the AI will compensate to balance teams - think of a hero as a +1, if there's already a hero, then it shouldn't spawn as one.  You could lengthen the time until the AI spawn by changing SetSpawnDelay(10.0, 0.25) to something higher, like SetSpawnDelay(20.0, 0.25), but then you'll be waiting longer for the AI to pop in.  However, the AI shouldn't spawn as a hero then.

For actual additional spawn screen units, see here: http://www.swbfgamers.com/index.php?topic=13140.msg119800#msg119800
TL;DR - the spawn screen only natively uses 5 units and any more than that is unstable and janky, but possible.
Yeah, I just tested it, no matter how fast I spawn in, another hero on my side always spawns in as well. So I'm guessing it probably wouldn't matter if I did lengthen the time, since the AI spawns a hero regardless. It's strange, if the player becomes the hero, it makes sense that the AI would just not spawn in another one, but it doe anyway. Very strange.

This is probably a situation then where the normal game logic doesn't apply - it was never designed for the human to be the hero.  :shrug:
The BOBclan:  A Rich History


Quote from: Unit 33 on November 29, 2014, 03:44:44 AM
'Please, tell me more about the logistics of the design of laser swords being wielded by space wizards' - Some guy on the internet.