Jump to content

Home

Manipulating Multiple Minions?


darkwarrior

Recommended Posts

Ok, heres my problem.

 

I'm creating a scene where Sion walks down the bridge to the ravager. I want him to be shadowed by 4 Sith Assassins.

 

Is there any way to manipulate them all despite spawning them from a single utc?

 

Right now, from pre-existing scripts I've been reading, this is the only way I can see.

 

CreateObject(1, "g_dark_app01m001", GetLocation(GetObjectByTag(("sp_sith" + IntToString(5)), 0)), 0);


		CreateObject(1, "g_dark_app01m001", GetLocation(GetObjectByTag(("sp_sith" + IntToString(6)), 0)), 0);

 

This though doesn't seem to do anything. If I call it in the initialisation along with Nihilus and Sion, it somehow spawns 6 of them instead of 2 and only affects one which I assume is the first spawned.

 

So it will affect people with that tag, but only the first one.

 

I mean its not a big thing but its optimisation as well. I'd love to have the zombies lining the runway to all bow as Sion passes but it will only affect the first one that the module loaded and not the rest. To do it I'd have to have duplicate UTC's for each one as I do now for the 2 zombies near Nihilus that are killed.

 

Any help?

Link to comment
Share on other sites

Ok, heres my problem.

 

I'm creating a scene where Sion walks down the bridge to the ravager. I want him to be shadowed by 4 Sith Assassins.

 

Is there any way to manipulate them all despite spawning them from a single utc?

 

Right now, from pre-existing scripts I've been reading, this is the only way I can see.

 

If you do it all in the same script execution, you could store the object references when you spawn them and do something like:

 

void main() {
   //                                                                               X    Y    Z   Facing
   object oAss1 = CreateObject(OBJECT_TYPE_CREATURE, "sith_ass",  Location(Vector(0.0, 0.0, 0.0), 0.0));
   object oAss2 = CreateObject(OBJECT_TYPE_CREATURE, "sith_ass",  Location(Vector(0.0, 0.0, 0.0), 0.0));
   object oAss3 = CreateObject(OBJECT_TYPE_CREATURE, "sith_ass",  Location(Vector(0.0, 0.0, 0.0), 0.0));
   object oAss4 = CreateObject(OBJECT_TYPE_CREATURE, "sith_ass",  Location(Vector(0.0, 0.0, 0.0), 0.0));
   object oSion = CreateObject(OBJECT_TYPE_CREATURE, "darthsion", Location(Vector(0.0, 0.0, 0.0), 0.0));

   AssignCommand(oAss1, ActionMoveToObject(GetObjectByTag("WP_ASS1")));
   AssignCommand(oAss2, ActionMoveToObject(GetObjectByTag("WP_ASS2")));
   AssignCommand(oAss3, ActionMoveToObject(GetObjectByTag("WP_ASS3")));
   AssignCommand(oAss4, ActionMoveToObject(GetObjectByTag("WP_ASS4")));
   AssignCommand(oSion, ActionMoveToObject(GetObjectByTag("WP_SION1")));
}

 

If you don't do it all in one script execution, you'll either have to use the second number parameter to GetObjectByTag() to get each of them, like:

   object oAss1 = GetObjectByTag("sith_ass");
   object oAss2 = GetObjectByTag("sith_ass", 1);
   object oAss3 = GetObjectByTag("sith_ass", 2);
   object oAss4 = GetObjectByTag("sith_ass", 3);

 

...or you'll have to use separate templates for each assassin for the best control.

 

If you do the bowing and kneeling by dialog animations you probably have to use separate templates with differing tags since I don't think you can specify an iterator there, only the tag of the creature to do the animation. If I remember correctly Obsidian used a separate template for each Assassin in the welcoming committee outside the Trayus Academy, for example.

Link to comment
Share on other sites

Well I guess individual UTCs isnt an obscene idea then, just not a brilliant one.

 

What's wrong with using individual templates? It's the easiest and most efficient way if you need more precise control (though using that word when speaking of NWScript is an oxymoron since it's notoriously unreliable) over several creatures.

 

If you give them tags with a numeric ending you can loop through them just as easily as you can creatures with identical tags to issue mass orders. :)

Link to comment
Share on other sites

The way the script is though, it only works in the first half. I guess that might be suitable, they'd only bow as he walks there. After that, conversation takes over and it goes into a subscript.

 

It doesn't recognise the tags then, oObjectTroop for example, unless I reinitialise them.

Link to comment
Share on other sites

Use the DelayCommand function. You can also specify a delay on the .dlg file before the next reply. Set the converstaion node to unskippable and set a delay in the delay box.

 

Here's amother script you can use to issue commands to all objects with the same tags in an area:

