Main

Forums

Wiki

Downloads

Tutorials

Walkthrough

Unreal-netiquette

Links

Submit-News

Oldunreal's hosted:
UnrealReference

Usermaps

Real-CTF

Donate for Oldunreal:

Oldunreal Donation
Oldunreallogo
  Welcome, Guest. Please Login or Register
 
  HomeHelpSearchLoginRegister  
 
 
Replicating Effects (Read 300 times)
Gizzy
Senior Member
****
Offline


JOLLY GOOD.

Posts: 283
Britain
Gender: male
Replicating Effects
02/08/10 at 00:28:05
 
I'm porting a weapon from Unreal v220 and it uses effects to create a muzzle flash, effects are spawned as the weapon fires, and where it hits. The problem is, is that online, the effects just hang in mid-air and don't disappear. I don't understand much about replication, but I'm assuming it is not being destroyed, either client side or server side.

I pasted in the 3 effect classes with code, the parent class and 2 child classes. There are sub-classes of those child classes, but they have no code. Could someone help?

Code:
class KlingonEffects expands Effects;

var() float				ScaleRate;
var() float				ScaleGlowRate;
var() float				EffectTimer;
var() sound				EffectSound;
var() class<Effects>	ChildEffect;
var() class<Effects>	TickEffect;
var() class<Effects>	DestroyedEffect;
var() texture			Frames[20];

var int					CurrentFrame;
var actor				ChildActor,
						DestroyedActor,
						TickActor;

function EffectAnim(float delta)
{
	if (Frames[0] != None) {
		if (Frames[CurrentFrame] == None || CurrentFrame == 19) {
			Destroy();
		}
		else {
			Texture=Frames[CurrentFrame];
			CurrentFrame++;
		}
	}
	if (ScaleRate != 0.0) {
		DrawScale+=ScaleRate;
		if (DrawScale <= 0.0) {
			Destroy();
		}
	}
	if (ScaleGlowRate != 0.0) {
		ScaleGlow+=ScaleGlowRate;
		if (ScaleGlow <= 0.0) {
			Destroy();
		}
	}
	if (TickEffect != None) {
		TickActor=Spawn(TickEffect);
	}
}

auto state SpecialEffect
{
	function Tick(float delta)
	{
		EffectAnim(delta);
	}
	function Timer()
	{
		EffectAnim(EffectTimer);
	}
	function Destroyed()
	{
		if (DestroyedEffect != None) {
			DestroyedActor=Spawn(DestroyedEffect);
		}
		if (EffectSound2 != None) {
			PlaySound(EffectSound2);
		}
	}
	function BeginState()
	{
		if (EffectSound != None) {
			PlaySound(EffectSound);
		}
		if (EffectSound1 != None) {
			PlaySound(EffectSound1);
		}
		if (ChildEffect != None) {
			ChildActor=Spawn(ChildEffect);
		}
		if (EffectTimer != 0.0) {
			Disable('Tick');
			SetTimer(EffectTimer,True);
		}
	}
} 



Code:
class AnySmoke expands KlingonEffects;

var() class<Effects>	SmokeList[10];

auto state SpecialEffect
{
	function BeginState()
	{
		ChildEffect=SmokeList[Rand(10)];
		Super.BeginState();
		Destroy();
	}
}


 



Code:
Class Smokes espands KlingonEffects;
var() bool	bRising;

auto state SpecialEffect
{
	function BeginState()
	{
		Super.BeginState();
		if (bRising) {
			SetPhysics(PHYS_Projectile);
			Velocity=vect(0,0,50.0)*(0.25+FRand());
		}
	}
}

 

Back to top
« Last Edit: 02/08/10 at 00:29:05 by Gizzy »  
WWW WWW Gizzy Danmaddo  
IP Logged
 
[]KAOS[]Casey
Global Moderator
Developer Team
******
Offline


Pawnching out the bugs

Posts: 2368
California
Gender: male
Re: Replicating Effects
Reply #1 - 02/08/10 at 03:05:44
 
make them simulated & flag functions simulated
Back to top
 

Life is like coop, but, friendly fire is on. - me
WWW WWW []KAOS[]Casey 380468265 link096692  
IP Logged
 
Gizzy
Senior Member
****
Offline


JOLLY GOOD.

Posts: 283
Britain
Gender: male
Re: Replicating Effects
Reply #2 - 02/10/10 at 11:29:10
 
It works fine now, thanks!
Back to top
 
WWW WWW Gizzy Danmaddo  
IP Logged
 
(Moderators: Smirftsch, TCP_Wolf, Smartball, pÍtßűll, DieHard SCWS)