Author Topic: DelayCommand and Encounters  (Read 671 times)

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
DelayCommand and Encounters
« on: February 14, 2014, 10:29:22 am »


               I couldn't find any discussion about this, but DelayCommand doesn't seem to work when OBJECT_SELF is an encounter.  Is this my imagination or is this a known issue/feature?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #1 on: February 14, 2014, 01:14:06 pm »


               nevermind, thought you talking about triggers:unsure:
               
               

               


                     Modifié par ShaDoOoW, 14 février 2014 - 01:57 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #2 on: February 14, 2014, 01:28:59 pm »


               I have not heard of them not working before, But since encounters do play by some of there own rules, I can see the need to do a little testing ( I currently do not have the time to do it right now).

Encounters tend to shut thing down when they are not active. You may want to run a few tests with the encounter in an active/inactive/exhausted state to see if they give different results.


EDIT: Keep in mind that the encounters HB only works when the encounter is active.
               
               

               


                     Modifié par Lightfoot8, 14 février 2014 - 01:44 .
                     
                  


            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #3 on: February 14, 2014, 04:00:42 pm »


               Not sure if this would work, but have you tried DelayCommand(fDelay, ExecuteScript(OBJECT_SELF, "Some_Script")); and have the effect you desire excuted by "Some_Script"?
               
               

               


                     Modifié par Pstemarie, 14 février 2014 - 04:02 .
                     
                  


            

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #4 on: February 14, 2014, 04:01:29 pm »


               Good idea.  I looked into and tested a bit more.  I don't think it works regardless of whether active or not.

The event is created and everything, but the encounter event handler just seems to throw it away.
               
               

               
            

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #5 on: February 14, 2014, 04:02:50 pm »


               

Pstemarie wrote...

Not sure if this would work, but have you tried DelayCommand(fDelay, ExecuteScript(OBJECT_SELF, "Some_Script")); ?


I'll give it a try.
               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #6 on: February 14, 2014, 04:04:44 pm »


               

pope_leo wrote...

Good idea.  I looked into and tested a bit more.  I don't think it works regardless of whether active or not.

The event is created and everything, but the encounter event handler just seems to throw it away.


Maybe you need to identify the encounter object's trigger by its tag - object oEncounter = GetObjectByTag("Encounter_Tag")?

ShaDoOw may be on to something because, if I understand them correctly, the encounter is actually activated by the PC entering trigger - kind of like the way traps work. This being the case, wouldn't the script events fire for the trigger? I'm at a loss here - I use encounters, but usually don't script things from them.
               
               

               


                     Modifié par Pstemarie, 14 février 2014 - 04:08 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #7 on: February 14, 2014, 05:18:30 pm »


               It would help if we knew what command you whrer trying to delay.
               
               

               
            

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #8 on: February 14, 2014, 06:12:27 pm »


               I was scripting an encounter system, the delay was for creating creatures.  So it's not a big issue to work around by assigning to the module, but it's doubling the cost which I was hoping wasn't necessary.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #9 on: February 14, 2014, 10:21:12 pm »


               Ok,  After testing it appears that delay commands do not work at any time on encounters.  

I guess now the question on my mind is.  

If you are scripting your own encounter system why are you using an encounter and not just a plain old trigger?
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #10 on: February 15, 2014, 03:28:12 am »


               

Lightfoot8 wrote...

Ok,  After testing it appears that delay commands do not work at any time on encounters.  

I guess now the question on my mind is.  

If you are scripting your own encounter system why are you using an encounter and not just a plain old trigger?


Yeah, I like triggers myself, it's far easier to create a script template that doesn't use delay command at all, which to me is a Server Resource Hog (when many players are running over encounters the # of DelayCommands running could reach hundreds if not many thousands!!!)...
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #11 on: February 15, 2014, 03:32:18 am »


               

_Guile wrote...

Yeah, I like triggers myself, it's far easier to create a script template that doesn't use delay command at all, which to me is a Server Resource Hog (when many players are running over encounters the # of DelayCommands running could reach hundreds if not many thousands!!!)...

When you mentioned it, can you post the code you do use to check the time passed?
               
               

               
            

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #12 on: February 15, 2014, 07:14:07 am »


               

Lightfoot8 wrote...

Ok,  After testing it appears that delay commands do not work at any time on encounters.  

I guess now the question on my mind is.  

If you are scripting your own encounter system why are you using an encounter and not just a plain old trigger?


In this case I'm using NWNX to access spawn point locations and increment the internal encounter "number spawned" counter, and setting the creatures encounter.   That way the game engine will still take care of exhaustion, reseting the encounter, its timers, etc.

It seemed to me at the time that this would be much simpler and probably much faster than a trigger system.  I'd guess that a trigger system would have waypoints to act as spawn points, which would probably have to be uniquely named for every painted trigger at least in a single area.  Or is there a better way that someone has found to do a trigger system?
               
               

               


                     Modifié par pope_leo, 15 février 2014 - 07:17 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #13 on: February 15, 2014, 06:17:53 pm »


               

In this case I'm using NWNX to access spawn point locations and increment the internal encounter "number spawned" counter, and setting the creatures encounter.   That way the game engine will still take care of exhaustion, reseting the encounter, its timers, etc.

Clever bastard.

It seemed to me at the time that this would be much simpler and probably much faster than a trigger system.  I'd guess that a trigger system would have waypoints to act as spawn points, which would probably have to be uniquely named for every painted trigger at least in a single area.  Or is there a better way that someone has found to do a trigger system?

There's a slightly better way. We use triggers and waypoints, with bitflags on the waypoint. Encounter 1 uses only waypoints with the 1 bit, 2 with the 2, 3 with 4, 4 with 16, etc. Allows re-use of waypoints for multiple encounters. Also requires a lot of attention to detail to avoid TMI infinite loops if you screw up, due to some of our optimizations and customization. '<img'> Those get found and fixed quickly on the first test-runs, though. Bitmath also gets a bit cumbersome to back-of-the-hand past 16384 or so, but I usually keep to about 12 triggers per area. Can post some code if you're curious, but it's hewn pretty close to what we wanted it to do, without too much room for customization. Uses a lot of local string sets to create differing-rarity spawn tables.

Funky
               
               

               
            

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #14 on: February 16, 2014, 05:51:04 am »


               

FunkySwerve wrote...
There's a slightly better way. We use triggers and waypoints, with bitflags on the waypoint. Encounter 1 uses only waypoints with the 1 bit, 2 with the 2, 3 with 4, 4 with 16, etc. Allows re-use of waypoints for multiple encounters. Also requires a lot of attention to detail to avoid TMI infinite loops if you screw up, due to some of our optimizations and customization. '<img'> Those get found and fixed quickly on the first test-runs, though. Bitmath also gets a bit cumbersome to back-of-the-hand past 16384 or so, but I usually keep to about 12 triggers per area. Can post some code if you're curious, but it's hewn pretty close to what we wanted it to do, without too much room for customization. Uses a lot of local string sets to create differing-rarity spawn tables.

Funky


Please do, I'd love to see how you implemented this.
               
               

               


                     Modifié par pope_leo, 16 février 2014 - 10:16 .