Jump to content

Asgarath83

Members
  • Posts

    2,023
  • Joined

  • Last visited

Everything posted by Asgarath83

  1. not rush not rush. take it easy! thanks : 3
  2. mmm well, ... wow a massive import script should be pretty useful. for me is sufficient a script that import all wavefront OBJ format and all 3DS format of autodesk inside a folder to a scene. for avoid to become crazy after to separate the meshes should be best also if the script rename the object mesh with some kind of progression (like example object1_1, object1_2, object1_3) this is for OBJECT name. you know on blender there are the object properties panel (when you add md3shader as customproperties on a mesh if you to assign texture for export a MD3) , the edit panel for edit geometry of object add modifier, decimate etc. the material panel with material names and material properties. and the textures panels where there are stored info about the textures assigned to the model. my problem is that the object in questions, on 3DS, or OBJ format too, have material slots name names ... well. mesh1: material: material_1 texture: abd.dds in that way, radiant and JKA cannot read a texture because the texture name , when JKA engine and radiant read a 3DS misc_model, is read by material field. what i need, after i imported on a scene an object with fine textured, is some that autobatch rename and change with one click the material name of every object inside the scene, with his texture name. for example this: mesh1: material name: material_1 texture: abd.dds mesh2: material_name material_2 texture abc.dds mesh3: material_name material_3 texture abf.dds etc need after i run script \ plug in, to become this: mesh1: material name: abd.dds texture: abd.dds mesh2: material name: abc.dds texture abc.dds mesh3: material name abf.dds texture abf.dds and so away... so i need simply a script addon for blender 2.68 that rename material tab of all object mesh inside the scenes with their textures tables name. so a script for change all material name of object inside a scene (into material tab, i signed on red with an X what is wrong) with the name of texture of texture tab (i signed with "ok" the name renamed on material tab with same name of texture tab )
  3. Well at the end i make catalogue of all 87k models. they are not really 87k. this crazy assets place models not for tipology but for territories. every folder is a territory and contain all models calls in territory as static mesh. what a silly waste of hard disk space -.- otherwise i watched all folders with 3d object converter preview and inside folder itself of original game i found minimaps of dungeons and info related to world map locations. so at the end i figured how to make a catalogue. otherwise, without a blender plug in for assign texture name to material name, this works is unuseful. too many stuff to convert into MD3. is better if i'll rip alls so i can have textures already fine assigned on max. thanks however for reading. @@SomaZ and @@Noodle :3
  4. thanks however dear, no problem ^^ have luck with real life! ciao!
  5. mmm, rocket think is a good idea. yes, pasting the function itself not works, i tryed on past and game crash on fighter spawn. better call it on the correct place and trasnform fighters into an homing missile... but without impact with victim LOL, eh this is another quest. i can tell to fighters of avoid enemy or ground before hit brushes or theirn bounding box? i need to fix also that. >.< thanks however! :3
  6. mmm just a little question, how can i create a pitch up and down \ loop movement using fabs or vectors when they chase their opponents? i tryed without fabs and they hunts theirselves forward and backward, they go ahead and behind, forward and back, forward and back, here and there lol. running very fast, this is fun for some minutes but after a lot become silly. there is some way i can get more "vivacity" to the flight of fighters? or some code block or part of JKA that can give me an help on that?
  7. yeah a auto levelling code to match height of enemy was useful for some kind of aircraft with static flight like assault chopters i guess, but is is not the case. So they need just to chase each others with free pitch fly along the forward vector axis... mmm i think also NPC_faceenemy qtrue is unuseful in this function. i can set NPC_faceenemy of the Hunt function, so if They chasing a foe, they face him (and this have sense) but on maintain height \ flight function so is not necessary or use fabs for movement. on the remote movement it give a lot of better estethical flight manouvre, but also create a redundance loop that force enemy to go up and up. now i understand. mmm dif a parameter related to the "height" of the enemy NPC... interessing too. i see that in a part of code dif is multiplied for ten dif*=10 in this case NPC should fly at maximum height of ten times the height of opponent i guess... so for maintain height i deactivate just and i take only setting for a costant fly movement. the faceenemy line i cut inside the fighter_hunt code. well at this point... mmmm if i get hunt + autoforward propulsion and deactivate the fabs stuff, fighters tecnically SHOULD chase each other. when they reach enemy the autoforward movement force him to go over enemy, but their are also chasing the enemy and tracking and so... okay this should create a behavour like homing missile... it's a reasonable behavour for starfighters. i wanna to try this and see what happened as result. i these days i am improving the flight and dogfight manouvre. is the hardest part. thanks again for explanation! :3
  8. @@MGummelt hello there. sorry if i stress again. i have some little bug again to fix on my fighters. not much deals. i was wondering if you can give me some suggest related to this. the first problem reguard that: dogfight against fighters TEAM_PLAYER agains TEAM_ENEMY npcs. this problem occurs also if you try to create a friendly rockettrooper NPC and fight NPC rockettrooper. basiclaly, they shoot theirself on the air and their fight with repeater. during fight they have the little problem they do fly manouvre that ... in the course of some minutes, they fly ever up, up, up and more up, until they reach the skybox or the "roof" of the level map. this is not much good to see for a starfightning because in a battle NPC will lost on the Sky. i found the incriminated functions coming by AI_SENTRY and AI_REMOTE .CPP is the maintainheight function. This: void Olon_MaintainHeight( void ) { float dif; // Update our angles regardless //////////////////////////////////////// NPC_FaceEnemy( qtrue ); NPC_UpdateAngles( qtrue, qtrue ); if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= OLON_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 1 ) { NPC->client->ps.velocity[2] = 0; } } // If we have an enemy, we should try to hover at or a little below enemy eye level if ( NPC->enemy ) { // FIXA QUESTA FUNZIONE E' QUA CHE SI SCAZZANO I CACCIA E IL COMBAT TENTE A MUOVERSI VEROS L'ALTO. //SENTRY // Find the height difference dif = (NPC->enemy->currentOrigin[2]+NPC->enemy->maxs[2]) - NPC->currentOrigin[2]; // cap to prevent dramatic height shifts if ( fabs( dif ) > 8 ) { if ( fabs( dif ) > OLON_HOVER_HEIGHT ) { dif = ( dif < 0 ? -24 : 24 ); } NPC->client->ps.velocity[2] = (NPC->client->ps.velocity[2]+dif)/2; } //REMOTE if (TIMER_Done( NPC, "OlonheightChange")) { TIMER_Set( NPC,"OlonheightChange",Q_irand( 1000, 3000 )); // Find the height difference dif = (NPC->enemy->currentOrigin[2] + Q_irand( 0, NPC->enemy->maxs[2]+8 )) - NPC->currentOrigin[2]; // cap to prevent dramatic height shifts if ( fabs( dif ) > 2 ) { if ( fabs( dif ) > 24 ) { dif = ( dif < 0 ? -24 : 24 ); } dif *= 10; NPC->client->ps.velocity[2] = (NPC->client->ps.velocity[2]+dif)/2; NPC->fx_time = level.time; //G_Sound( NPC, G_SoundIndex("sound/chars/Olon/misc/hiss.wav")); } } } else { //REMOTE gentity_t *goal = NULL; if ( NPCInfo->goalEntity ) // Is there a goal? { goal = NPCInfo->goalEntity; } else { goal = NPCInfo->lastGoalEntity; } if (goal) { dif = goal->currentOrigin[2] - NPC->currentOrigin[2]; //REMOTE if ( fabs( dif ) > 24 ) { dif = ( dif < 0 ? -24 : 24 ); NPC->client->ps.velocity[2] = (NPC->client->ps.velocity[2]+dif)/2; } //SENTRY if ( fabs( dif ) > OLON_HOVER_HEIGHT ) { ucmd.upmove = ( ucmd.upmove < 0 ? -4 : 4 ); } else { if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= OLON_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 2 ) { NPC->client->ps.velocity[2] = 0; } } } } // Apply friction to Z else if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= OLON_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 1 ) { NPC->client->ps.velocity[2] = 0; } } // Apply friction else if ( NPC->client->ps.velocity[0] ) { NPC->client->ps.velocity[0] *= OLON_DECAY; if ( fabs( NPC->client->ps.velocity[0] ) < 1 ) { NPC->client->ps.velocity[0] = 0; } } else if ( NPC->client->ps.velocity[1] ) { NPC->client->ps.velocity[1] *= OLON_DECAY; if ( fabs( NPC->client->ps.velocity[1] ) < 1 ) { NPC->client->ps.velocity[1] = 0; } } } } but if i disabled this line the fighters lost also their flight manouvre of dogfight and they fight simply silly fly 'round enemy target, like a seeker droid. the problem is caused by chunks of code that force the enemy fight to try ever to be "at the same height of eyes height of enemy models. " i merged up remoter and sentry question for doing this code. the problem is HERE: // If we have an enemy, we should try to hover at or a little below enemy eye level if ( NPC->enemy ) blablabla and is caused by the fab functions.if disable the sentry code field i get by the sentry the problem is strongly reduced with remote parameters of fabs flight by is still again present, i not understand much this kind of expression: dif = (NPC->enemy->currentOrigin[2]+NPC->enemy->maxs[2]) - NPC->currentOrigin[2]; // cap to prevent dramatic height shifts if ( fabs( dif ) > 8 ) { if ( fabs( dif ) > OLON_HOVER_HEIGHT ) { dif = ( dif < 0 ? -24 : 24 ); } NPC->client->ps.velocity[2] = (NPC->client->ps.velocity[2]+dif)/2; can you explain a lot how works exaclty fabs and difs here? there is some way to fix this for preserve this kind of movement removing this problem of the fighter NPC shifting to Up during a dogfight? and there is also some better code that i can use for fighter movement during a dogfights? here is defined all my npc fighters flight movements when they have a goal or a enemy. is nice to see on a combat into a map but is again alot far for a true dogfights of games like Xwing alliance or rogue squadron3d , there is any way to improve that for create a nice battle against NPCs? this is the last tecnical problem of my AI. @@Archangel35757 can you give me an hand too to manage this? should be great a better dogfight code of that. :3
  9. Strange. with SABER_DEFENSE 3 you should be able to reflect shoots against enemy turret. you can do that on t3_byss level. mmm wait. you are talking about a Sentry droid??? O.o
  10. @@Noodle the roof of hylden city is little inclinated because i have not fix model rotation (and fov on scene imported on 3d max lol the unique trouble of 3dripper is the fov issue, big map can have inclination deformation problems if camera is not perpendicular to level plane or if import option are not setted fine. i fixed later. about light. well, i created a tested skybox without any sky shader, just for contain the scene of hylden docks and prevent issues of map leaked. water of the ocean was remove by level before exporting, can be easily recreate with a brush and a water shader, much better of original bo2 game. lighting enviroment is missing because i did this test on 3DS misc_model format some months ago and i was focused to fix the problem of how to match textures because the method for apply texture of 3DS imported misc_model is very different related to MD3 tecnicque of apply textures. so the map was just on -META build, NO Vis, Not lighting. i use the simple META build for 99% of my map works and test, i use the light building only for final release and for ... well, for make the map lighting and shadowcasting, obvious. so this explain because there are not lighting and shadows for complete the level is sufficient to clean up scene by NPC stuffs of original game, separate the interactive object movable into other model respect to the scene .3DS (in this case, the interactive part of the map is the coffinslab door and the lift at the end of map (i not screenshoted him) and put light . i thing a spectral blue-green enviroment ambience light with sunset evening and some green flames torch spotted in some places are sufficient for create a deep glooming and scary level ambientation. :3 @@SomaZ. ew, i already tried with Noesis as first thing and it not process .MOX or BMD. i admit that target files was by the mmorpg of perfect world international. with a MD3 \ 3DS full compatibility they should be really a deep total assets resources. this old mmorpg have nice graphic, wonderful texture quality and also low poly models. the unique trouble is the difficult to manage the format of mmorpg static meshes. not much user friendly. (obvius, game is chinese) .-. about hylden city instead, it was for my Legacy of Kain MOD. this is related to my old topic when i asked about how to recreate game locations like hylden city or eternal prisons. i have not the heal or time for recreate a map for scratch, so ripping scene on 3DS and rebuild location with modular puzzles for me is the faster way. almost for games like defiance, blood omen 2 and soul reaver 2 this works like a charm. about pw... well, i really prefear to avoid to rip stuff of building and cities by game directly. i not found exactly legal or legittim. accounts that do that can be banned by servers. but also apply texture manually to 87 thousand of models... well... ARGH! @.@ the best way i guess should a scripts \ addons for 3d max for automatically assign a texture name to his related material name of a scene and export to 3DS OOORR... the same thing but that assign texture name automatically on blender customproperties, for MD3 exporting. 3d max method for export MD3 is too much complicated for manage thousand of static meshes. :\ . .
  11. I want also get a little proof of what i tell becuase i can understand if the idea of use 3DS instead of the historical MD3 format or ASE for static mesh can get some skeptical reaction. To show a little image gallery of a test i did with another part: the docks of Hylden City by games bo2. this is NOT a MD3, this is 3DS scene. and as you can see it works nicely on JKA.
  12. i can also guarantee that 3DS format works wonderful with JKA and radiant 1.5.0, if is solved the problem of texture assignament. i tested with a scene of a inside of a great cathedral stronghold ripped with 3d ripper and exported to 3DS format and load on JKA with the textures assigned with the tecnique i told and it support a scene with more of 32 part for mesh. there is a mesh of the 3ds file that have 19k of vertexes!!! and on 3DS format not crash on JKA and also on radiant too. there is only the problem of textures assignment.
  13. Recently i got a large assets of 87k models. they are on bmd format but i found a tool that can convert to 3ds and obj, so they can be port on blender 2.68 or 3d studio max. or directly on gtk radiant. (but this is tricky). i would directly use on JKA if there is not a stupid problem: personally i see after a lot of try that 3ds format is really more better and much workable of MD3 for two reason: i tested with success usijng a .3ds mesh on radiant, and also on JKA too with success, not crash map no problem on building maps etc. the test stuff was an entire scene, a level part, i ripped from a low poly game months ago with 3d ripper dx. . with 3DS i not get any trouble regards the two big limitation of MD3:; no more of 1k of vertexes on a mesh and no more of 32 mesh for a model. but they have a problem: they read the texture by base folder by default or by the mod base folder. a texture also cannot have a name more long of 12 characters. the problem of 3ds is that: MD3 read the textures by MD3shader relative path fields on Custom properties of model, when you put on blender when you create a MD3 using MD3 export of mrwonko. no prolbem of path of long name texture, is highly customizable. also with 3d max MD3 export of ashuradx is pretty nice, but a little more hard to use, because you need to apply photometric texture to model before export, and also, to rename material of model with texture relative path and also, to have on the folder export the texture of model. Because i not human possible to manually convert one for one on Blender or 3D max 87 K of models without take an entire lifetime into MD3 format with the custom properties and material assign methods of 3d max or blender i wanna try if there is some way for create working 3DS by blender. BUT... there is a trouble basically... ON 3DS FORMAT, gtk radiant and JKA read the textures and materials name by Material slots. so, also if on blender i see the model with the correct texture assignment, display and uvmapping, if i port as misc_model on radiant the same model i get the error Texture load failed: "Material_1" Texture load failed: "Material_2" Texture load failed: "Material_3" Radiant search the material name of 3DS! not the textures name!!! so the unique way for force radiant and JKA to read the 3ds texture is to manually set the name on blender and re-export the 3ds. (without put a name more long of 12 character, folder \path included) i see i have no problem to read on Gtk radiant and Jedi Academy a 3ds exported by 3d max of a scene ripped by 3d reaper, because into the exporting the material name match with texture name, so radiant and JKA can read without trouble. (and i have also a batch rename tools on blender for add a prefix to materials name on blender. for example if texures are 398eeef44.dds and 343eeb239.dds, i can use this tool for rename as Sr/398eeef44 and sr/343eeb239. this allow also to have a custom folder where slap the texture instead of get spare on all Base folder of JKA or the mod folder (is sufficient to put the converted Dds inside a pk3 into a subfolder with desired name for resolve any problem about eventually texture overwrite name or have hundreds of textures scattered on base folder of mod or radiant base path, this should be really annoying). otherwise, i have serious trouble with 3ds created by 3d object converter. because material not match with texutre name but are "material1, material2, material 3... i have two folders of object that i can use. the firsr folder contain just 150 files... i can do the sacrifice to manually convert on MD3 with blender 2.68 because i have a plug in that copy custom properties on all object on the scene. but about the other folder with 87 K files !! oh damn... they are low poly and very nice textured models but how damn i can get on JKA without become crazy? :\ So my question regard this huge amount of staff: there is any plug , addons or script for blender 268, that can assign for every object and every material the same name of his texture??? this can make this job a little less crazy? More better: there is any program that can batch convert *.BMD format of 3d models into 3DS compatible with radiant or JKA , also with an autorenaming of materials of models for match the name of textures assigned? example: if there is material_1 with texture 3d6.dds material_1 must be renamed too 3d6.dds or 3d6. thanks for any answer.
  14. Okay, this is the deal. i know how works with MD3 for create misc_model and misc_model_static. But i discover also that radiant and JKA can manage too 3DS and OBJ format. expecially 3ds. and this without Any-Editing-Of-Models inside blender or 3d studio max. if the material name of a 3ds file is the same name of the texture file, radiant, and JKA too, can read the texture without problem. and also, 3ds works on game also better of MD3 for what i see, because they have not limitation as 1000 vertexes errors. i ported into game really GIANT scene with thousands of vertex without problems with this tecnique. and just into one 3ds misc_model. how do that. i discovered that with some stuff ripped with 3d ripper Basically... - i converted dds textures ripped into jpg textures. - i placed into a 2 pk3 folder the jpg textures - need two pk3. a pk3 with textures renamed with .dds as sufix in that case, because radiant reed the textures images for be displayed into the editor. but game read shaders, not textures, so sufix name is not necessary. the pk3 files with *.dds texture rename can be placed into the base source folder of GTK radiant. the pk3 files with textures without renaming, can be placed into the mod folder on gamedata. is possible also, using blender, with a rename object addon, to change material and textures name (on the case of ripped stuff by 3d ripper, the name are matching), adding a prefix. i see that engine of JKA and radiant not read a texture name if name is more long of 12 character. with if you add a little prefix like 01/ to all texture and material name with the addon of blender 2.68, you can place without any problem textures also into a subfolder of a pk3 (just for avoid to overwrite other textures or other problems like that). to this point, all is perfect. and so, what is wrong? Well, i have found a large asset of some thousand of model. they are low poly, very miscellaneus and with nice textures, but they are into MOX and BMD format. i found a program that convert MOX and BMD into 3ds (3d object converter) but there is a little problem: the converted files have as material name "material_1 , material_2, material_3, material_4. if i open the original file on his folder, with his textures into the same folder, i can easily convert into 3ds. after that, the obtained 3ds have not any problem of textures loading on blender. (and on 3d object converter there is also a batch convert function on 3dobjectconverter for convert with a one click hundreds of models ) i have already tryed on radiant and JKA these and they 3ds working on engine without trobles-. so, what is the problem? the problem is: material mismatch with textures name. so for example: i have an object called table with 4 textures: table_1, table_2, table_3, table_4. i had a 3ds that has material name have "material_1, material_2, material_3, material_4. Ond Blender material slot, they are in that way, and also on radiant 3ds texture are readed with material name, not with textures name. normally i not ask a so annoying question but manually re-assign textures for 80K of models is really a madness. @-@ so... i ask that mainly to blender user. There is any possibility, any workaround to have some script or addons for blender 2.68 that can rename each material with his texture name? (but also in that way is crazy... but i not think someone know if there is some way to force 3dobjectconverter to convert the 3ds with materials named like textures. OR if there is another program that can convert MOX and BMD 3d file formats. The alternative should rips stuff i want by game (buildings basically), but i not like much to rip with 3dripper if is not extremely necessary. also because the wireframe quality of ripped stuff are really missed up and also meshes can be heavily deformed into the ripping. Thanks for every answer.
  15. Thanks! but without MGummelt suggest i should again on brainstorming mode :3 i suppose i can fix crazy acceleration with if NPC->client->ps.velocity > 1 NPC->client->ps.velocity = 1 after VectorMA. this should avoid to overflow the default speed value. iif not, i can also try the ps.velocity < 1 ps.velocity = 0 by fighter_hunt or the decay multiplier with 0.(number.)f for a gradual decelerating. Instead about the client i thinks is sufficient: - NPC and client starfighters scaled to 50 as modelsca on NPC files. that fix the camera problem with the "giant" tiefighter model vehicle. moving the Playable fighter: well, i not know if is possible to use "playermodel sentry" or "playermodel remote" for see if player can move these droids class. if is possible should not be problem to allow my fighter class to be moved also by player (and adding forceforward command by icarus script at start of level player too can have the autoforward propulsion as rogue squadron 3d) if instead droids are statics with players u.cmd (now i not remember, i need to test the default sentry and remote_sp NPC for see if player can move.) i can just set the player fighter fly like a rockettrooper fly (with some little edit on yawangle of flystart) and changing jetpack sound on the fighter engine sound loop and should be okay.) After that, all it need is to customize UI (like atst HUD) for the fighter class and the works is done and i will share the code.) Thanks again MGummelt, really
  16. @@MGummelt it works!!! after two years of headaches! thanks ! thanks 1 thousand time!!! i need just to put on the equation some decay value like the "apply friction" and the decay int of Sentry Ai because you're right! VectorMa create a logaritmic acceleration... but is also necessary for make all workings. so they need really a brake inside the code because i spawned fifty fighters with consolles and they go forward, boost up, accelerate in so crazy way that also if they seek me as enemy they fly for all map and skybox like crazy comets and explodes by impact damage with skybox to a mad speed! ROTFL!!! it's funny to see but it works! now i need just to debug, finding the just values for making a decent flight i am sure at the end i'll do that. and after that i can think to the player client fighter code and user UI HUD. Because NPC is almost done. thanks again!!
  17. Thanks friend, i testing now. well, as i told, my fighter is not a vehicle... the AI is building with a workaroung about AI_SENTRY (for flying) and AI_Bobafett (for combat and switch weapons) but all i obtains was some funny fighter droids NPC that fly and shoot like tornado assault chopter. (but they are not vehicles. they are characters, like jedi, lijke sith, like reborns, foir engines they are NPCs. they only appear as fighter because they have the tie fighter model that i have rigged with humanoid skeleton, only to pelvis bone (so i obtained a rigid body starfighter NPC) and i also added in front of tiefighter cannon the l_hand and r_hand tag, i also removed for fighter class the spawning of shooting weapons glm models (so fighter not have silly a blaster or a repeater or a rocket launcher attacked to his cannon) i added also death efx explosion with corpse removal and customized FX of all shooting weapons for starfighter class. At moment, for avoid to make mistakes or some big error on AI without remember how things works before and how repairs (i have backuped copy of my edited AI_sentry.cpp file) i have setted all the fighter parameter to another class so i am using this class for making all test and debugging for avoid of ruin fighter class with my noob c++ skills. the test class is called CLASS_OLON i changed also the functions name for avoid redundance or conflict with fighters ruins. in this AI, i tryed something of difference: instead of Sentry droid fly behavour i tryed the AI_REMOTE.cpp. and yesterday i discover that flight is not setted by Fighter_hunt \ Olon_hunt functions as i wrong thinked... the Hunt function control the chasing of the enemy. the Flight of NPC, instead if setted by Fighter_MaintainHeight \ Olon_MantainHeight of my test code. and here, on the olon workinprogress testing AI, i merged the remote and sentry maintain height functions. the result for combat and dogfight is... Spectacular! with some little adjustament (i added faceenemy, because Remote AI have not and i disable remote spin of model) i obtain an NPC fighers that chase enemy and move like a remote instead of a sentry, but also strafing like a sentry... oh well, a good starfighter battle! this is my work in progress edit: /* ------------------------- Olon_MaintainHeight ------------------------- */ void Olon_MaintainHeight( void ) { float dif; // Update our angles regardless //////////////////////////////////////// NPC_FaceEnemy( qtrue ); NPC_UpdateAngles( qtrue, qtrue ); // Cambia il vettore 2 con l'1. if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= OLON_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 1 ) { NPC->client->ps.velocity[2] = 0; } } // If we have an enemy, we should try to hover at or a little below enemy eye level if ( NPC->enemy ) { //SENTRY // Find the height difference dif = (NPC->enemy->currentOrigin[2]+NPC->enemy->maxs[2]) - NPC->currentOrigin[2]; // cap to prevent dramatic height shifts if ( fabs( dif ) > 8 ) { if ( fabs( dif ) > OLON_HOVER_HEIGHT ) { dif = ( dif < 0 ? -24 : 24 ); } NPC->client->ps.velocity[2] = (NPC->client->ps.velocity[2]+dif)/2; } //REMOTE if (TIMER_Done( NPC, "OlonheightChange")) { TIMER_Set( NPC,"OlonheightChange",Q_irand( 1000, 3000 )); // Find the height difference dif = (NPC->enemy->currentOrigin[2] + Q_irand( 0, NPC->enemy->maxs[2]+8 )) - NPC->currentOrigin[2]; // cap to prevent dramatic height shifts if ( fabs( dif ) > 2 ) { if ( fabs( dif ) > 24 ) { dif = ( dif < 0 ? -24 : 24 ); } dif *= 10; NPC->client->ps.velocity[2] = (NPC->client->ps.velocity[2]+dif)/2; NPC->fx_time = level.time; //G_Sound( NPC, G_SoundIndex("sound/chars/Olon/misc/hiss.wav")); } } } else { //REMOTE gentity_t *goal = NULL; if ( NPCInfo->goalEntity ) // Is there a goal? { goal = NPCInfo->goalEntity; } else { goal = NPCInfo->lastGoalEntity; } if (goal) { dif = goal->currentOrigin[2] - NPC->currentOrigin[2]; //REMOTE if ( fabs( dif ) > 24 ) { dif = ( dif < 0 ? -24 : 24 ); NPC->client->ps.velocity[2] = (NPC->client->ps.velocity[2]+dif)/2; } //SENTRY if ( fabs( dif ) > OLON_HOVER_HEIGHT ) { ucmd.upmove = ( ucmd.upmove < 0 ? -4 : 4 ); } else { if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= OLON_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 2 ) { NPC->client->ps.velocity[2] = 0; } } } } // Apply friction to Z else if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= OLON_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 1 ) { NPC->client->ps.velocity[2] = 0; } } // Apply friction else if ( NPC->client->ps.velocity[0] ) { NPC->client->ps.velocity[0] *= OLON_DECAY; if ( fabs( NPC->client->ps.velocity[0] ) < 1 ) { NPC->client->ps.velocity[0] = 0; } } else if ( NPC->client->ps.velocity[1] ) { NPC->client->ps.velocity[1] *= OLON_DECAY; if ( fabs( NPC->client->ps.velocity[1] ) < 1 ) { NPC->client->ps.velocity[1] = 0; } } } } /* ------------------------- Olon_Strafe ------------------------- */ void Olon_Strafe( void ) { int dir; vec3_t end, right; trace_t tr; AngleVectors( NPC->client->renderInfo.eyeAngles, NULL, right, NULL ); // Pick a random strafe direction, then check to see if doing a strafe would be // reasonable valid dir = ( rand() & 1 ) ? -1 : 1; VectorMA( NPC->currentOrigin, OLON_STRAFE_DIS * dir, right, end ); gi.trace( &tr, NPC->currentOrigin, NULL, NULL, end, NPC->s.number, MASK_SOLID, (EG2_Collision)0, 0 ); // Close enough if ( tr.fraction > 0.9f ) { VectorMA( NPC->client->ps.velocity, OLON_STRAFE_VEL * dir, right, NPC->client->ps.velocity ); G_Sound( NPC, G_SoundIndex("sound/chars/remote/misc/hiss.wav")); // Every time strafing, Add also a slight forward push. // so you will go after your enemy and you can attack from back! NPC->client->ps.velocity[1] += OLON_FORWARD_PUSH; // Set the strafe start time so we can do a controlled roll NPC->fx_time = level.time; NPCInfo->standTime = level.time + 3000 + random() * 500; } } /* ------------------------- Olon_Hunt ------------------------- */ void Olon_Hunt( qboolean olonvisible, qboolean olonadvance, qboolean olonretreat ) { float olondistance, olonspeed; vec3_t forward; //If we're not supposed to stand still, pursue the player if ( NPCInfo->standTime < level.time ) { // Only strafe when we can see the player if ( olonvisible ) { Olon_Strafe(); return; } } //If we don't want to advance, stop here if ( olonadvance == qfalse && olonvisible == qtrue ) return; //Only try and navigate if the player is visible if ( olonvisible == qfalse ) { // Move towards our goal NPCInfo->goalEntity = NPC->enemy; NPCInfo->goalRadius = 12; NPC_MoveToGoal(qtrue); return; } else { VectorSubtract( NPC->enemy->currentOrigin, NPC->currentOrigin, forward ); olondistance = VectorNormalize( forward ); } olonspeed = OLON_FORWARD_BASE_SPEED + OLON_FORWARD_MULTIPLIER * g_spskill->integer; if ( olonretreat == qtrue ) { olonspeed *= -1; } VectorMA( NPC->client->ps.velocity, olonspeed, forward, NPC->client->ps.velocity ); NPC_FaceEnemy( qtrue ); } /* ------------------------- Olon_Ranged ------------------------- */ void Olon_Ranged( qboolean olonvisible, qboolean olonadvance, qboolean olonretreat ) { if ( TIMER_Done( NPC, "attackDelay" ) ) // Attack? { TIMER_Set( NPC, "attackDelay", Q_irand( 500, 3000 ) ); Olon_Fire(); } if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) { Olon_Hunt( olonvisible, olonadvance, olonretreat ); } } #define MIN_OLON_RANGE 8192 #define MIN_OLON_RANGE_SQR ( MIN_OLON_RANGE * MIN_OLON_RANGE ) #define MIN_OLON_DISTANCE 1024 #define MIN_OLON_SQR ( MIN_OLON_DISTANCE * MIN_OLON_DISTANCE ) /* ------------------------- Olon_Attack ------------------------- */ void Olon_Attack( void ) { //QQQ DISABLED FOR AVOID SILLY SPINNING MOVEMENT /*if ( TIMER_Done(NPC,"spin") ) { TIMER_Set( NPC, "spin", Q_irand( 250, 1500 ) ); NPCInfo->desiredYaw += Q_irand( -200, 200 ); }*/ // Always keep a good height off the ground Olon_MaintainHeight(); // If we don't have an enemy, just idle if ( NPC_CheckEnemyExt() == qfalse ) { Olon_Idle(); return; } // Rate our distance to the target, and our visibilty float olondistance = (int) DistanceHorizontalSquared( NPC->currentOrigin, NPC->enemy->currentOrigin ); // distance_e distRate = ( distance > MIN_MELEE_RANGE_SQR ) ? DIST_LONG : DIST_MELEE; qboolean olonvisible = NPC_ClearLOS( NPC->enemy ); float olonidealDist = MIN_OLON_SQR+(MIN_OLON_SQR*Q_flrand( 0, 1 )); qboolean olonadvance = (qboolean)(olondistance > olonidealDist*1.25); qboolean olonretreat = (qboolean)(olondistance < olonidealDist*0.75); // If we cannot see our target, move to see it if ( olonvisible == qfalse ) { if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) { Olon_Hunt( olonvisible, olonadvance, olonretreat ); return; } } Olon_Ranged( olonvisible, olonadvance, olonretreat ); } /* ------------------------- Olon automatic flyforwards functions ------------------------- */ void Olon_flyforward1( void ) { float speed; vec3_t forward; //Get your current forward dir AngleVectors( NPC->client->renderInfo.eyeAngles, forward, NULL, NULL ); //or just this - not sure why you're trying to get the NPC's eye angles on a vehicle above? That would be more for a player controlling a vehicle //AngleVectors( self->currentAngles, forward, right, NULL ); ucmd.forwardmove = NPC->client->forced_forwardmove; speed = NPCInfo->stats.walkSpeed; //Set speed to walkspeed or runspeed or whatever you want //speed = FIGHTER_FORWARD_BASE_SPEED + FIGHTER_FORWARD_MULTIPLIER * g_spskill->integer; //set velocity directly - note that this *adds* the new velocity to the old one, meaning it will keep accelerating - only do this if the speed hasn't reached max or you're changing direction VectorMA( NPC->client->ps.velocity, speed, forward, NPC->client->ps.velocity ); //You can just do this, but this will go to the new velocity immediately - you'd have to smooth out acceleration yourself //VectorMultiply( forward, speed, NPC->client->ps.velocity ); NPC->client->ps.pm_time = 500; NPC->client->ps.pm_flags |= PMF_TIME_KNOCKBACK; } /* ------------------------- Olon Idle ------------------------- */ void Olon_Idle( void ) { Olon_flyforward1();//autoforward at walkspeed Olon_MaintainHeight(); NPC_BSIdle(); } /* ------------------------- Olon_Patrol ------------------------- */ void Olon_Patrol( void ) { Olon_MaintainHeight(); //If we have somewhere to go, then do that if (!NPC->enemy) { if ( UpdateGoal() ) { //start loop sound once we move ucmd.buttons |= BUTTON_WALKING; NPC_MoveToGoal( qtrue ); } } NPC_UpdateAngles( qtrue, qtrue ); } /* ------------------------- NPC_BSOlon_Default ------------------------- */ void NPC_BSOlon_Default( void ) { if ( NPC->enemy ) { Olon_Attack(); } else if ( NPCInfo->scriptFlags & SCF_LOOK_FOR_ENEMIES ) { Olon_Patrol(); } else { Olon_Idle(); } } basically: on hunt, i added the face enemy and disabled the spin of remote droid on strafing, i changed the "add a slight upward push" that's because is a fighting between two NPC, one friend and other enemy, every time fighter are strafing they go upward a lot. result: after 10 minutes of battle they are on the top of skybox of the map Lmao. XD obvious, sentry and remote are not thinked for fight each other, i see also rockettroopers have this little problem. so i changed the upward push of ps.velocity on vector 2 (up\down) to vector 1 (forward \ backward) in this way, the push will be forward and not up. i hjave not again tested but if i am correct the result is: every time fighter will strafing, they go a lot forward (i set the value for deal a big push forward) so fighter will go over his enemy and reach his backs and shoot on the back of fighter opponent to the next attack. teorically should works, now i need to test. On olon maintain height i am testing a merged fabs vector functions that merge remote and sentry flying parameter. as i told, i obtained something of pretty interessing: the fighters on a dogfight, fight really as fighters! they also are pretty smart: if i escape, the NPC fighter go over my fighter NPC, and face me and shoot me when is strafing on left \right with a frontal attack (but moving on left) this is nice! is better and more realistic of fighters that fight like F16 airplanes. if i am on behind of a fighter, with this movement it is not so stupid to expose vulnerable parts are boosters and back. it turn for face opponent, (they are starfighter by the rest, so why fight as war airplanes . into the space there are not up\down distinction) so, now in dogfight fighter escape, attack, strafing, fly around the enemy shooting very nicely and facing each others! the only problem is i created a little logarithmic accelerations,... fighters become soon fast... too fast every time they turn and strafe into a new attack. (like speed vehicle but more madness movement!) so fast that at the end they are impossible to targetting and they fly into a spare of time by a corner of map, throw map itself, to other corner! really i will need to apply a STRONG friction on this acceleration. for my luck there is this on the code i am testing. // Apply friction to Z else if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= OLON_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 1 ) { NPC->client->ps.velocity[2] = 0; } } // Apply friction else if ( NPC->client->ps.velocity[0] ) { NPC->client->ps.velocity[0] *= OLON_DECAY; if ( fabs( NPC->client->ps.velocity[0] ) < 1 ) { NPC->client->ps.velocity[0] = 0; } } else if ( NPC->client->ps.velocity[1] ) { NPC->client->ps.velocity[1] *= OLON_DECAY; if ( fabs( NPC->client->ps.velocity[1] ) < 1 ) { NPC->client->ps.velocity[1] = 0; } } so there is also a deceleration movement (but too weak for moment respect to acceleration movement) and so after a lot of time fighters normalize their speed and return to fight as fighters... and not as crazy comets. XD About the autoforceforward. i am trying to do that now: the Olon_idle calls this function float speed; vec3_t forward; //Get your current forward dir AngleVectors( NPC->client->renderInfo.eyeAngles, forward, NULL, NULL ); //or just this - not sure why you're trying to get the NPC's eye angles on a vehicle above? That would be more for a player controlling a vehicle //AngleVectors( self->currentAngles, forward, right, NULL ); ucmd.forwardmove = NPC->client->forced_forwardmove; speed = NPCInfo->stats.walkSpeed; //Set speed to walkspeed or runspeed or whatever you want //speed = FIGHTER_FORWARD_BASE_SPEED + FIGHTER_FORWARD_MULTIPLIER * g_spskill->integer; //set velocity directly - note that this *adds* the new velocity to the old one, meaning it will keep accelerating - only do this if the speed hasn't reached max or you're changing direction VectorMA( NPC->client->ps.velocity, speed, forward, NPC->client->ps.velocity ); //You can just do this, but this will go to the new velocity immediately - you'd have to smooth out acceleration yourself //VectorMultiply( forward, speed, NPC->client->ps.velocity ); NPC->client->ps.pm_time = 500; NPC->client->ps.pm_flags |= PMF_TIME_KNOCKBACK; } i pasted line you suggest me and now i want to test. if works, i will fix next for have obtimal result. (also my crazy dogfight lol) also, i am sorry for my sadly post of the other day. i take a lot of time of figure that NPC move just because AI imitated player movement. i never expected that and this mechanic is very interesting. so, basiclaly, NPCs are like puppet moved by engines. and engine use virtual keyboard and joypand with ucmds for reproducing the player movement...now i understand why forceforward not work until now. >.< now i test my little code. i will let you know the progress. Thanks!
  18. mmm maybe we can help each other. i can give an hand on next future, finished the summer, not too difficult for my mapping skills also if i am not a professional mapper. in change i want only a thing: i am working on AI for making starfighters as NPC not as Vehicle, because NPC can sort many more shoot weapons and also not need pilot and have much manouvrability of starfighter vehicle of JKA engines. also this can open new frontier to SP , my goal is to create a game mode SP for JKA with space battle FPS gamestyle. my AI is okay for shooting, combat and switching weapons but i am a noob with vectors and movement,. i need a Nice programmer that help me to manage fighter fly movement for create a realistic dogfight combat , like old games as rogue squadron 3D and XWingAlliance. if in your team there is something with the require coding skill and spare time fro write movement functions of fighters, i can surely help you in retun with this map. at moment my fighters move like a sentry droids... so they attack like a assault tornado chopter. silly behavour for a starfighter .-. Should be great if they move like a VH_SPEEDER or like a rocket launcher homing missile projectile but vehicle codes and projectile code are not compatible with NPC code. if i remember fine i have SJC t2_rogue source map, textures are fine and also rebuilding. it need just: - NPC placing entity - NPC files and models for civilians - entity for scripting, ref tag scriptrunner etc. - a rewrite of scripts of t2_rogue. so.,.. find me a nice coder for help with my little trouble and i jump istantly on discord for chat with your team about that and t2_rogue remake ... However, we should continue conversation on private message, here we are Off topic.
  19. well, for epic challenge mod IV i write a NPC Ai based on boba fett ai when NPC use sabers if enemy is close and use ranged weapons if enemy is far. but that require coding and also replace default AI with new AI... or create new classes of NPC with this behavour, sorry : \
  20. replace t2_rogue... sigh.. i worked 2 years ago to the coruscant SJC map adapted for single player for replace t2_rogue location. i placed first entities and did waypoint navgrid BUT... my teammates of projects never end the work so the project is stopped for what i know. and all it need is just to place entities, alien folks and NPC civilain and remake the scripts of t2_rogue for match with new map structure and path. for Main Topic however. i love this work o.o nice! i suggest to use for worlds as Corellia, with darkest lighting and texture can be also a Nar Shaddaa map, but i guess Corellia is more indicated.
  21. i Did a lot of progress but again i not have the desired movement. i am working on the fighter_flyforward function but again it not work... or crashes if i enable the fighter_hunt past code about visible and advance. is just a first step. i need to study this for understand exactly what i need to do for boost my fighters. they move fine when they attack,. but when they spawn they are passive. i wanna they move at their walkspeed when they spawn, with forceforwarding, or a vector or any other code possibilities. . i paste here the code, in the case of someone desires to give me a little hint of what is wrong on this fly AI. except fighter_forward function, this is again work in progress. ///////////////////////////////// FLIGHT AI ///////////////////////////////// /* ------------------------- Fighter_Strafe ------------------------- */ void Fighter_Strafe( void ) { int dir; vec3_t end, right; trace_t tr; AngleVectors( NPC->client->renderInfo.eyeAngles, NULL, right, NULL ); // Pick a random strafe direction, then check to see if doing a strafe would be // reasonable valid dir = ( rand() & 1 ) ? -1 : 1; VectorMA( NPC->currentOrigin, FIGHTER_STRAFE_DIS * dir, right, end ); gi.trace( &tr, NPC->currentOrigin, NULL, NULL, end, NPC->s.number, MASK_SOLID, (EG2_Collision)0, 0 ); // Close enough if ( tr.fraction > 0.9f ) { VectorMA( NPC->client->ps.velocity, FIGHTER_STRAFE_VEL * dir, right, NPC->client->ps.velocity ); // Add a slight upward push NPC->client->ps.velocity[1] += FIGHTER_UPWARD_PUSH; //NPC->client->ps.velocity[2] += FIGHTER_UPWARD_PUSH; // Set the strafe start time so we can do a controlled roll NPC->fx_time = level.time; NPCInfo->standTime = level.time + 3000 + random() * 500; } } //extern void rocketThink ( gentity_t *ent ); /* ------------------------- Fighter_Hunt ------------------------- */ void Fighter_Hunt( qboolean visible, qboolean advance ) { float distance, speed; vec3_t forward; //If we're not supposed to stand still, pursue the player if ( NPCInfo->standTime < level.time ) { // Only strafe when we can see the player if ( visible ) { Fighter_Strafe(); return; } } //If we don't want to advance, stop here if ( !advance && visible ) return; //Only try and navigate if the player is visible if ( visible == qfalse ) { // Move towards our goal NPCInfo->goalEntity = NPC->enemy; NPCInfo->goalRadius = 1024; NPC_MoveToGoal(qtrue); return; } else { VectorSubtract( NPC->enemy->currentOrigin, NPC->currentOrigin, forward ); distance = VectorNormalize( forward ); } speed = FIGHTER_FORWARD_BASE_SPEED + FIGHTER_FORWARD_MULTIPLIER * g_spskill->integer; VectorMA( NPC->client->ps.velocity, speed, forward, NPC->client->ps.velocity ); } /* ------------------------- Fighter_RangedAttack ------------------------- */ void Fighter_RangedAttack( qboolean visible, qboolean advance ) { if ( TIMER_Done( NPC, "attackDelay" ) && NPC->attackDebounceTime < level.time && visible ) // Attack? { if ( NPCInfo->burstCount > 6 ) { if ( !NPC->fly_sound_debounce_time ) {//delay closing down to give the player an opening NPC->fly_sound_debounce_time = level.time + Q_irand( 500, 2000 ); } else if ( NPC->fly_sound_debounce_time < level.time ) { NPCInfo->localState = FSTATE_ACTIVE; NPC->fly_sound_debounce_time = NPCInfo->burstCount = 0; TIMER_Set( NPC, "attackDelay", Q_irand( 2000, 3500) ); NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_FLY_SHIELDED, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); G_SoundOnEnt( NPC, CHAN_AUTO, "sound/chars/Fighter/misc/Fighter_shield_close" ); // Fighter high ranked shield itself when chase the player. if ( NPCInfo->rank > RANK_LT_COMM ) { NPC->flags |= FL_SHIELDED; } } } else { Fighter_Fire(); } } if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) { Fighter_Hunt( visible, advance ); } } /* ------------------------- Fighter_MaintainHeight ------------------------- */ void Fighter_MaintainHeight( void ) { float dif; NPC->s.loopSound = G_SoundIndex( "sound/chars/Fighter/misc/Fighter_hover_1_lp" ); // Update our angles regardless NPC_UpdateAngles( qtrue, qtrue ); // If we have an enemy, we should try to hover at about enemy eye level if ( NPC->enemy ) { // Find the height difference dif = (NPC->enemy->currentOrigin[2]+NPC->enemy->maxs[2]) - NPC->currentOrigin[2]; // cap to prevent dramatic height shifts if ( fabs( dif ) > 8 ) { if ( fabs( dif ) > FIGHTER_HOVER_HEIGHT ) { dif = ( dif < 0 ? -24 : 24 ); } NPC->client->ps.velocity[2] = (NPC->client->ps.velocity[2]+dif)/2; } } else { gentity_t *goal = NULL; if ( NPCInfo->goalEntity ) // Is there a goal? { goal = NPCInfo->goalEntity; } else { goal = NPCInfo->lastGoalEntity; } if (goal) { dif = goal->currentOrigin[2] - NPC->currentOrigin[2]; if ( fabs( dif ) > FIGHTER_HOVER_HEIGHT ) { ucmd.upmove = ( ucmd.upmove < 0 ? -4 : 4 ); } else { if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= FIGHTER_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 2 ) { NPC->client->ps.velocity[2] = 0; } } } } // Apply friction to Z else if ( NPC->client->ps.velocity[2] ) { NPC->client->ps.velocity[2] *= FIGHTER_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[2] ) < 1 ) { NPC->client->ps.velocity[2] = 0; } } } // Apply friction if ( NPC->client->ps.velocity[0] ) { NPC->client->ps.velocity[0] *= FIGHTER_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[0] ) < 1 ) { NPC->client->ps.velocity[0] = 0; } } if ( NPC->client->ps.velocity[1] ) { NPC->client->ps.velocity[1] *= FIGHTER_VELOCITY_DECAY; if ( fabs( NPC->client->ps.velocity[1] ) < 1 ) { NPC->client->ps.velocity[1] = 0; } } NPC_FaceEnemy( qtrue ); } void Fighter_flyforward1( void ) { //qboolean visible, advance; // Rate our distance to the target and visibilty /*float distance2 = (int) DistanceHorizontalSquared( NPC->currentOrigin, NPC->enemy->currentOrigin ); qboolean visible2 = NPC_ClearLOS( NPC->enemy ); qboolean advance2 = (qboolean)(distance2 > FIGHTER_MIN_DISTANCE_SQR);*/ //visible, int advance; float distance, speed; vec3_t forward; speed = NPCInfo->stats.walkSpeed; //speed = FIGHTER_FORWARD_BASE_SPEED + FIGHTER_FORWARD_MULTIPLIER * g_spskill->integer; VectorMA( NPC->client->ps.velocity, speed, forward, NPC->client->ps.velocity ); distance = VectorNormalize( forward ); //We're not supposed to stand still, move forward at run speed! if ( NPCInfo->standTime < level.time ) { speed = NPCInfo->stats.walkSpeed; //FIGHTER_FORWARD_BASE_SPEED + FIGHTER_FORWARD_MULTIPLIER * g_spskill->integer; VectorMA( NPC->client->ps.velocity, speed, forward, NPC->client->ps.velocity ); distance = VectorNormalize( forward ); // Only strafe when we can see the player /*if ( visible2 ) { Fighter_Strafe(); return; }*/ } //If we don't want to advance, stop here /*if ( !advance2 && visible2 ) return;*/ //Only try and navigate if the player is visible /*if ( visible2 == qfalse ) { // Move towards our goal NPCInfo->goalEntity = NPC->enemy; NPCInfo->goalRadius = 1024; NPC_MoveToGoal(qtrue); return; } else { VectorSubtract( NPC->enemy->currentOrigin, NPC->currentOrigin, forward ); distance = VectorNormalize( forward ); }*/ /* vec3_t forward, right; FighterSpeed = NPC->client->ps.speed; //float forwardAmt = forward*FighterVelocity; //FighterVelocity = forwardAmt; NPC->client->ps.speed = NPCInfo->stats.walkSpeed; //AngleVectors( self->currentAngles, forward, right, NULL ); AngleVectors( NPC->currentAngles, forward, NULL, NULL ); FighterSpeed = VectorNormalize(FighterVelocity); //else if /*vec3_t forward, right; //AngleVectors( self->currentAngles, forward, right, NULL ); // Automoving forward at walkspeed. FighterSpeed = VectorNormalize(FighterVelocity); //float forwardAmt = forward*FighterVelocity; // ????!?!??! what i need to do now?!?!? // CODE PAST BY AI_JEDI.CPP if ( VectorCompare( NPC->client->ps.moveDir, vec3_origin ) && (ucmd.forwardmove||ucmd.rightmove) ) {//using ucmds to move this turn, not NAV if ( (ucmd.buttons&BUTTON_WALKING) ) {//FIXME: NAV system screws with speed directly, so now I have to re-set it myself! NPC->client->ps.speed = NPCInfo->stats.walkSpeed; } else { NPC->client->ps.speed = NPCInfo->stats.runSpeed; } } // CODE PASTE BY NPC_MOVE.CPP /*dir[2] = 0; VectorNormalize( dir ); //NPCs cheat and store this directly because converting movement into a ucmd loses precision VectorCopy( dir, self->client->ps.moveDir ); float fDot = DotProduct( forward, dir ) * 127.0f; float rDot = DotProduct( right, dir ) * 127.0f; //Must clamp this because DotProduct is not guaranteed to return a number within -1 to 1, and that would be bad when we're shoving this into a signed byte if ( fDot > 127.0f ) { fDot = 127.0f; } if ( fDot < -127.0f ) { fDot = -127.0f; } if ( rDot > 127.0f ) { rDot = 127.0f; } if ( rDot < -127.0f ) { rDot = -127.0f; } cmd->forwardmove = floor(fDot); cmd->rightmove = floor(rDot);*/ } /* ------------------------- Fighter_Idle ------------------------- */ void Fighter_Idle( void ) { Fighter_MaintainHeight(); //Fighter_flyforward1(); // Is he waking up? if (NPCInfo->localState == FSTATE_WAKEUP) { if (NPC->client->ps.torsoAnimTimer<=0) { NPCInfo->scriptFlags |= SCF_LOOK_FOR_ENEMIES; NPCInfo->burstCount = 0; } } else { NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_SLEEP1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); NPC->flags |= FL_SHIELDED; NPC_BSIdle(); } } /* ------------------------- Fighter_AttackDecision ------------------------- */ void Fighter_AttackDecision( void ) { // Always keep a good height off the ground Fighter_MaintainHeight(); NPC->s.loopSound = G_SoundIndex( "sound/chars/Fighter/misc/Fighter_hover_2_lp" ); //randomly talk if ( TIMER_Done(NPC,"patrolNoise") ) { if (TIMER_Done(NPC,"angerNoise")) { G_SoundOnEnt( NPC, CHAN_AUTO, va("sound/chars/Fighter/misc/talk%d", Q_irand(1, 3)) ); TIMER_Set( NPC, "patrolNoise", Q_irand( 4000, 10000 ) ); } } // He's dead. if (NPC->enemy->health<1) { NPC->enemy = NULL; Fighter_Idle(); return; } // If we don't have an enemy, just idle if ( NPC_CheckEnemyExt() == qfalse ) { Fighter_Idle(); return; } // Rate our distance to the target and visibilty float distance = (int) DistanceHorizontalSquared( NPC->currentOrigin, NPC->enemy->currentOrigin ); qboolean visible = NPC_ClearLOS( NPC->enemy ); qboolean advance = (qboolean)(distance > FIGHTER_MIN_DISTANCE_SQR); // If we cannot see our target, move to see it if ( visible == qfalse ) { if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) { Fighter_Hunt( visible, advance ); return; } } NPC_FaceEnemy( qtrue ); Fighter_RangedAttack( visible, advance ); } qboolean NPC_CheckFighterTeamStealth( void ); /* ------------------------- Fighter_Hunt - look for enemy. -------------------------` */ void Fighter_Hunt(void) { if ( NPCInfo->goalEntity == NULL ) { NPCInfo->goalEntity = NPC->enemy; } NPC_FaceEnemy( qtrue ); NPCInfo->combatMove = qtrue; NPC_MoveToGoal( qtrue ); } /* ------------------------- Fighter_Patrol ------------------------- */ void Fighter_Patrol( void ) { Fighter_MaintainHeight(); //SENTRY CODE //If we have somewhere to go, then do that if (!NPC->enemy) { if ( NPC_CheckPlayerTeamStealth() ) { //NPC_AngerSound(); NPC_UpdateAngles( qtrue, qtrue ); return; } if ( UpdateGoal() ) { //start loop sound once we move ucmd.buttons |= BUTTON_WALKING; NPC_MoveToGoal( qtrue ); } //randomly talk if (TIMER_Done(NPC,"patrolNoise")) { G_SoundOnEnt( NPC, CHAN_AUTO, va("sound/chars/Fighter/misc/talk%d", Q_irand(1, 3)) ); TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) ); } } NPC_UpdateAngles( qtrue, qtrue ); //// MARK CODE if ( NPC_CheckPlayerTeamStealth() ) { G_Sound( NPC, G_SoundIndex("sound/chars/Fighter/misc/Fighter_wakeup")); NPC_UpdateAngles( qtrue, qtrue ); return; } //If we have somewhere to go, then do that if (!NPC->enemy) { if ( UpdateGoal() ) { ucmd.buttons |= BUTTON_WALKING; NPC_MoveToGoal( qtrue ); NPC_UpdateAngles( qtrue, qtrue ); } //randomly talk if (TIMER_Done(NPC,"patrolNoise")) { G_Sound( NPC, G_SoundIndex(va("sound/chars/Fighter/misc/talk%d.wav", Q_irand(1, 4)))); TIMER_Set( NPC, "patrolNoise", Q_irand( 2000, 4000 ) ); } } } /* ------------------------- NPC_BSFighter_Default ------------------------- */ void NPC_BSFighter_Default( void ) { // When you spawn immediatly execute this!! Fighter_flyforward1(); //NPC->client->forced_forwardmove = 127; // DA PROGRAMMARE PER ORA E' INERTE. //NPC->e_DieFunc = dieF_Fighter_die; /*if ( NPC->targetname ) { //NPC->e_UseFunc = useF_TieFighter_use; NPC->e_UseFunc = useF_TieFighterUse; }*/ if ( NPC->enemy ) { if( (NPCInfo->scriptFlags & SCF_CHASE_ENEMIES) ) { NPCInfo->goalEntity = NPC->enemy; } Fighter_Hunt(); // Fighter_Hunt( visible, advance); Fighter_AttackDecision(); Fighter_Update(); } /*{ NPCInfo->goalEntity = NPC->enemy; Fighter_Hunt(); Fighter_AttackDecision(); }*/ else if ( NPCInfo->scriptFlags & SCF_LOOK_FOR_ENEMIES ) { Fighter_Patrol(); } else { Fighter_Idle(); } }
  22. i tryed this but with no much result vec3_t forward, right; FighterSpeed = NPC->client->ps.speed; //float forwardAmt = forward*FighterVelocity; //FighterVelocity = forwardAmt; NPC->client->ps.speed = NPCInfo->stats.walkSpeed; //AngleVectors( self->currentAngles, forward, right, NULL ); AngleVectors( NPC->currentAngles, forward, NULL, NULL ); FighterSpeed = VectorNormalize(FighterVelocity); i cannot use float forwardAmt because visual studio give me error. it require an editable Lvalue... o.O.
  23. @@MGummelt okay, this is what i am trying to archieve. I have my fighter AI, and this is the default behavour. void NPC_BSFighter_Default( void ) { NPC->client->forced_forwardmove = 127; // WORK IN PROGRESS //NPC->e_DieFunc = dieF_Fighter_die; /*if ( NPC->targetname ) { //NPC->e_UseFunc = useF_TieFighter_use; NPC->e_UseFunc = useF_TieFighterUse; }*/ if ( NPC->enemy ) { if( (NPCInfo->scriptFlags & SCF_CHASE_ENEMIES) ) { NPCInfo->goalEntity = NPC->enemy; } Fighter_Hunt(); Fighter_AttackDecision(); Fighter_Update(); } /*{ NPCInfo->goalEntity = NPC->enemy; Fighter_Hunt(); Fighter_AttackDecision(); }*/ else if ( NPCInfo->scriptFlags & SCF_LOOK_FOR_ENEMIES ) { Fighter_Patrol(); } else { Fighter_Idle(); } } as you can see, the fighter have the following statements: Idle: do nothing, is the behavor that assume when it spawn. is in wait of order. Patrol: move throught waypoint and Navgoal, like a sentry, following desired icarus scripted path. Hunt: chase an Enemy Update: update the AI fight boba fett fighting advanced ai commands and behavours. AttackDecision: remind to tacticts: fighter decide what kind of approach have on the Enemy, switching and selecting the properly weapons of his arsenal to attack, this is set by calculating variable like the distance from opponent and other tnings. this works like an half way between a sentry Ai and Bobafett AI. now, i want that fighter get an autoforward movement when is in idle and patrol. this movement are not a specified speed. should be more better if the speed value can be definied throught NPC file. for Idle and Patrol behavour i want to force fighter to move forward at his walkspeed. for Hunt and attack behavour, when shoot and chase enemy, i wanna force the fighter to move forward to his NPC Runspeed. so, i start with my Fighter_Idle code. void Fighter_Idle( void ) { Fighter_MaintainHeight(); Fighter_flyforward1(); // Is he waking up? if (NPCInfo->localState == FSTATE_WAKEUP) { if (NPC->client->ps.torsoAnimTimer<=0) { NPCInfo->scriptFlags |= SCF_LOOK_FOR_ENEMIES; NPCInfo->burstCount = 0; } } else { NPC_SetAnim( NPC, SETANIM_BOTH, BOTH_SLEEP1, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD ); NPC->flags |= FL_SHIELDED; NPC_BSIdle(); } } where Fighter_flyforward is the void function called for take the automovement to the fighter. now is the hardest way... WRITE the fighter_flyforward function. void Fighter_flyforward1( gentity_t *self, usercmd_t *cmd, vec3_t dir ) { vec3_t forward, right; AngleVectors( self->currentAngles, forward, right, NULL ); // Automoving forward at walkspeed. FighterSpeed = VectorNormalize(FighterVelocity); float forwardAmt = forward*FighterVelocity; // ????!?!??! what i need to do now?!?!? // CODE PAST BY AI_JEDI.CPP if ( VectorCompare( NPC->client->ps.moveDir, vec3_origin ) && (ucmd.forwardmove||ucmd.rightmove) ) {//using ucmds to move this turn, not NAV if ( (ucmd.buttons&BUTTON_WALKING) ) {//FIXME: NAV system screws with speed directly, so now I have to re-set it myself! NPC->client->ps.speed = NPCInfo->stats.walkSpeed; } else { NPC->client->ps.speed = NPCInfo->stats.runSpeed; } }*/ // CODE PASTE BY NPC_MOVE.CPP dir[2] = 0; VectorNormalize( dir ); //NPCs cheat and store this directly because converting movement into a ucmd loses precision VectorCopy( dir, self->client->ps.moveDir ); float fDot = DotProduct( forward, dir ) * 127.0f; float rDot = DotProduct( right, dir ) * 127.0f; //Must clamp this because DotProduct is not guaranteed to return a number within -1 to 1, and that would be bad when we're shoving this into a signed byte if ( fDot > 127.0f ) { fDot = 127.0f; } if ( fDot < -127.0f ) { fDot = -127.0f; } if ( rDot > 127.0f ) { rDot = 127.0f; } if ( rDot < -127.0f ) { rDot = -127.0f; } cmd->forwardmove = floor(fDot); cmd->rightmove = floor(rDot); } basically, i not know much of C++ just the base and i have not familiarity with vector. for my curse, i never ended the high schools for heal problems, so i lack of math knowledge i need for understand that. i pasted for have an hint two chunks of code: one is the function you direct to me, that sect the movement in base of direction to an NPC when is moving. the second chunks of code i picked up from Ai_JEDI.CPP. i Not need directly that, but i just wanna to give a look about how to force , with code way, an NPC to move at walkspeed NPC data value or runspeed. this chunk of code contain the answer. so now, what i need is to merge the two stuff into something that my Fighter can understand. at the start of file, i setted FighterSpeed as an int Int FighterSpeed; vec3_t FighterVelocity; That's are my version of your suggested desiredSpeed and DesiredVelocity. This is the part that i really not anderstand. because there is not any forwardAmt on my code. float forwardAmt = forward*FighterVelocity; Well, so basically... i reached a dead lock point. i not know exactly how to write this function. i not want to abuse of your time and your patience, you are very kind with me and other coder, but... well, i should need an hint, or little better because i not understand much vector maths, (vectors are simply directions, X, Y, Z, on a cartesian 3d grid, for what i understood, they are necessaty for tell to the entity how to move and in what direction on the 3Dspace of game). well, i need a step by step little guide about that. Thanks for every reply. :\ i spend 3 hours on that and i get a painful headache.
  24. Dear MGummelt, thanks for time you spend to answer to me and to alls coder of JKHUB. here in italy is pretty hot summer and is not easy stay on computer to do coding with hot weather. but i'll do as soon as i can. i really want to see the result and i think your suggests are pretty valid and interessing. thanks again and have nice holiday. i'will let you know my progress
  25. That's explain a very lot of things. infact after build nothing is changed to my fighter (but they are NOT vehicle, myster they are really NPC... basically they are like droids... but i want they move and fight like a vehicle. something like that. i do that with NPC code instead of vehicle because NPC is more simply to use, not need a driver and have more weapons and weapons can be easy switchable (i want my fighters using seekers if enemy is far and blaster if near, and bomb and chaff and flare and other original weapons too, is for a science fiction mod not only star wars ) basically i want to recreate this movement: https://www.youtube.com/watch?v=CDntDe7eazAleaving out leaving force forward move, and using a vector movement imbued into NPC AI client code that force NPC to move a walkspeed into his idle \ patrol state and runspeed at his attack \ flee \ hunt \ strafe behavour state, there is some other way to do that with a simple vector move along Y axis? i am not familiar with vector so i need an example of a little function that force an entity to move forward along a vector direction. there is into the code the command about SET_MOVEMENT X \ Y \ Z of something like that and it work on every entity, npc included, but i tryed and it move with absolutely direction, not with a vector related to X Y Z left \ right forward \ backward and up \ down of NPC. i need just to push a fighter along Y axis with + values, but NOT with absolutely map Y vector, but with Y axis vector relative to entity. mmm strange, video link not work try to dive into google with search about "rogue squadron 3d escape on fest gold medal" and you see what i want to recreate.
×
×
  • Create New...