Author Topic: Applying Effects on Area Enter  (Read 424 times)

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Applying Effects on Area Enter
« on: November 11, 2012, 03:47:54 pm »


               I am having a problem getting Effect Icons to display on a PC when applying the effects on area enter.

Background:
I have a large marsh area that I am building for Arnheim. And I have created terrain effects for marshy ground. The terrain effects can be given to creatures within the area, within a trigger, or either. For some of these areas, the entire area is marshy except for an island. In those areas I apply the marshy terrain effects to the PC on area enter, and lift them if they step on to the island, reapply them when they leave the island. And I remove them when they leave the area, of course. Even though the effects are applied appropriately in all situations, the effect icons do not display when effects are applied on area enter.



So... is this a timing problem? If I delayed the application of the effects, would the icons show up? I would prefer not to delay, due to issues that can arise with applying a marsh effect of the PC moves on to an island before the marsh effect 
Is there some other issue?

The code:
handling Area Enter prior to calling terrain effects for swampy ground
  - Custom Script executed from on Area Enter on the entering creature
aa_area_ent_swmp

Apply terrain effects for swampy ground
  - Executes on an invisible "swamp placeable" in the area that has the marshy ground.
aa_ex_ent_swamp
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Applying Effects on Area Enter
« Reply #1 on: November 12, 2012, 03:39:39 am »


               Line 49:    SetLocalObject(oSwamp,"CREATURE",OBJECT_SELF);
--OBJECT_SELF would be the area not the creature.

line 45: DelayCommand(1.5,EnterSwamp(oSwamp));
-- If you have two creatures transitioning at the same time you will lose one of them.
               
               

               


                     Modifié par Lightfoot8, 12 novembre 2012 - 03:43 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Applying Effects on Area Enter
« Reply #2 on: November 12, 2012, 11:52:13 am »


               

Lightfoot8 wrote...
Line 49:    SetLocalObject(oSwamp,"CREATURE",OBJECT_SELF);
--OBJECT_SELF would be the area not the creature.

No, this script is not executed on an Area, but on the creature. It is called by an ExecuteScript function in the AreaEnter event.

Lightfoot8 wrote...
line 45: DelayCommand(1.5,EnterSwamp(oSwamp));
-- If you have two creatures transitioning at the same time you will lose one of them.

Are you sure? The script is executed on the entering creature until it arrives in the new area, at which time the swamp script finally executes on the swamp with the entering creature as its target. Would a better method be to continue executing on the entering creature, and then assign command the swamp to apply effects to the creature?

You know... it would be more efficient... so I'll make that change.
               
               

               


                     Modifié par henesua, 12 novembre 2012 - 11:57 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Applying Effects on Area Enter
« Reply #3 on: November 12, 2012, 10:41:05 pm »


               1) oops.

2)  It was only a problem if the script was running on the area.  So, oops 2.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Applying Effects on Area Enter
« Reply #4 on: November 12, 2012, 10:47:51 pm »


               ah... well in anycase I rewrote the set of scripts and its tighter than it was before. so your comments inspired me to get this right.

That said, I have not fixed the missing effect icons problem. Any ideas there?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Applying Effects on Area Enter
« Reply #5 on: November 12, 2012, 10:58:03 pm »


               This is a guess,   I would think that an action would not happen untill the PC was fully in the area.   So I would try something like.  

..
ActionDoCommand(EnterSwamp(object oSwamp));
ActionDoCommand(SetCommandable(TRUE) );
SetCommandable(FALSE);
..

An forget about the delayed check in the EnterSwamp function.

Not sure it will work but it is worth a try.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Applying Effects on Area Enter
« Reply #6 on: November 12, 2012, 11:02:48 pm »


               interesting... put the enter check in the action queue... well why not? I'll give it a try.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Applying Effects on Area Enter
« Reply #7 on: November 12, 2012, 11:34:15 pm »


               Hmm I did that in my marsh in Second God War and no problem.
Actually it was The Sucking Bog:

object oPC = GetEnteringObject();
effect eEffect;
eEffect = EffectMovementSpeedDecrease(25);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
 
               
               

               


                     Modifié par ffbj, 12 novembre 2012 - 11:40 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Applying Effects on Area Enter
« Reply #8 on: November 12, 2012, 11:38:05 pm »


               cool. Once I get this last bit fixed I think this system will be good for the printers. Thanks guys.

I'll credit you with pushing me over the edge in the script comments, and possibly submit this to this month's Custom Content Challenge.

Thanks.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Applying Effects on Area Enter
« Reply #9 on: November 12, 2012, 11:50:51 pm »


               Although yours is much more complex.  Later I added in size as you do and also weight, just using anything metal over 25 lbs as the cutoff.  So if you are a hobbit in leather you only slow a bit while a guy in plate would get the full -25.  Of course doing the checks for special strides, and flying, etc... also add complexity but realism.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Applying Effects on Area Enter
« Reply #10 on: November 12, 2012, 11:59:17 pm »


               Yeah... those last checks might not be feasible to include as part of a more widely used project. But its interesting how I did it. I edited appearance.2da and to add some new columns. And I added some new feats and spells. I had forgotten about that.

I think if I do submit this that I'll have the vanilla version, and the 2da bonanza version. '<img'>
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Applying Effects on Area Enter
« Reply #11 on: November 13, 2012, 02:41:29 am »


               Using the action queue doesn't seem to solve the problem, although it probably should and I now suspect that I'd have to rewrite my scripts to work with the timing of an action queue to make it work.

More importantly however, the action queue is too slow.for my purposes unless I can assure that I am using it only when the PC is transitioning from one area to another. So at this point I think I'll leave the problem of effect icons for another day.