Announcement

Collapse
No announcement yet.

Replication & Timer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Replication & Timer

    In a state, I set a timer. Both client and server are in the state, but the timer is never set (its never called back). This works fine offline though. Any help is appreciated.

    Code:
    state AttackOnSight
    {
    	simulated function BeginState()
    	{
    		Log("begin");
    		SetTimer(rateOfFire, true);
    	}
    
    
    	event Timer()
    	{
    		local Controller P;
    
    		Log("timer");
    		for(P=Level.ControllerList; P!=None; P=P.NextController)
    		{
    			if((TDCreatureController(P) != none) && (TDCreature(P.Pawn) != none))
    			{
    				if(IsCloseToTower(TDCreature(P.Pawn).Location))
    				{
         				// fire at this creature
    					Fire(P.Pawn);
    					break;
    				}
    			}
    		}
    	}
    
    	simulated function EndState()
    	{
    		Log("end");
    		SetTimer(0.0, false);
    	}
    }

    #2
    My apologies. I previously had the timer function defined as 'simulated function Timer()' instead of 'event Timer()'. I guess I didnt compile it when I had replaced function with event. It works fine now.

    Comment

    Working...
    X