void main()
{
object oArea = GetArea(OBJECT_SELF);   
object oTarget=GetFirstObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE);
while(GetIsObjectValid(oTarget))
  {
   if(GetTag(oTarget) == "my_npc" )
        {
//flourish weapon or do whatever else
           DelayCommand( 1.5,CreatureFlourishWeapon(oTarget));
        }
oTarget = GetNextObjectInArea(GetArea(OBJECT_SELF), OBJECT_TYPE_CREATURE);
       }
}

 

Note that it would be easier to help you if you posted the scripts you are using.

Link to comment
Share on other sites



void main() {
int nParam1 = GetScriptParameter(1);

object oDarthSion = GetObjectByTag("DarthSion", 0);
object oNihilus = GetObjectByTag("DarthNihilus", 0);
//object oAssassin = GetObjectByTag("SithAssassin", 0);
//object oAssassin2 = GetObjectByTag("SithAssassin", 0);

object oArea = GetArea(OBJECT_SELF);


vector vPosition = Vector(-185.5, 41.7241401672363, 12.3370018005371);
//vector aPosition = Vector(-183.5, 39.7241401672363, 12.3370018005371);
//vector a2Position = Vector(-183.5, 43.7241401672363, 12.3370018005371);

vector vPosition2 = Vector(-215.175094604492, 41.7241401672363, 12.3370018005371);
//vector aPosition2 = Vector(-213.175094604492, 39.7241401672363, 12.3370018005371);
//vector a2Position2 = Vector(-213.175094604492, 43.7241401672363, 12.3370018005371);

  	float fAngle = 180.0;

location locTarget = Location(vPosition, fAngle);	
//location alocTarget = Location(aPosition, fAngle);	
//location a2locTarget = Location(aPosition, fAngle);

location locTarget2 = Location(vPosition2, fAngle);
//location alocTarget2 = Location(aPosition2, fAngle);
//location a2locTarget2 = Location(aPosition2, fAngle);


switch (nParam1) {
	case 0:
		SetGlobalFadeIn(0.4, 2.0, 0.0, 0.0, 0.0);
		SetLockOrientationInDialog(oDarthSion, 1);
		SetLockOrientationInDialog(oNihilus, 1);
		ClearAllActions();
		ActionPauseConversation();
		{
	// 2 = mus_kreiadark
	// 3 = Sion Theme
	// 4 = Nihilus Theme

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



	// Spawn Minions


		object oZombie1 = CreateObject(1, "g_dark_app01m001", GetLocation(GetObjectByTag(("sp_sith" + IntToString(5)), 0)), 0);
		object oZombie2 = CreateObject(1, "g_dark_app01m002", GetLocation(GetObjectByTag(("sp_sith" + IntToString(6)), 0)), 0);

		// Back Camera
		DelayCommand(0.0, SetDialogPlaceableCamera(27));

		// Overhead Camera
		DelayCommand(6.0, SetDialogPlaceableCamera(26));

		// Face Camera
		DelayCommand(10.0, SetDialogPlaceableCamera(29));

		// Bridge Camera
		DelayCommand(14.0, SetDialogPlaceableCamera(18));




	// Set Walking (Sion Approach Nihilus) Camera 27

		DelayCommand(0.0, AssignCommand(oDarthSion, ActionMoveToLocation(GetLocation(GetObjectByTag("wp_sion", 0)), 0)));

		//DelayCommand(0.0, AssignCommand(oAssassin, ActionMoveToLocation(GetLocation(GetObjectByTag("wp_sion", 0)), 0)));
		//DelayCommand(0.0, AssignCommand(oAssassin2, ActionMoveToLocation(GetLocation(GetObjectByTag("wp_sion", 0)), 0)));

	// Jump 1 - Overhead Camera 26

		DelayCommand(6.0, AssignCommand(oDarthSion, JumpToLocation(locTarget))); 

		//DelayCommand(7.0, AssignCommand(oAssassin, JumpToLocation(alocTarget)));
		//DelayCommand(7.0, AssignCommand(oAssassin2, JumpToLocation(a2locTarget)));


		DelayCommand(6.0, AssignCommand(oDarthSion, ActionMoveToLocation(GetLocation(GetObjectByTag("wp_sion", 0)), 0)));

		//DelayCommand(7.0, AssignCommand(oAssassin, ActionMoveToLocation(GetLocation(GetObjectByTag("wp_sion", 0)), 0)));
		//DelayCommand(7.0, AssignCommand(oAssassin2, ActionMoveToLocation(GetLocation(GetObjectByTag("wp_sion", 0)), 0)));

	// Jump 2 - Camera 18

		DelayCommand(14.0, AssignCommand(oDarthSion, JumpToLocation(locTarget2))); 

		//DelayCommand(15.0, AssignCommand(oAssassin, JumpToLocation(alocTarget2))); 
		//DelayCommand(15.0, AssignCommand(oAssassin2, JumpToLocation(a2locTarget2)));

		DelayCommand(14.0, AssignCommand(oDarthSion, ActionMoveToLocation(GetLocation(GetObjectByTag("wp_sion", 0)), 0)));


		//DelayCommand(15.0, AssignCommand(oAssassin, ActionMoveToLocation(GetLocation(GetObjectByTag("wp_sion", 0)), 0)));
		//DelayCommand(15.0, AssignCommand(oAssassin2, ActionMoveToLocation(GetLocation(GetObjectByTag("wp_sion", 0)), 0)));




		//DelayCommand(22.0, AssignCommand(oAssassin, ClearAllActions()));
		//DelayCommand(24.0, AssignCommand(oAssassin2, ClearAllActions()));
		//DelayCommand(22.0, AssignCommand(oAssassin, ActionPlayAnimation(4, 1.0, 5.0)));
		//DelayCommand(24.0, AssignCommand(oAssassin2, ActionPlayAnimation(4, 1.0, 5.0)));


		DelayCommand(15.0, AssignCommand(oZombie1, ActionMoveToLocation(GetLocation(GetObjectByTag("wp_sith5", 0)), 0)));

		DelayCommand(15.2, AssignCommand(oZombie1, ActionDoCommand(SetFacing(GetFacing(GetObjectByTag("wp_sith5", 0))))));

		DelayCommand(15.0, AssignCommand(oZombie2, ActionMoveToLocation(GetLocation(GetObjectByTag("wp_sith6", 0)), 0)));

		DelayCommand(15.2, AssignCommand(oZombie2, ActionDoCommand(SetFacing(GetFacing(GetObjectByTag("wp_sith6", 0))))));



	// Play Minion Animation

		DelayCommand(20.0, AssignCommand(oZombie1, ActionPlayAnimation(4, 1.0, 5.0)));

		DelayCommand(20.0, AssignCommand(oZombie2, ActionPlayAnimation(4, 1.0, 5.0)));



		DelayCommand(21.0, SetDialogPlaceableCamera(21));

		DelayCommand(25.0, SetDialogPlaceableCamera(19));				

		DelayCommand(30.0, ActionResumeConversation());
		}

		break;

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

	case 1:
		AssignCommand(oDarthSion, ActionMoveToLocation(GetLocation(GetObjectByTag("wp_sion2", 0)), 0));
		break;

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

	case 2:
		ActionPauseConversation();

		MusicBattlePlay(oArea); 

		DelayCommand(2.6, AssignCommand(oDarthSion, ActionMoveToObject(GetObjectByTag("DarthNihilus", 0), 1, 8.0)));

		DelayCommand(2.6, AssignCommand(oNihilus, ActionDoCommand(SetFacing(0.0))));		

		DelayCommand(2.8, SetLightsaberPowered(oDarthSion, 1, 1, 1));  			 //Activate Lightsaber

		DelayCommand(2.8, SetDialogPlaceableCamera(21));

		DelayCommand(3.0, AssignCommand(oNihilus, ActionPlayAnimation(121, 1.0, 21.0))); //Play Force Choke Animation

		DelayCommand(3.2, SetDialogPlaceableCamera(24));
		{


	// Define Effects

		effect efPush = EffectForcePushTargeted(GetLocation(GetObjectByTag("oNihilus", 0)), 0);

		efPush = EffectLinkEffects(efPush, EffectVisualEffect(1014, 0));

		effect efBeam = EffectBeam(2029, oNihilus, 0, 0);   // Drain Life
		effect efBeam2 = EffectBeam(2038, oNihilus, 0, 0);  // Force Lightning
		effect efBeam3 = EffectBeam(2026, oNihilus, 0, 0);  // Field Tentacle

		effect efVisual = EffectVisualEffect(1009, 0);	    // Force Drain
		effect efVisual2 = EffectVisualEffect(1010, 0);	    // Force Armor



//ATTACK//////////////////////////////////


		DelayCommand(3.8, AssignCommand(oDarthSion, ActionPlayAnimation(21, 1.0, -1.0)));   // Play Pain Animation
		DelayCommand(3.5, AssignCommand(GetObjectByTag("DarkJedi", 0), ActionPlayAnimation(18, 1.0, -1.0)));	// Play Horror Animation

	// Call Effects	(Beam Type)

		DelayCommand(3.5, ApplyEffectToObject(1, efBeam, oDarthSion, 18.0));
		DelayCommand(3.5, ApplyEffectToObject(1, efBeam2, oDarthSion, 18.0));
		DelayCommand(3.5, ApplyEffectToObject(1, efBeam3, oDarthSion, 18.0));

		DelayCommand(3.5, ApplyEffectToObject(1, efBeam3, GetObjectByTag("DarkJedi", 0),  5.0));
		DelayCommand(3.5, ApplyEffectToObject(1, efBeam2, GetObjectByTag("DarkJedi2", 0), 5.0));

		DelayCommand(5.5, SetDialogPlaceableCamera(30));

	// Call Effects	(Visual)

		DelayCommand(3.5, ApplyEffectToObject(1, efVisual, oDarthSion, 18.0));
		DelayCommand(3.5, ApplyEffectToObject(1, efVisual2, oNihilus, 5.0));

		DelayCommand(3.5, ApplyEffectToObject(1, efVisual, GetObjectByTag("DarkJedi", 0), 5.5));
		DelayCommand(3.5, ApplyEffectToObject(1, efVisual, GetObjectByTag("DarkJedi2", 0), 5.5));

	// Activate Force Ability


		DelayCommand(3.9, ApplyEffectToObject(1, EffectForcePushed(), GetObjectByTag("DarkJedi", 0), 0.9));    // Force Push Minion
		DelayCommand(4.0, ApplyEffectToObject(1, EffectForcePushed(), GetObjectByTag("DarkJedi2", 0), 0.9));   // Force Push Minion
		DelayCommand(7.5, SetDialogPlaceableCamera(24));
		DelayCommand(9.5, SetDialogPlaceableCamera(19));

		DelayCommand(10.5, ApplyEffectToObject(1, efPush, oDarthSion, 1.5));			
		DelayCommand(11.1, ApplyEffectToObject(1, EffectCrush(), oDarthSion, 2.5));
		DelayCommand(14.1, ApplyEffectToObject(1, EffectForcePushed(), oDarthSion, 0.0));

		DelayCommand(13.0, SetDialogPlaceableCamera(24));


		DelayCommand(14.8, AssignCommand(oDarthSion, ActionPlayAnimation(26, 1.0, (-1.0))));


	// Minion Death

		DelayCommand(7.0, AssignCommand(GetObjectByTag("DarkJedi", 0), ClearAllActions()));
		DelayCommand(7.1, AssignCommand(GetObjectByTag("DarkJedi", 0), ActionPlayAnimation(26, 1.0, (-1.0))));

		DelayCommand(7.0, AssignCommand(GetObjectByTag("DarkJedi2", 0), ClearAllActions()));
		DelayCommand(7.1, AssignCommand(GetObjectByTag("DarkJedi2", 0), ActionPlayAnimation(26, 1.0, (-1.0))));


	// Sion Death
		DelayCommand(18.0, SetDialogPlaceableCamera(21));
		DelayCommand(20.0, SetDialogPlaceableCamera(25));

		DelayCommand(15.0, ApplyEffectToObject(2, EffectDeath(0, 1, 0), oDarthSion, 0.0));


//END OF ATTACK///////////////////////////

		DelayCommand(11.0, SetLightsaberPowered(oDarthSion, 1, 0, 0));		// Deactivate Lightsaber
		//DelayCommand(8.5, ApplyEffectToObject(0, EffectVisualEffect(6002, 0), GetFirstPC(), 9.0));
		DelayCommand(23.0, AssignCommand(oNihilus, ActionDoCommand(SetFacing(180.00))));
		DelayCommand(25.0, SetDialogPlaceableCamera(24));

		DelayCommand(27.0, AssignCommand(oDarthSion, ActionMoveToObject(GetObjectByTag("Kreia", 0), 0, 6.0)));

		DelayCommand(30.0, ClearAllActions());

		DelayCommand(30.6, SetDialogPlaceableCamera(18));

		DelayCommand(32.0, AssignCommand(oDarthSion, ActionMoveToObject(GetObjectByTag("Kreia", 0), 0, 6.0)));

		DelayCommand(35.0, SetDialogPlaceableCamera(26));

		DelayCommand(38.0, ClearAllActions());
		DelayCommand(34.0, ActionResumeConversation());
		DelayCommand(38.0, SetGlobalFadeOut(0.1, 2.0, 0.0, 0.0, 0.0));

		}
		break;

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

	case 3:
		break;

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

	case 4:
		ExecuteScript("a_cleanup", OBJECT_SELF, 0xFFFFFFFF);
		DelayCommand(0.2, StartNewModule("601DAN", "", "", "", "", "", "", ""));
		break;

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

	case 5:
		break;
}
}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...