Aller au contenu

Photo

For the life of me.. cannot figure this out.


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
The Great Thief

The Great Thief
  • Members
  • 16 messages
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?

#2
The Great Thief

The Great Thief
  • Members
  • 16 messages
And wow, these new forums suck. That looks very messy. Sorry!

#3
Genisys

Genisys
  • Members
  • 525 messages
After:



void main()

{

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

ExecuteScript("nw_c2_default1", OBJECT_SELF);


#4
The Great Thief

The Great Thief
  • Members
  • 16 messages
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 .


#5
Greyfort

Greyfort
  • Members
  • 234 messages
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 .


#6
The Great Thief

The Great Thief
  • Members
  • 16 messages
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. :o

#7
420

420
  • Members
  • 190 messages

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