Jump to content

AI Workshop


Recommended Posts

Posted

I got a request to make the AI Workshop from JK:Enhanced standalone. So I did that, seeing as how it was super straightforward.

 

It will be available to download here, as soon as it is approved: https://jkhub.org/files/file/3384-ai-workshop/

alternate download link available here: https://www.dropbox.com/s/acz86nkz4u76rcs/AIWorkshop.zip?dl=0

 

What does this do?

It adds over 30 fifty commands to the game for manipulating the AI.

Additionally it adds a display which shows detailed statistics about NPCs.

AND as a bonus I have increased the veh, vwp, sab, and npc limits by 16x.

AND I've added an "npc spawn random" command which spawns random NPCs.

and a cvar to make it so that friendly NPCs dont follow you by default

 

What commands are there?

Just a note, none of these commands have any restrictions. Meaning, you can do silly stuff like giving mouse droids lightsabers and have them shoot lightning at each other. I did not add the ability to add new waypoints to maps because the waypoint system is different in JKA from JK2 and this is more or less a straight port by redsaurus.

 

Here are the commands:

  • aiworkshop - enable/disable the workshop
  • workshop_commands - show all commands in the console
  • workshop_cmdhelp - gets help for a command
  • workshop_toggle_display - toggle the visuals
  • workshop_select - selects the NPC in your crosshairs. Only one NPC can be targeted at a time.
  • workshop_deselect - deselects the selected NPC
  • workshop_list_bstates - lists all of the Behavior States in the game, e.g. BS_CINEMATIC
  • workshop_list_scriptflags - lists all of the scriptflags that can be assigned to an AI
  • workshop_list_teams - lists all of the teams that an AI can belong to
  • workshop_list_aiflags - lists all of the AI flags
  • workshop_list_classes - lists all of the classes, eg CLASS_STORMTROOPER
  • workshop_list_ranks - lists all of the usable ranks
  • workshop_list_movetypes - lists all of the movement types that you can assign to an NPC
  • workshop_list_forcepowers - lists all of the force powers that can be given to an NPC
  • workshop_list_bsets - lists all of the Behavior Sets in the game, eg BSET_ANGER, BSET_VICTORY, etc
  • workshop_view_timers - lists all active timers on the selected NPC
  • workshop_set_timer <timername> <milliseconds> - sets a timer on the selected NPC
  • workshop_set_bstate <bstate> - sets the bstate of an NPC. This can be used to make an NPC follow the player, make the NPC do nothing, make the NPC stand guard, make the NPC hunt down enemies, etc etc. You'll want to experiment with different BS_ types.
  • workshop_set_goalent - sets the entity in the crosshairs as the current "goal entity". If you are targetting an item, this seems to make them go and pick it up. Or sometimes follow an NPC. It seems to vary based on context.
  • workshop_set_leader - sets the entity in the crosshairs as the "leader". If an NPC is in BS_FOLLOW_LEADER, they will follow this target and flee from enemies when it dies
  • workshop_set_enemy - sets the entity in the crosshairs as the "enemy". The NPC will attack it.
  • workshop_set_scriptflags - sets the NPC's scriptflags
  • workshop_set_weapon <weapon, or "me"> - sets the weapon that the enemy is using. This can be for e.g. WP_BRYAR_PISTOL, WP_SABER, WP_DISRUPTOR, etc. If you use "me" as a parameter it will set it to the weapon that you have equipped.
  • workshop_set_team <team> - sets the NPC's "team"
  • workshop_set_enemyteam <team> - sets the NPC's "enemy team", or who they will consider as enemies
  • workshop_set_aiflags <flags> - sets AI flags. I don't know what these are used for.
  • workshop_set_class <class> - sets the class type. This can alter behavior in some cases, especially when used on droids or animals like wampas.
  • workshop_set_rank <rank> - sets the rank. For the most part this has only subtle changes.
  • workshop_set_movetype <movetype> - sets the movement type. For instance, you can make probe droids skid around on the ground, etc
  • workshop_set_forcepower <power> <rank> - sets a force power's rank for the NPC. It doesn't mean that they'll necessarily use it, though.
  • workshop_set_bsetscript <bset> <path to ICARUS script> - tell the game to run a script when a certain bset gets activated. This would be like setting angerscript on an NPC, as an example.
  • workshop_set_parm <parm number> <value> - set a value that can be read by icarus with GET_PARM1 for example
  • workshop_play_dialogue <path to sound file> - make the NPC speak !
  • workshop_activate_bset <bset> - activates a behavior set and triggers the scripts associated with that bset
  • workshop_god - toggle godmode on an NPC
  • workshop_notarget - toggle notarget on an NPC

