Author Topic: UserDefinned Death  (Read 396 times)

Legacy_Q.dot

  • Newbie
  • *
  • Posts: 40
  • Karma: +0/-0
UserDefinned Death
« on: January 28, 2011, 10:42:01 am »


               You know how in the defualt user defined death, how it says "do not use for critical code, does not fire reliably all the time"

Well I don't know how to use my critical code any other way. It does work but not all of the time.

The following code is not the whole script, but the segment that is "critical"

if (sSelfTag == "ChampionoftheViod")
     {object oPortal = GetObjectByTag("ZEP_PORTAL_Red_VD02");
      effect evSummonPortal = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1);
      //effect evCutsceneInvis = EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY);
      effect eLoop = GetFirstEffect(oPortal);

      ApplyEffectAtLocation(DURATION_TYPE_INSTANT,evSummonPortal,GetLocation(oPortal));

      while (GetIsEffectValid(eLoop))
      {
       if (GetEffectType(eLoop)==EFFECT_TYPE_VISUALEFFECT)
           DelayCommand(1.0f,RemoveEffect(oPortal,eLoop));

       eLoop = GetNextEffect(oPortal);
      }
     }

Bear in mind I'm going for a generic approach when each time it fires it checks the tag of the creature calling the script, this I can cut down on scripts, and also oPortal was given cutscene invisablity in the on area enter script, this way didn't have to creat it from an existing custom blueprint which cuts down on blueprints as well.

Anyway my question is how do stuff like spawn a portal when the boss dies reliably?
               
               

               


                     Modifié par Q.dot, 28 janvier 2011 - 10:42 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
UserDefinned Death
« Reply #1 on: January 28, 2011, 11:09:21 am »


               fire the script from different object like this:



object oDeathWorkaround = GetObjectByTag("blabla);

ExecuteScript("the_code_above",oDeathWorkaround);
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
UserDefinned Death
« Reply #2 on: January 28, 2011, 06:47:52 pm »


               Or, just use the standard death script - it does fire reliably. No need for the user defined hook.

Funky
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
UserDefinned Death
« Reply #3 on: January 28, 2011, 07:01:13 pm »


               Yea sure, you actually have to use default script for my workaround, but sometimes you have to use my workaround, for example, if you want to delay anything there since delay in OnDeath do not work (when body disappear, delay will too).

LightFoot8 is right, the assign is better, forget my suggestion ':whistle:'

               
               

               


                     Modifié par ShaDoOoW, 28 janvier 2011 - 08:18 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
UserDefinned Death
« Reply #4 on: January 28, 2011, 08:07:22 pm »


               

ShaDoOoW wrote...

Yea sure, you actually have to use default script for my workaround, but sometimes you have to use my workaround, for example, if you want to delay anything there since delay in OnDeath do not work (when body disappear, delay will too).


In that case you just assign the delayed command to the area you are in.
               
               

               
            

Legacy_Q.dot

  • Newbie
  • *
  • Posts: 40
  • Karma: +0/-0
UserDefinned Death
« Reply #5 on: January 29, 2011, 04:49:06 am »


               thanks guys I've decided to use the ExecuteScript Funtion to run a generic script on the portal, and in that script it checks the tag of object self which is the portal so yeah, it works a 100% now