Author Topic: For the life of me.. cannot figure this out.  (Read 333 times)

Legacy_The Great Thief

  • Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
For the life of me.. cannot figure this out.
« on: September 10, 2010, 08:29:07 am »


               The situation is this: I have a "boss" type NPC that I'm trying to make work with heartbeats. Now, bear in mind that I KNOW heartbeats don't work in combat... So, therefore, I've created another NPC that spawns/dies with the boss mob. That creature's heartbeats are supposed to control the boss' non-attacking commands with heartbeats. I don't know, maybe it's a bad idea? 

For some reason, the script can never compile the oTarget's.

void main(){    ExecuteScript("nw_c2_default1", OBJECT_SELF);
    object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN);
if (IsInConversation(OBJECT_SELF) || GetIsInCombat()) return;
int nInt;nInt = d4();if (nInt==1)   {   oTarget = GetObjectByTag("RalictheDevourer");
   AssignCommand(oTarget, ClearAllActions());
   AssignCommand(oTarget, ActionMoveToObject(GetObjectByTag("ralicwp1")));
   AssignCommand(oTarget, ActionWait(1.0f));
   AssignCommand(oTarget, ActionSpeakString("*Ralic is breathing fire!*"));
   oCaster = GetObjectByTag("RalictheDevourer");
   oTarget = GetNearestObjectByTag("blueshaft");
   AssignCommand(oCaster, ActionCastSpellAtObject(SPELL_FIREBALL, oTarget, METAMAGIC_ANY, TRUE, 3, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
   oCaster = GetObjectByTag("RalictheDevourer");
   oTarget = GetObjectByTag("fbspot");
   AssignCommand(oCaster, ActionCastSpellAtLocation(SPELL_FIREBALL, GetLocation(oTarget), METAMAGIC_ANY, TRUE, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
   oCaster = GetObjectByTag("RalictheDevourer");
   oTarget = GetNearestObjectByTag("redshaft");
   AssignCommand(oCaster, ActionCastSpellAtObject(SPELL_FIREBALL, oTarget, METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, FALSE));
   }else if (nInt==2)   {   oTarget = GetObjectByTag("RalictheDevourer");
   AssignCommand(oTarget, ActionMoveToObject(GetObjectByTag("ralicwp2")));
   AssignCommand(oTarget, ActionWait(1.0f));
   AssignCommand(oTarget, ActionSpeakString("*Ralic is setting a trap!*"));
   oTarget = GetNearestObjectByTag("blueshaft");
   lTarget = GetLocation(oTarget);
   oTarget = CreateTrapAtLocation(TRAP_BASE_TYPE_AVERAGE_ACID, lTarget, 3.0);
   SetTrapActive(oTarget, TRUE);
   SetTrapDetectable(oTarget, TRUE);
   SetTrapDetectedBy(oTarget, oPC, TRUE);
   SetTrapDisarmable(oTarget, TRUE);
   SetTrapOneShot(oTarget, TRUE);
   SetTrapRecoverable(oTarget, FALSE);
   }else   {   oTarget = GetObjectByTag("RalictheDevourer");
   AssignCommand(oTarget, ActionAttack(oPC));
   }
}

 Any idea what I could do to make this work?
               
               

               
            

Legacy_The Great Thief

  • Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
For the life of me.. cannot figure this out.
« Reply #1 on: September 10, 2010, 08:29:40 am »


               And wow, these new forums suck. That looks very messy. Sorry!
               
               

               
            

Legacy_Genisys

  • Hero Member
  • *****
  • Posts: 961
  • Karma: +0/-0
For the life of me.. cannot figure this out.
« Reply #2 on: September 10, 2010, 01:06:49 pm »


               After:



void main()

{

object oTarget; //<<<This is missing..

ExecuteScript("nw_c2_default1", OBJECT_SELF);

               
               

               
            

Legacy_The Great Thief

  • Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
For the life of me.. cannot figure this out.
« Reply #3 on: September 10, 2010, 04:41:18 pm »


               Lilac Soul's stupid generator won't put anything there. >.> Any idea what I should put there to make this work? Sorry, kind of new to scripting. 

Edit: Maybe it's a lost cause. Everything ABOUT that script seems to be broken. Hm.
               
               

               


                     Modifié par The Great Thief, 10 septembre 2010 - 04:05 .
                     
                  


            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
For the life of me.. cannot figure this out.
« Reply #4 on: September 10, 2010, 05:24:02 pm »


               what you need to do is what Genisys also said...object oTarget; //
so if the script you wrote is in the npc controlling the boss. boss =oTagret then what you need to do is...

I took your script to the toolset you need...
void main()
{
object oTarget; //need to assign this as object
object oCaster; //need to assign this as object
location lTarget; //need to assign this as location

ExecuteScript("nw_c2_default1", OBJECT_SELF);

copy the above three lines  with // help and then it will compile.
I hope this helps, and answered you question.
               
               

               


                     Modifié par Greyfort, 10 septembre 2010 - 04:35 .
                     
                  


            

Legacy_The Great Thief

  • Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
For the life of me.. cannot figure this out.
« Reply #5 on: September 10, 2010, 05:58:48 pm »


               Well, it compiled at least. Thanks for that! ... Now I just have to figure out how to make him actually *do* the stuff I scripted. '<img'>
               
               

               
            

Legacy_420

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
For the life of me.. cannot figure this out.
« Reply #6 on: September 10, 2010, 06:23:51 pm »


               

The Great Thief wrote...

Now, bear in mind that I KNOW heartbeats don't work in combat...

Little correction: Heartbeat events do work during combat.

-420