elementhttp Posted July 24, 2016 Posted July 24, 2016 Hi there I need help in making npcs shoot faster in single player.i moded weapons.dat for WP_BLASTER to shoot faster and it works for main character but for stormtroopers who have e-11 blaster they are shooting one projectile at a time.From experimentations intelligence ,altfire attributes in npc files do not have any effect (is it hard coded somewhere ?). Any thoughts how to solve this problem ?Thanks in advance !
Langerd Posted July 24, 2016 Posted July 24, 2016 Hi there I need help in making npcs shoot faster in single player.i moded weapons.dat for WP_BLASTER to shoot faster and it works for main character but for stormtroopers who have e-11 blaster they are shooting one projectile at a time.From experimentations intelligence ,altfire attributes in npc files do not have any effect (is it hard coded somewhere ?). Any thoughts how to solve this problem ?Thanks in advance ! As far as i know .. There is two ways. Code change or Script. To change all stormtroopers - for example to make STORMTROOPER_CLASS shoot faster You can edit the code to make them use alt fire or something.. I dont know abut coding but i know that You can make script to make them shoot faster. The down side of script is that You will chage their firing speed only when NPC WILl use this script... Making it for all stormtroopers (every that will spawn) is sadly only code way i believe :/ Also Welcome to the Jkhub ! I saw that You are a member for not a long time ^^
Asgarath83 Posted July 24, 2016 Posted July 24, 2016 Hi there I need help in making npcs shoot faster in single player.i moded weapons.dat for WP_BLASTER to shoot faster and it works for main character but for stormtroopers who have e-11 blaster they are shooting one projectile at a time.From experimentations intelligence ,altfire attributes in npc files do not have any effect (is it hard coded somewhere ?). Any thoughts how to solve this problem ?Thanks in advance ! 1: icarus script: SET_SHOOT_SPACING and you set how many millisecond between two shoots.2: coding: npc_stats.cpp there is a shoot burst switch that set how many time pass between two shoots. NumberWan and Langerd like this
elementhttp Posted July 24, 2016 Author Posted July 24, 2016 Ty for the fast response ! Yes i new to JK hub (you can expect some noobish questions , some examples below ) 1) Is there tutorial for icarus scripting and how to apply it in single player ?this is what i found https://github.com/JACoders/OpenJK/wiki/ICARUS-Scripting 2) Coding in c++ is not a problem but how to apply it just on single player ? So far found some sdks for both sp an mp there is jedi academy sdk ( i read its buggy )https://jkhub.org/files/file/1137-jedi-academy-sdk/ and jedi academy fixedhttps://jkhub.org/files/file/1180-jedi-academy-sdk-fixed/ Langerd likes this
eezstreet Posted July 24, 2016 Posted July 24, 2016 You can't use the SDK at all with singleplayer. Use OpenJK instead.My tutorial has everything you need to get started on Windows with it but it might be slightly out of date (Git for example is now required). Langerd and elementhttp like this
Asgarath83 Posted July 24, 2016 Posted July 24, 2016 And on my tutorial about adding new weapons into single player, there is a field that explain how edit Npc_stats.cpp for define the shooting rate of NPC with a weapons. you can use this also as example for change shooting rating of the default weapons, you need just to change into the code some numeric value. Edit. sorry, i have the memory of a red fish >.<you need to edit NPC_combat.cpp, not NPC_stats.cpp case WP_BLASTER_PISTOL: ent->NPC->aiFlags &= ~NPCAI_BURST_WEAPON; if ( ent->weaponModel[1] > 0 ) {//commando ent->NPC->aiFlags |= NPCAI_BURST_WEAPON; ent->NPC->burstMin = 4; ent->NPC->burstMax = 12; if ( g_spskill->integer == 0 ) ent->NPC->burstSpacing = 600;//attack debounce else if ( g_spskill->integer == 1 ) ent->NPC->burstSpacing = 400;//attack debounce else ent->NPC->burstSpacing = 250;//attack debounce } else if ( ent->client->NPC_class == CLASS_SABOTEUR ) { if ( g_spskill->integer == 0 ) ent->NPC->burstSpacing = 900;//attack debounce else if ( g_spskill->integer == 1 ) ent->NPC->burstSpacing = 600;//attack debounce else ent->NPC->burstSpacing = 400;//attack debounce } else { // ent->NPC->burstSpacing = 1000;//attackdebounce if ( g_spskill->integer == 0 ) ent->NPC->burstSpacing = 1000;//attack debounce else if ( g_spskill->integer == 1 ) ent->NPC->burstSpacing = 750;//attack debounce else ent->NPC->burstSpacing = 500;//attack debounce } break; here you can change the shoot spacing time of all weapons on SP client.this is an exaple how i edited that on my code. Langerd likes this
elementhttp Posted November 23, 2019 Author Posted November 23, 2019 ------------------------------ THEORY PART ------------------------------ Every time you or NPC fire a weapon it creates new entity. Due to 32bit engine limitations there can be only X(idk exact number) amount of projectiles on the screen . If there is X+n entities on the screen game will crash ! G_spawn no free entities How to fix this ? One way is to Increase the projectile speed (so entities can be destroyed faster) Reduce the burst size or burst spacing ( keep it less then 9000 ) Reduce weapon range ( if missiles are slow aka matrix mode , ignore this ) Write 64bit engine port Where do i change projectile speed ? Look in file g_weapon.cpp for your weapon projectile velocity Example for BLASTER #define BLASTER_VELOCITY 7000 ------------------------------ PRACTICAL PART ------------------------------ In file NPC_combat.cpp find and edit these lines Example 1. Increasing the number of bolts per burst from 3 to 5 NPC->burstMin = bigger the value , longer the burst case WP_BLASTER: if ( ent->NPC->scriptFlags & SCF_ALT_FIRE ) { ent->NPC->aiFlags |= NPCAI_BURST_WEAPON; ent->NPC->burstMin = 5; ent->NPC->burstMean = 5; ent->NPC->burstMax = 5; if ( g_spskill->integer == 0 ) ent->NPC->burstSpacing = 250;//attack debounce else if ( g_spskill->integer == 1 ) ent->NPC->burstSpacing = 250;//attack debounce else ent->NPC->burstSpacing = 250;//attack debounce } Example 2. And another example is pistol: NPC->burstSpacing = some low value case WP_BLASTER_PISTOL: ent->NPC->aiFlags &= ~NPCAI_BURST_WEAPON; // ent->NPC->burstSpacing = 1000;//attackdebounce if ( g_spskill->integer == 0 ) ent->NPC->burstSpacing = 70;//attack debounce else if ( g_spskill->integer == 1 ) ent->NPC->burstSpacing = 55;//attack debounce else ent->NPC->burstSpacing = 50;//attack debounce break; Asgarath83 likes this
Asgarath83 Posted December 21, 2019 Posted December 21, 2019 On 11/23/2019 at 7:09 PM, elementhttp said: ------------------------------ THEORY PART ------------------------------ Every time you or NPC fire a weapon it creates new entity. Due to 32bit engine limitations there can be only X(idk exact number) amount of projectiles on the screen . If there is X+n entities on the screen game will crash ! G_spawn no free entities How to fix this ? One way is to Increase the projectile speed (so entities can be destroyed faster) Reduce the burst size or burst spacing ( keep it less then 9000 ) Reduce weapon range ( if missiles are slow aka matrix mode , ignore this ) Write 64bit engine port Where do i change projectile speed ? Look in file g_weapon.cpp for your weapon projectile velocity Example for BLASTER #define BLASTER_VELOCITY 7000 ------------------------------ PRACTICAL PART ------------------------------ In file NPC_combat.cpp find and edit these lines Example 1. Increasing the number of bolts per burst from 3 to 5 NPC->burstMin = bigger the value , longer the burst case WP_BLASTER: if ( ent->NPC->scriptFlags & SCF_ALT_FIRE ) { ent->NPC->aiFlags |= NPCAI_BURST_WEAPON; ent->NPC->burstMin = 5; ent->NPC->burstMean = 5; ent->NPC->burstMax = 5; if ( g_spskill->integer == 0 ) ent->NPC->burstSpacing = 250;//attack debounce else if ( g_spskill->integer == 1 ) ent->NPC->burstSpacing = 250;//attack debounce else ent->NPC->burstSpacing = 250;//attack debounce } Example 2. And another example is pistol: NPC->burstSpacing = some low value case WP_BLASTER_PISTOL: ent->NPC->aiFlags &= ~NPCAI_BURST_WEAPON; // ent->NPC->burstSpacing = 1000;//attackdebounce if ( g_spskill->integer == 0 ) ent->NPC->burstSpacing = 70;//attack debounce else if ( g_spskill->integer == 1 ) ent->NPC->burstSpacing = 55;//attack debounce else ent->NPC->burstSpacing = 50;//attack debounce break; On 11/23/2019 at 7:09 PM, elementhttp said: I Didnt knew about this limit and that workarounds! thanks for sharing the advide, bro! :D
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now