Full Version : HitsMaxSeed on Champ
xmlspawner >>Scripting Support >>HitsMaxSeed on Champ
<< Prev | Next >>
Haazen- 09-12-2006
Here is code from ChampionSpawner
try
{
m_Champion = Activator.CreateInstance( ChampionSpawnInfo.GetInfo( m_Type ).Champion ) as Mobile;
}
catch { }
if( m_Champion != null )
{
m_Champion.MoveToWorld( new Point3D( X, Y, Z - 15 ), Map );
int MobCnt = 0;
foreach ( Mobile m in this.GetMobilesInRange( 40 ) )
{
if ( m is PlayerMobile )
MobCnt +=1;
}
m_Champion.HitsMaxSeed += (int)((m_Champion.HitsMaxSeed / 20) * MobCnt);
m_Champion.Hits = m_Champion.HitsMax;
}
I added the code in red. I am trying to raise hits of the champ for each player at the champ spawn.
Adding to Hits does not work as it reverts back to HitsMax. HitsMax is read only so it can't be set. And HitsMaxSeed is not found in Server.Mobile.
How do I set HitsMaxSeed on this critter?
Thanks for reading.
XavierWER- 09-12-2006
its just Hits, and not hitsmaxseed etc.
Haazen- 09-12-2006
Thanks for your response. I had to test it just to make sure I didn't miss something. Setting hits does not work.
If you [set hits higher than the HitsMax, hits is set to HitsMax. You can not [set hits higher than HitsMax. And HitsMax is determined by HitsMaxSeed. Example:
A dog with HitsMaxSeed 20, HitsMax will be 20. If I [set hits 100, hits will only be 20. I can't set hits higher than HitsMax. HitsMax is readonly. HitsMaxSeed is not readonly so if [set hitsmaxseed 100 sets HitsMax to 100 and then I can [set hitsmax 100 and it will stick.
The problem in the ChampionSpawn script is that m_Champion is Mobile. HitsMaxSeed is introduced in BaseCreature. So m_Champion as Mobile does not have that prop.
I have tested setting Hits, HitsMax and HitsMaxSeed in this script. Hits maxes out at HitsMax. HitsMax is read only and can't be set in the script. And HitsMaxSeed is not in base Mobile.
Haazen- 09-12-2006
Thanks for reading. I solved my problem. Sometimes just writing the problem and discussing it turns on the lights.
I created the Champ as a BaseCreatire first, set the HitsMaxSeed, then converted it back to Mobile. It all work just as I invisioned.