New in 1.01:

  • workshop_toggle_follow: With the selected NPC, toggles following on it. Meaning if you are targeting a friendly NPC, it will switch between them following you or not.
  • workshop_kill: Kills the selected NPC.
  • workshop_list_anims: Lists all of the animations in the game (warning, console spam)
  • workshop_set_health <amount>: Sets the health of the NPC.
  • workshop_set_armor <amount>: Sets the shield of the NPC.
  • workshop_set_gravity <amount>: Sets the gravity of the NPC (note, default is 800)
  • workshop_set_anim <animation>: Sets the animation that the NPC is using.
  • workshop_control: Take total control of the NPC. Better than Mind Trick Level 4 as it works on all NPCs, has infinite duration, and jump doesn't exit.
  • workshop_end_control: Stop controlling the NPC.
  • workshop_freeze: Freezes the NPC in place.
  • workshop_undying: Toggle undying mode on the NPC
  • workshop_shielding: Toggles a bubble shield on the NPC (like assassin droids have)
  • workshop_set_scale <amount>: Sets the NPC's scale.
Smoo, dg1995, Stoiss and 5 others like this
Posted

This is great! Might be very useful for all of us SP modders.

 

I think the AI flags are related to special npcs like vkothos and dkothos, who have a special AI flag that tells them to heal evil rosh, who alsi has a special AI flag.

TheWhitePhoenix likes this
Posted

I've made an update with some extra features. See the link in the OP for the download. Currently awaiting JKHub approval still.

Updates in this new version:

  • Added new commands:
    • workshop_toggle_follow: With the selected NPC, toggles following on it. Meaning if you are targeting a friendly NPC, it will switch between them following you or not.
    • workshop_kill: Kills the selected NPC.
    • workshop_list_anims: Lists all of the animations in the game (warning, console spam)
    • workshop_set_health <amount>: Sets the health of the NPC.
    • workshop_set_armor <amount>: Sets the shield of the NPC.
    • workshop_set_gravity <amount>: Sets the gravity of the NPC (note, default is 800)
    • workshop_set_anim <animation>: Sets the animation that the NPC is using.
    • workshop_control: Take total control of the NPC. Better than Mind Trick Level 4 as it works on all NPCs, has infinite duration, and jump doesn't exit.
    • workshop_end_control: Stop controlling the NPC.
    • workshop_freeze: Freezes the NPC in place.
    • workshop_undying: Toggle undying mode on the NPC
    • workshop_shielding: Toggles a bubble shield on the NPC (like assassin droids have)
    • workshop_set_scale <amount>: Sets the NPC's scale.
  • Added new cvar: g_noAutoFollow. When this is 1, friendly NPCs don't follow you.
  • Added new functionality to "npc spawn" command. You can do "npc spawn random" to spawn random NPCs. For instance, "npc spawn random rodian weequay trandoshan gran" picks a random npc, either rodian, weequay, trandoshan or gran. This is good for populating a city quickly and easily with a variety of townsfolk.
Daedra, Stoiss and dg1995 like this
Posted

 

I've made an update with some extra features. See the link in the OP for the download. Currently awaiting JKHub approval still.

Updates in this new version:

  • Added new commands:
    • workshop_toggle_follow: With the selected NPC, toggles following on it. Meaning if you are targeting a friendly NPC, it will switch between them following you or not.
    • workshop_kill: Kills the selected NPC.
    • workshop_list_anims: Lists all of the animations in the game (warning, console spam)
    • workshop_set_health <amount>: Sets the health of the NPC.
    • workshop_set_armor <amount>: Sets the shield of the NPC.
    • workshop_set_gravity <amount>: Sets the gravity of the NPC (note, default is 800)
    • workshop_set_anim <animation>: Sets the animation that the NPC is using.
    • workshop_control: Take total control of the NPC. Better than Mind Trick Level 4 as it works on all NPCs, has infinite duration, and jump doesn't exit.
    • workshop_end_control: Stop controlling the NPC.
    • workshop_freeze: Freezes the NPC in place.
    • workshop_undying: Toggle undying mode on the NPC
    • workshop_shielding: Toggles a bubble shield on the NPC (like assassin droids have)
    • workshop_set_scale <amount>: Sets the NPC's scale.
  • Added new cvar: g_noAutoFollow. When this is 1, friendly NPCs don't follow you.
  • Added new functionality to "npc spawn" command. You can do "npc spawn random" to spawn random NPCs. For instance, "npc spawn random rodian weequay trandoshan gran" picks a random npc, either rodian, weequay, trandoshan or gran. This is good for populating a city quickly and easily with a variety of townsfolk.

 

So essentially, with this, I can make a friendly sparring scene between two friendly NPCs like the one in Yavin_Temple in Jedi Outcast, correct?

