Hey guys, i was trying to fix my shockrifle for my BTclan for online. i fixed most things, only 2 more things to fix, and one if them is involving a decal.
It only spawns if i shoot it at walls facing 1 particular way,
red = decal
i spawn an actor with location: hitlocation + hitnormal and rotation: rotator(HitNormal)
and that actor spawns several FX including the decal, everything except the decal is spawned ok
You have to assign the proper code to the child spawns too. They may be spawned by the parent function but they don't automatically inherit the variables.
JackGriffin wrote:You have to assign the proper code to the child spawns too. They may be spawned by the parent function but they don't automatically inherit the variables.
i thought it does inherit cuz the other FX do have the good rotation and location, and anyway that code cant be done in the FXclass, but can be done in the shockrifleclass and that didnt fix my problem.
JackGriffin wrote:You might also need checks before that like this:
class UT_WallHit extends BulletImpact;
var int MaxChips, MaxSparks;
var float ChipOdds;
var rotator RealRotation;
replication
{
// Things the server should send to the client.
unreliable if( Role==ROLE_Authority )
RealRotation;
}
...
...
Auto State StartUp
{
simulated function Tick(float DeltaTime)
{
if ( Instigator != None )
MakeNoise(0.3);
if ( Role == ROLE_Authority )
RealRotation = Rotation;
else
SetRotation(RealRotation);
if ( Level.NetMode != NM_DedicatedServer )
SpawnEffects();
Disable('Tick');
}
}
Does RealRotation have something to do with my problem??
Sorry, my bad. I thought EnergyImpact was a custom class. I didn't recognize it. I looked and the class supers to decal, which won't carry the location data. You'll have to manually assign that
simulated function HitWall (vector HitNormal, actor Wall)
{
if ( Role == ROLE_Authority )
{
***SNIP***
}
Explode(Location + ExploWallOut * HitNormal, HitNormal);
//THE GOOD STUFF:
if ( (ExplosionDecal != None) && (Level.NetMode != NM_DedicatedServer) )
Spawn(ExplosionDecal,self,,Location, rotator(HitNormal));
}
See how it sets the decal location? Remember decals won't render unless they can attach to something. Your decal is still being spawned, you just don't see it because it has no surface.
The key for that is bNetOptional=True (somewhat the actor is created on the server and clients independently, and each one runs its version, however it won't be even spawned client-side if there's not enough bandwidth to, but that's not a problem nowadays, unless you still have a 56k modem connection or the server starts to lag), but it must be set as default property.
Also, you must note that Rotation is not replicated if your effect is a sprite, it's only replicated if it's a mesh, so by spawning anything from a sprite actor online, its rotation will be always the same: rot(0,0,0).
woot nevermind guys thx anyway, i fixed it by looking in the UT_superring and UT_Superring5 class which uses a bool or sth, now it is spawned in every rotation and always yay, 1 problem left, which im still trying to fix myself now but i might ask it here too :p