Well, the thing is I'm not supposed to have my inherited class in game Ever. I would just like the code to be on one and only weapon class instead of my 4 other classes.
Also, I don't understand what you want to say when you say "targetting feature".
In fact, my real Weapon classes are all inherited from UDNWeapon, in which I copy/past your code, which is inherited from UTWeapon.
One example from my 4 weapons classes :
There's no Firing Process over these codes, actually, I think you'll have to help me out finding it in UTWeapon Class.
Part in italic is what I suppose to be the part when my "scout" projectile (called UDNProj_Pathway) is spawned.
I had to add lots of variables, and change such things as UDNGameInfo, 'cause I didn't have created these classes yet, and I got many errors from UnrealFrontend.
Now I don't get any errors or warnings, but I don't get no traces in game. My weapon class UDNWeapon is not working, even if I assign a Projectile to itself, but my UDNProj_Pathway is.
Sorry for my misunderstanding, and for my english too, young french guy who's trying to figure out things in someone's else language... ^^'
Also, I don't understand what you want to say when you say "targetting feature".
In fact, my real Weapon classes are all inherited from UDNWeapon, in which I copy/past your code, which is inherited from UTWeapon.
One example from my 4 weapons classes :
Code:
class UDNWeap_Champi_Platform extends UDNWeapon; defaultproperties { WeaponFireTypes(0)=EWFT_Projectile WeaponProjectiles(0)=class'UDNProj_Champi_Platform' FireOffset=(X=16,Y=10) CurrentRating=+0.75 bInstantHit=false bSplashJump=false bRecommendSplashDamage=false bSniping=false bCanThrow=false AmmoCount=1 LockerAmmoCount=1 MaxAmmoCount=1 InventoryGroup=1 }
Code:
class UDNWeapon extends UTWeapon; var UDNPlayerController pc; var vector throwDir; var vector pawnRot; var vector spawnLoc; var UDNProj_Pathway p; //============Display Path ============ var YourProjectilePathNode pathNodes[40]; var UDNProj_Pathway tracer; var int curPathNodeCount; //================================= var int v; var vector vc; var YourProjectilePathNode pnode; simulated function PostBeginPlay() { //~~~~~~~~~~~~~~~~~~~~~~~~ super.PostBeginPlay(); //~~~~~~~~~~~~~~~~~~~~~~~~ pc = UDNGameInfo(WorldInfo.Game).CurrentPlayer; createNodesRunOnceEntireGame(); } //============ Draw Path =============== //================= //Memory Management //================= //Create Once For Entire Life of this Weapon function createNodesRunOnceEntireGame() { for (v = 0; v < ArrayCount(pathNodes); v++ ) { //last spawn parameter makes sure spawning occurs regardless of obstructing collision pnode = spawn(Class'YourProjectilePathNode',,, pc.pawn.Location, rot(0, 0, 0),, true); //pnode.staticmeshcomponent.setMaterial(0); pathNodes[v] = pnode; //pc.optimize("node set"@v); } //hide from view clearPathNodes(); } //when this class is destroyed, //destroy the objects spawned into world //to act as path node indicators //this is an actor event and is called by unreal engine simulated event Destroyed() { super.Destroyed(); for (v = 0; v < ArrayCount(pathNodes); v++ ) { if (pathNodes[v] == none) continue; pathNodes[v].destroy(); } } function stopDrawingPathNodes() { if(tracer != none) { tracer.destroy(); } ClearTimer('drawPathNodes'); clearPathNodes(); } function startDrawingPathNodes() { //already running if (isTimerActive('drawPathNodes')) return; //clear any remaining previous path nodes //clearPathNodes(); //throw the tracer tracer = throwTracer(); //hide tracer.setHidden(true); curPathNodeCount = 0; SetTimer(0.01, true, 'drawPathNodes'); //max life span of 12 seconds SetTimer(12, false, 'clearPathNodes'); } function drawPathNodes() { //end case if (curPathNodeCount >= ArrayCount(pathNodes) ) { ClearTimer('drawPathNodes'); return; } //lost tracer case if (tracer == none) { ClearTimer('drawPathNodes'); return; } positionPathNode(); } function clearPathNodes() { //position doesnt update if hidden for some reason //so move node way far away from player to simulated being hidden //still faster than spawning/destroying //would like to know how to make location update properly even while its hidden //some sort of low-level or native optimization that is getting in the way here for (v = 0; v < ArrayCount(pathNodes); v++ ) { //set the loc vc.x = (v + 1) * 4000; vc.y = (v + 1) * 4000; vc.z = pc.pawn.Location.z - (v + 1) * 4000; //make sure not going below killz if (vc.z < worldinfo.killz) vc.z = worldinfo.killz + 5; pathNodes[v].move(pc.pawn.Location + vc - pathNodes[v].Location); } } function positionPathNode() { //end case if (curPathNodeCount >= ArrayCount(pathNodes)) return; //lost the tracer if (tracer == none) return; //move is way faster than SetLocation //this code says "move path node the amount that is the difference //between its current location and the desired goal position" pathNodes[curPathNodeCount].move( tracer.Location - pathNodes[curPathNodeCount].Location ); curPathNodeCount++; } function UDNProj_Pathway throwTracer() { //pc is ref to your controller class //see my other tutorials on giving //this class a ref to your pc using //post begin play pawnRot = Vector(pc.pawn.Rotation); throwDir = pawnRot;// * 1000; throwDir.z *= 3; spawnLoc = pc.pawn.Location + pawnRot * 64; spawnLoc.z += 64; //spawn p = spawn(Class'UDNProj_Pathway',,, spawnLoc, rot(0, 0, 0) ); //init //p.InitializeProjectile(pc, throwDir); //implementation dependent return p; } defaultproperties { }
Part in italic is what I suppose to be the part when my "scout" projectile (called UDNProj_Pathway) is spawned.
I had to add lots of variables, and change such things as UDNGameInfo, 'cause I didn't have created these classes yet, and I got many errors from UnrealFrontend.
Now I don't get any errors or warnings, but I don't get no traces in game. My weapon class UDNWeapon is not working, even if I assign a Projectile to itself, but my UDNProj_Pathway is.
Sorry for my misunderstanding, and for my english too, young french guy who's trying to figure out things in someone's else language... ^^'
Comment