Posted

So essentially, with this, I can make a friendly sparring scene between two friendly NPCs like the one in Yavin_Temple in Jedi Outcast, correct?

Sort of, yeah. Give two NPCs undying and set them to be enemies and they'll fight for days.

dg1995 and TheWhitePhoenix like this
Posted

 

I've made an update with some extra features. See the link in the OP for the download. Currently awaiting JKHub approval still.

Updates in this new version:

  • Added new commands:
    • workshop_toggle_follow: With the selected NPC, toggles following on it. Meaning if you are targeting a friendly NPC, it will switch between them following you or not.
    • workshop_kill: Kills the selected NPC.
    • workshop_list_anims: Lists all of the animations in the game (warning, console spam)
    • workshop_set_health <amount>: Sets the health of the NPC.
    • workshop_set_armor <amount>: Sets the shield of the NPC.
    • workshop_set_gravity <amount>: Sets the gravity of the NPC (note, default is 800)
    • workshop_set_anim <animation>: Sets the animation that the NPC is using.
    • workshop_control: Take total control of the NPC. Better than Mind Trick Level 4 as it works on all NPCs, has infinite duration, and jump doesn't exit.
    • workshop_end_control: Stop controlling the NPC.
    • workshop_freeze: Freezes the NPC in place.
    • workshop_undying: Toggle undying mode on the NPC
    • workshop_shielding: Toggles a bubble shield on the NPC (like assassin droids have)
    • workshop_set_scale <amount>: Sets the NPC's scale.
  • Added new cvar: g_noAutoFollow. When this is 1, friendly NPCs don't follow you.
  • Added new functionality to "npc spawn" command. You can do "npc spawn random" to spawn random NPCs. For instance, "npc spawn random rodian weequay trandoshan gran" picks a random npc, either rodian, weequay, trandoshan or gran. This is good for populating a city quickly and easily with a variety of townsfolk.

 

 

I was messing around with it all and you know what would be useful? A "workshop_list_weapons" command. It's just nice to get it there and then rather than go through game files. Also a command to set an NPC's saber color/style on the fly would be pretty neat. Would save going into the .npc/.sab file and altering stuff.

Posted

The weapons are pretty easy to remember so I didn't include a command. But it is easy to write one.

 

WP_NONE

WP_BLASTER_PISTOL

WP_BLASTER

WP_DISRUPTOR

WP_BOWCASTER

WP_REPEATER

WP_DEMP2

WP_FLECHETTE

WP_ROCKET_LAUNCHER

WP_THERMAL

WP_TRIP_MINE

WP_DET_PACKS

WP_SABER

WP_MELEE

WP_NOGHRI

WP_TUSKEN_STAFF

WP_TUSKEN_RIFLE

WP_JAWA

WP_TURRET

WP_BOT_LASER

Posted

Can you add an optional "filter token" to your workshop_ist_anims command? That could be used to decrease the console spam.

Posted

The weapons are pretty easy to remember so I didn't include a command. But it is easy to write one.

 

WP_NONE

WP_BLASTER_PISTOL

WP_BLASTER

WP_DISRUPTOR

WP_BOWCASTER

WP_REPEATER

WP_DEMP2

WP_FLECHETTE

WP_ROCKET_LAUNCHER

WP_THERMAL

WP_TRIP_MINE

WP_DET_PACKS

WP_SABER

WP_MELEE

WP_NOGHRI

WP_TUSKEN_STAFF

WP_TUSKEN_RIFLE

WP_JAWA

WP_TURRET

WP_BOT_LASER

Yeah, you could even do it with a config file.

echo WP_NONE
echo WP_BLASTER_PISTOL
echo WP_BLASTER
echo WP_DISRUPTOR
echo WP_BOWCASTER
echo WP_REPEATER
echo WP_DEMP2
echo WP_FLECHETTE
echo WP_ROCKET_LAUNCHER
echo WP_THERMAL
echo WP_TRIP_MINE
echo WP_DET_PACKS
echo WP_SABER
echo WP_MELEE
echo WP_NOGHRI
echo WP_TUSKEN_STAFF
echo WP_TUSKEN_RIFLE
echo WP_JAWA
echo WP_TURRET
echo WP_BOT_LASER  

Save that in notepad as "weaponlist.cfg" without quotes.

Open the console in game and type "exec weaponlist" without quotes, once again.

eezstreet likes this
Posted

@@eezstreet There seems to be a large problem with this. I'll try my best to explain what happened from my point of view.

 

