Author Topic: Boss (Dragon Encounter)  (Read 278 times)

Legacy_Wawmong

  • Jr. Member
  • **
  • Posts: 99
  • Karma: +0/-0
Boss (Dragon Encounter)
« on: July 04, 2015, 02:53:39 pm »


               

hello everyone


I'm in need of a bit of help again with a boss script. (dragon encounter)


how would i turn a placeable into a creature (boss) when the placeable is used, then have the boss

disappear (EffectDisappear) once it's hp has been reduced by half? Also, i'm trying to make the placeable return to

it's original spot (after a delay) after the boss has tucked tail.


thanks!



               
               

               
            

Legacy_ehye_khandee

  • Hero Member
  • *****
  • Posts: 1415
  • Karma: +0/-0
Boss (Dragon Encounter)
« Reply #1 on: July 04, 2015, 04:07:11 pm »


               


how would i turn a placeable into a creature (boss) when the placeable is used




 


Make a USABLE placeable object with script attached to ON USE - when fires



// NOT TESTED - by GM_ODA 20150704

void main()
{
    location lHere = GetLocation(OBJECT_SELF);
    object oDragon = CreateObject(OBJECT_TYPE_CREATURE,"dragon_resref_here",lHere);
    SetLocalLocation(oDragon,"lHere",lHere);
    SetLocalString((oDragon,"Object4Remake",GetResRef(OBJECT_SELF));
    DestroyObject(OBJECT_SELF,0.2f);// assumes this object is NOT PLOT
}

replace the "dragon_resref_here" with your own dragon's resref (in double quotes).


 


 




then have the boss

disappear (EffectDisappear) once it's hp has been reduced by half?




 


 


For this you'll need to edit your module's 'on_damaged' script to detect the dragon as the target of damage and do a simple query comparing the dragon's HP after damage to what you know it's 'half HP' value to be, when this condition is met fire a script to remove the dragon or destroy it with any VFX you choose, and then...


 


 




Also, i'm trying to make the placeable return to

it's original spot (after a delay) after the boss has tucked tail.




 


the same script should end with ...



location lHere = GetLocalLocation(OBJECT_SELF,"lHere");
string sMakeMe = GetLocalString(OBJECT_SELF,"Object4Remake");
CreateObject(OBJECT_TYPE_PLACEABLE,sMakeMe,lHere);



Hope this helps.


               
               

               
            

Legacy_Wawmong

  • Jr. Member
  • **
  • Posts: 99
  • Karma: +0/-0
Boss (Dragon Encounter)
« Reply #2 on: July 04, 2015, 05:26:38 pm »


               

thanks! 1st script works, dragon appears (actually more like descends with EffectAppear, awesome). i don't know how to begin with the on_damaged event of the dragon in order to detect an hp reduction, should i try to edit the default, or create a new script?



               
               

               
            

Legacy_Wawmong

  • Jr. Member
  • **
  • Posts: 99
  • Karma: +0/-0
Boss (Dragon Encounter)
« Reply #3 on: July 04, 2015, 06:37:45 pm »


               

tried this bit and it compiles but doesn't seem to work...


 


int iHP = GetHitDice(oMe);

    int iDetectHP = 500;

    if (iHP >= iDetectHP)


               
               

               
            

Legacy_werelynx

  • Hero Member
  • *****
  • Posts: 1110
  • Karma: +0/-0
Boss (Dragon Encounter)
« Reply #4 on: July 04, 2015, 07:33:25 pm »


               

iHP >= iDetectHP should be iHP <= iDetectHP



               
               

               
            

Legacy_Wawmong

  • Jr. Member
  • **
  • Posts: 99
  • Karma: +0/-0
Boss (Dragon Encounter)
« Reply #5 on: July 04, 2015, 07:45:31 pm »


               

thanks werelynx but i got it working with GetPercentageHPLoss... but for some reason after the dragon escapes/new placeable gets created when used the new placeable doesn't get deleted but a dragon appears, if clicked a second time placeable gets deleted and another dragon appears. so it's working but a bit buggy...


 


can anyone help further please? thank you


 


this is what i have in the default on_damaged;


 


void main()

{

    object oDamager = GetLastDamager();

    object oMe=OBJECT_SELF;

    location lHere = GetLocalLocation(OBJECT_SELF,"lHere");

    string sMakeMe = GetLocalString(OBJECT_SELF,"Object4Remake");

    effect eVanish = EffectDisappear();

    int nHPBefore;

if(GetPercentageHPLoss(OBJECT_SELF)<25)

   {

      //ActionSpeakString("HELP! I am wounded!");

      CreateObject(OBJECT_TYPE_PLACEABLE,sMakeMe,lHere);

    DelayCommand(1.0, ApplyEffectToObject (DURATION_TYPE_TEMPORARY, eVanish, oMe));

    }



               
               

               
            

Legacy_Wawmong

  • Jr. Member
  • **
  • Posts: 99
  • Karma: +0/-0
Boss (Dragon Encounter)
« Reply #6 on: July 05, 2015, 01:25:11 am »


               

i got it working. instead of deleting and creating a placeable, i set and delete an int on the placeable so it can only be used every 5 minutes. it's not as immersive as a vanishing/reappearing dragon statue but it's a lot less complicated 'cause 'createobject' can't be used with a delay apparently.


 


thanks everyone.



               
               

               
            

Legacy_Wawmong

  • Jr. Member
  • **
  • Posts: 99
  • Karma: +0/-0
Boss (Dragon Encounter)
« Reply #7 on: July 05, 2015, 10:27:51 am »


               

i've been fooling around with this script in the onenter of a trigger; but it's only working the first time a PC activates it, enemy doesn't appear again after this ---> DelayCommand(120.0, SetLocalInt(oPC, "Anti_Spawn", 0));


 


void CommandMonster(object oMonster, object oPC)

{

    AssignCommand(oMonster, ActionMoveToObject(oPC, TRUE, 7.0f));

    AssignCommand(oMonster, ActionDoCommand(PlayVoiceChat(VOICE_CHAT_BATTLECRY1, OBJECT_SELF)));

    AssignCommand(oMonster, ActionDoCommand(ActionPlayAnimation(ANIMATION_FIREFORGET_TAUNT)));

    AssignCommand(oMonster, ActionDoCommand(ActionAttack(oPC, FALSE)));

}

/*void DestroyMonster(object oMonster)

{

    effect eDeath = EffectVisualEffect(VFX_IMP_PULSE_NEGATIVE);

    ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oMonster);

    DestroyObject(oMonster, 0.01f);

}   */


////////////////////////////////////////////////////////////

// The Main script

////////////////////////////////////////////////////////////

void main()

{

    object oPC = GetEnteringObject();


    //location lLocation = GetLocation(GetWaypointByTag("Jumpbosz1fl"));


    if (!GetIsPC(oPC)) return;


    else if (GetLocalInt(oPC, "Anti_Spawn")) return;


    else

    {

   SetLocalInt(oPC, "Anti_Spawn", 1);


    object oNest = GetWaypointByTag("bos_supz1fl");

     location lNest = GetLocation(oNest);

     object oMonster = CreateObject(OBJECT_TYPE_CREATURE, "bos_fmeph1",lNest);

     CommandMonster(oMonster, oPC);


       //AssignCommand(oPC, ActionJumpToLocation(lLocation));

       //DelayCommand(120.0f, DestroyMonster(oMonster));

         DelayCommand(120.0, SetLocalInt(oPC, "Anti_Spawn", 0));

        }


 


also curious about how i could make the enemy spawn a random chance.


 


thanks for any help