[HELP]Monsters time to spawn

05/02/2010 20:58 ryuchetval#1
Can anyone tell me how to make a timer (example to spawn ganoderma/titan) every 1 hour?

I have the ganoderma and titan inserted in the database but I don't know how to spawn them from the source (LOTF)

The thing I want is how to create a timer to spawn them (1 of the 4 ganodermas/titans inserted in the db (differing by level))
05/02/2010 22:19 herekorvac#2
LOTF which version?
05/03/2010 00:15 Luiz01#3
Quote:
Originally Posted by ryuchetval View Post
Can anyone tell me how to make a timer (example to spawn ganoderma/titan) every 1 hour?

I have the ganoderma and titan inserted in the database but I don't know how to spawn them from the source (LOTF)

The thing I want is how to create a timer to spawn them (1 of the 4 ganodermas/titans inserted in the db (differing by level))
I think
Code:
if (DateTime.Now.Minute  == 15)
{
... here te rest of code
Obs: Worked for me !
05/03/2010 06:53 TheGuyWithTheCodes#4
go to General.cs and search for Thetimer = new System.Timers.Timer();
then under it paste:
Code:
                System.Timers.Timer MobTimer = new System.Timers.Timer(1000.0);
                MobTimer.Start();
                MobTimer.Elapsed += delegate { MobSpawnTime(); };
then find public static void DoStuff()
and above it paste:
Code:
        public static void MobSpawnTime()
        {
            if (DateTime.Now.Minute == 00)
            {
                MobSpawnTimer = true;
                TitanSpawn();
            }
            else if (DateTime.Now.Minute == 30)
            {
                MobSpawnTimer = true;
                GanodermaSpawn();
            }
        }

        public static void TitanSpawn()
        {
            if (MobSpawnTimer == true)
            {
            //The methode for spawning titan here
                MobSpawnTimer = false;
            }
        }

        public static void GanodermaSpawn()
        {
            if (MobSpawnTimer == true)
            {
                //The methode for spawning ganoderma here
                MobSpawnTimer = false;
            }
        }
now find: public unsafe General()
above that paste:
Code:
public static bool MobSpawnTimer = false;
Hope it was useful.
05/03/2010 07:58 ryuchetval#5
I think that's gonna help me Thanks :)

EDIT:...How do I take some monsters to spawn from the database in C# I mean.... with codes not database :D cause they will spawn every few seconds if I spawn them in the DB
05/03/2010 08:00 TheGuyWithTheCodes#6
No problem, tell me if you got problems with it.
but it should work.
05/03/2010 08:45 ryuchetval#7
Quote:
Originally Posted by TheGuyWithTheCodes View Post
No problem, tell me if you got problems with it.
but it should work.
I'm having problems with the spawning part...

It's because I can't find a way to put the data ...."short x, short y, short map, uint maxhp, uint curhp, short minatk, short maxatk, uint uid, string name, int mech, short lvl, byte pos, byte Type, uint owner, bool Alive, int magicskill" so that they can spawn


EDIT: OK i did this but it ain't good...the titans and ganodermas keep spawning during the 15th minute of every hour...(like 20 ganodermas and titans)...ideas?

EDIT2: I think I fixed it thanks :P :)

EDIT 3: The monster summons but I can't attack it/ and it dissapears after a while (it becomes invisible)
05/03/2010 20:33 TheGuyWithTheCodes#8
as in my code i putted a bool with true & false.
It is because it keeps check if the time is right when the time is at xx.
you will have to make it check that it only spawn at true and then after a spawn it makes it false.
05/03/2010 21:22 ryuchetval#9
Quote:
Originally Posted by TheGuyWithTheCodes View Post
as in my code i putted a bool with true & false.
It is because it keeps check if the time is right when the time is at xx.
you will have to make it check that it only spawn at true and then after a spawn it makes it false.
I'm at edit 3 atm.... the monster spawns (1 time) but it's invisible(after a few sec) and you can't attack it!
05/03/2010 21:24 TheGuyWithTheCodes#10
have you added it in entities.cs also?
05/03/2010 23:12 ryuchetval#11
Quote:
Originally Posted by TheGuyWithTheCodes View Post
have you added it in entities.cs also?
What for? I'm just using the SingleMob function to spawn the mobs but it is just as I said...invisible...unhittable...and if I have to add it there then how and where?:O
05/03/2010 23:29 TheGuyWithTheCodes#12
It is because you will need to add the state for it in entities.cs
You will need to make a methode for attacking the mob.
05/04/2010 07:28 ryuchetval#13
Quote:
Originally Posted by TheGuyWithTheCodes View Post
It is because you will need to add the state for it in entities.cs
You will need to make a methode for attacking the mob.
shouldn't I be able to attack him? he is spawned in C# but it's the same as it would be in MySQL (the stats)
05/04/2010 20:12 TheGuyWithTheCodes#14
it spawned, but you didnt add it as a mob, only as a model that can attack. You will need to make it possible to be attacked.