It worked fine when I copied over the modified exe and dll files. It all worked fine up until last night. I had made zero adjustments to my game, and I ran the game through the .bat file. The first thing that happened was that the intro video played audio, but my screen was black. I then skipped the intro by hitting the enter key, and it went to the menu, but my screen was still black (it made all the normal sounds that the menu does). I thought that maybe my computer was going to shit, so I tried out some other games, and they all loaded and worked fine. So it wasn't my computer. Anyway, I checked all the JKA folders for "date modified" and nothing new had been altered. There were also no errors, surprisingly. So I reloaded the game again through the bat file, it was still black. Now this is what I did, even though I couldn't see shit, only hear it. I opened the console, and devmapped a map. It then made all of the loading sounds, and I heard the map music playing, it all loaded fine (audio wise). I then made my character walk around and jump, and used force powers, and all the audio played perfectly, it was all fine as if my screen wasn't black at all. So, I couldn't figure it out at all. There was something wrong that was preventing me from viewing JKA at all. So what I did to fix it, was to put the original files back which the aiworkshop replaced - the exe and dll files. Now I can see everything, no more black screen.

 

I installed it around 4-5 days ago. For me it just went black after 4 or 5 days. I had to uninstall it basically. I think it may be an issue with the exe or dll files. :shrug:

  • 2 weeks later...
Posted

@@eezstreet There seems to be a large problem with this. I'll try my best to explain what happened from my point of view.

 

It worked fine when I copied over the modified exe and dll files. It all worked fine up until last night. I had made zero adjustments to my game, and I ran the game through the .bat file. The first thing that happened was that the intro video played audio, but my screen was black. I then skipped the intro by hitting the enter key, and it went to the menu, but my screen was still black (it made all the normal sounds that the menu does). I thought that maybe my computer was going to shit, so I tried out some other games, and they all loaded and worked fine. So it wasn't my computer. Anyway, I checked all the JKA folders for "date modified" and nothing new had been altered. There were also no errors, surprisingly. So I reloaded the game again through the bat file, it was still black. Now this is what I did, even though I couldn't see shit, only hear it. I opened the console, and devmapped a map. It then made all of the loading sounds, and I heard the map music playing, it all loaded fine (audio wise). I then made my character walk around and jump, and used force powers, and all the audio played perfectly, it was all fine as if my screen wasn't black at all. So, I couldn't figure it out at all. There was something wrong that was preventing me from viewing JKA at all. So what I did to fix it, was to put the original files back which the aiworkshop replaced - the exe and dll files. Now I can see everything, no more black screen.

 

I installed it around 4-5 days ago. For me it just went black after 4 or 5 days. I had to uninstall it basically. I think it may be an issue with the exe or dll files. :shrug:

Or perhaps your graphics card, if you are using integrated graphics.

If you did a recent driver update it might be that. You might have to fiddle with that. The stuff I did was just done on a clean version of OpenJK and didn't modify the graphics any.

Posted

Or perhaps your graphics card, if you are using integrated graphics.

If you did a recent driver update it might be that. You might have to fiddle with that. The stuff I did was just done on a clean version of OpenJK and didn't modify the graphics any.

 

No I haven't made any changes to my drivers for a VERY long time. Plus they are all up-to-date anyway. I don't know the actual reason as to why it happened, though the only thing I did notice is that when I had my task manager open in the processes tab, OpenJK's memory (private network set) was over 3 million. my regular OpenJK only sometimes reaches 1 million max. But that still wouldn't explain why everything still seemed to work just fine but the .exe only showed a pure black screen. (Again, tested multiple different games from .exe format and they all load and work fine, if it was my drivers I am certain I would get issues with those games, or even with normal OpenJK already by now, but I haven't).

Posted

No I haven't made any changes to my drivers for a VERY long time. Plus they are all up-to-date anyway. I don't know the actual reason as to why it happened, though the only thing I did notice is that when I had my task manager open in the processes tab, OpenJK's memory (private network set) was over 3 million. my regular OpenJK only sometimes reaches 1 million max. But that still wouldn't explain why everything still seemed to work just fine but the .exe only showed a pure black screen. (Again, tested multiple different games from .exe format and they all load and work fine, if it was my drivers I am certain I would get issues with those games, or even with normal OpenJK already by now, but I haven't).

That memory change would not explain the graphics. (Upping the NPC/VEH/etc limits are what cause that)

Try changing to windowed mode by adding "+set r_fullscreen 0"

Posted

That memory change would not explain the graphics. (Upping the NPC/VEH/etc limits are what cause that)

Try changing to windowed mode by adding "+set r_fullscreen 0"

 

I'll try that out if the screen goes black again.

  • 3 weeks later...
  • 1 year later...
Posted

A workshop_noclip command for an NPC would also be nice.

 

Do you guys still work on this Workshop? Any chance this command will be added?

  • 9 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...