Aller au contenu

Photo

Kill Command


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

#1
MikauSchekzen

MikauSchekzen
  • Members
  • 4 messages
 Howdy, guys!

What I'm looking for is a simple kill command for DebugMode usage. One that instantly kills the targeted NPC.

I've searched far and wide, and there doesn't seem to be a literal "command", but maybe there's a hotkey for use in DebugMode or maybe even a script built-in the game that I can use that I don't know of yet.

Can anyone shed any light on the subject?

-Mikau

#2
kevL

kevL
  • Members
  • 4 056 messages
heya,

Going out on a limb here .. sorry, but it seems this is gonna take a bit of Toolset snafu ..

Open the toolset (you don't have to open a module), and from File menu select
New -> Script

put this malarky in there:

----don't include this line, include below----
void main()
{
object oTarget = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, CREATURE_ALIVE_TRUE, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_NOT_PC);
SetPlotFlag(oTarget, 0);
SetImmortal(oTarget, FALSE);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectDeath(FALSE, FALSE, TRUE, TRUE), oTarget, 0.0f);
}
----don't include this line, include above----

Rename the script, "kill", by clicking on the name in your Scripts panel a couple of times - then hit Enter.
Click 'Save & Compile' or press F7.
The "kill" script will end up in the MyDocs->NWN2->modules->temp0 folder. So *before closing the Toolset* surf there with Windows Explorer (sorry 'bout this if you're on a Mac ..) and copy the two files, kill.nss & kill.ncs to your MyDocs->NWN2->Override folder.

Close toolset (don't save). Load Game. Snuggle up to your enemy and type "rs kill" into the console (DebugMode).

This will slay the nearest enemy closest to the controlled PC (and give you XP for it!). Note that the parameters can be changed to target NEUTRAL creatures and/or not the closest one to the PC.


I tried using the regular console command "takedamage 10000" with an ogremagi targetted, but all that did was lambast my PC for 10000 hp (that was fun .. not). I also tried "takedamage 10000 c_ogremagi" and nothing happened. So if anybody knows of that script that's already in the game that can kill with a "runscript" command, please mention ..!

#3
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
i use chat commands actually which let me target just about anything...

This is my kill function. ( basically the same as the above but i do damage as well )
void CSLDMKill( object oTarget, object oDM = OBJECT_SELF, int bMassVersion = FALSE )
{
	if ((!VerifyDMKey(oTarget)) && (!VerifyAdminKey(oTarget)))//this command may not be used on dms or admins
	{
		SetPlotFlag(oTarget, FALSE);
		SetImmortal(oTarget, FALSE);
		ApplyEffectToObject(DURATION_TYPE_INSTANT, SupernaturalEffect(EffectDeath( FALSE, FALSE, TRUE )), oTarget);
		ApplyEffectToObject(DURATION_TYPE_INSTANT, SupernaturalEffect(EffectDamage(GetCurrentHitPoints(oTarget))), oTarget);
		
		SendMessageToPC(oDM, "" + GetName(oTarget)+" is now dead."+"");
	}
	
	
	if ( bMassVersion )
	{
		location lTarget = GetLocation( oTarget );
		object oAlly = GetFirstObjectInShape( SHAPE_SPHERE, RADIUS_SIZE_LARGE, lTarget, TRUE, OBJECT_TYPE_CREATURE);
		while ( GetIsObjectValid(oAlly) )
		{
			if ( !GetIsOwnedByPlayer( oAlly ) && !GetIsPC( oAlly ) )
			{
				SetPlotFlag(oAlly, FALSE);
				SetImmortal(oAlly, FALSE);
				ApplyEffectToObject(DURATION_TYPE_INSTANT, SupernaturalEffect(EffectDeath( FALSE, FALSE, TRUE )), oAlly);
				ApplyEffectToObject(DURATION_TYPE_INSTANT, SupernaturalEffect(EffectDamage(GetCurrentHitPoints(oAlly))), oAlly);
				SendMessageToPC(oDM, "" + GetName(oAlly)+" is now dead."+"");
			}
			oAlly = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_LARGE, lTarget, TRUE, OBJECT_TYPE_CREATURE);
		}
	
	}

}

I have this worked into chat commands which i use for debugging.

You can look up things like this in my Common Script Library which is available on the citadel

You just need to put the folders CSLLibrary, CSLChat, and ModuleBareEvents in your override, then you attach the chat event to your module. Doing just this will not affect anything but chat. After that you can select a target and type in "dm_kill", doing "dm_listdmcommands" will list all available commands. Things like dm_getinfo, dm_invis, dm_invuln, "dm_port there" are things i use a lot in testing. This all has been in use for a very long time ( some of the code goes back to early in NWN1 and simtools, but that is more of a distant ancestor at this point )

Modifié par painofdungeoneternal, 29 novembre 2010 - 07:44 .


#4
Firelife

Firelife
  • Members
  • 1 messages
Hows do I get it out of the Library?

#5
MokahTGS

MokahTGS
  • Members
  • 946 messages
 I would suggest that you use the Module Testing Toolkit, as it offers such fuctionality, plus a whole lot more.  You can install it into your override folder and then use the console to give you the MTT item in your inventory.