GhostRiderGrey
Sorceror
I am looking for a way to delete a mobile after a given amount of time. In my searching of the forums I came across this, which uses the OnThink method.
Would not the line if( m_DeleteTime >= DateTime.Now ) always be true because, until 1 minute had passed, the m_DeleteTime would be greater than the DateTime.Now?
Additionally, should the m_DeleteTime be serialized?
Thanks!
Code:
private DateTime m_DeleteTime;
public override void OnThink()
{
base.OnThink();
if( m_DeleteTime >= DateTime.Now )
{
Delete();
return; // we need to delete
}
// Do your heal function here.
m_DeleteTime = DateTime.Now + TimeSpan.FromMinutes( 1 );
}
Would not the line if( m_DeleteTime >= DateTime.Now ) always be true because, until 1 minute had passed, the m_DeleteTime would be greater than the DateTime.Now?
Additionally, should the m_DeleteTime be serialized?
Thanks!