Patriarch Posted March 14, 2006 Share Posted March 14, 2006 I was wondering if anybody knows How i can remove a puppet from ie the PUPPET_SENSORBALL slot? I've used this script to add the puppet: //pa_givepupgen.nss inspired by stoffe -mkb //Assigns puppet to a partymember #include "k_inc_glob_party" void main() { string sTemplate =GetScriptStringParameter();//tag of puppet int nNPC = GetScriptParameter(1);//NPC value see npc.2da int nPUP = GetScriptParameter(2);One of three puppet slots // int nDestroy a puppet in slot = GetScriptParameter(3); <<<<<<<How to add thids function? switch( nPUP ) { case 0: //remote nPUP = PUP_SENSORBALL; break; case 1: //another puppet nPUP = PUP_OTHER1; break; case 2: //another puppet nPUP = PUP_OTHER2; break; } object oOwner = GetObjectByTag(GetNPCTag(nNPC)); if (GetIsObjectValid(oOwner) && IsObjectPartyMember(oOwner)) { location lLoc = Location(GetPosition(oOwner) + AngleToVector(GetFacing(oOwner)) * 2.0, GetFacing(oOwner)-180.0); AddAvailablePUPByTemplate(nPUP, sTemplate); AssignPUP(nPUP, nNPC); object oPUP = SpawnAvailablePUP(nPUP, lLoc); AddPartyPuppet(nPUP, oPUP); SetNPCAIStyle(oPUP, NPC_AISTYLE_PARTY_SUPPORT); } } Link to comment Share on other sites More sharing options...
Dak Vesser Posted March 15, 2006 Share Posted March 15, 2006 Unfortunantly there's no funtion in the nwscript that removes the puppet out of the "puppet table". You can destroy it out of the active table in the game but it won't delete out of the base table. Link to comment Share on other sites More sharing options...
stoffe Posted March 15, 2006 Share Posted March 15, 2006 This is untested, but it is possible it might work: AddAvailablePUPByObject(PUP_SENSORBALL, OBJECT_INVALID); Though I guess Obsidian never saw the need to remove a creature from the Puppet table entirely, when you can just overwrite them if you need to put something new there. Link to comment Share on other sites More sharing options...
Patriarch Posted March 16, 2006 Author Share Posted March 16, 2006 Hey Thanks for the reply stoffe the script did'nt work unfortunatly It did enlighten my thinking however..... The problem is when i add a puppet and assign it to an owner ie Visas....Then if i do a little manipulation with some scripts i can get the puppet reassigned to ie Atton.... But somehow the puppet ALWAYS remembers it's initial owner.....(is a local boolean is set on the puppet or what? thought: Baos remote uses default hb to follow bao....so it must be a boolean or something.)....This means I assigned PUP to Atton but if Atton is not in the party and i add Visas the PUP gets spawn because it was initially spawned with Visas.... I've been doing some testing with regards to your heartbeat Puppet scripts. It work very well in most conditions....However when i add a second puppet using the same heartbeatscript(and the first is allready in the party) the puppet will just stay in place....I added some Globals to accomodate for that. I am a bit confused as how to use those protype functions so my sample is the long way...(stil n00b it works though)....But if the Puppet has a global to assign itself (in HB or UD>same if flag set OSI set)to its owner..... MY HB script....Requires initial spawning of a puppet....and a global number set;-) /* HB PUP script inspired by stoffe modified a bit by the Patriarch*/ #include "k_inc_generic" #include "k_inc_glob_party" void main() { int Check = GetGlobalNumber("powerpup_owner"); // create a variable called Check if (Check ==0){ int nNPC = GetGlobalNumber("powerpup_owner"); int nPUP = PUP_OTHER2; AssignPUP(nPUP, nNPC ); object oEnemy = GetNearestCreature( CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE); if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if (GetIsPuppet() && (GetIsObjectValid(GetPUPOwner()) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER) && !GetIsConversationActive() && !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) && GetCommandable() && (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0) && (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0)))) { ClearAllActions(); ActionFollowOwner(2.0); } } if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )) SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } if (Check ==1){ int nNPC = GetGlobalNumber("powerpup_owner"); int nPUP = PUP_OTH#includeER2; AssignPUP(nPUP, nNPC ); object oEnemy = GetNearestCreature( CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE); if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if (GetIsPuppet() && (GetIsObjectValid(GetPUPOwner()) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER) && !GetIsConversationActive() && !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) && GetCommandable() && (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0) && (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0)))) { ClearAllActions(); ActionFollowOwner(2.0); } } if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )) SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } if (Check ==2){ int nNPC = GetGlobalNumber("powerpup_owner"); int nPUP = PUP_OTHER2; AssignPUP(nPUP, nNPC ); object oEnemy = GetNearestCreature( CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE); if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if (GetIsPuppet() && (GetIsObjectValid(GetPUPOwner()) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER) && !GetIsConversationActive() && !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) && GetCommandable() && (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0) && (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0)))) { ClearAllActions(); ActionFollowOwner(2.0); } } if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )) SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } if (Check ==3){ int nNPC = GetGlobalNumber("powerpup_owner"); int nPUP = PUP_OTHER2; AssignPUP(nPUP, nNPC ); object oEnemy = GetNearestCreature( CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE); if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if (GetIsPuppet() && (GetIsObjectValid(GetPUPOwner()) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER) && !GetIsConversationActive() && !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) && GetCommandable() && (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0) && (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0)))) { ClearAllActions(); ActionFollowOwner(2.0); } } if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )) SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } if (Check ==4){ int nNPC = GetGlobalNumber("powerpup_owner"); int nPUP = PUP_OTHER2; AssignPUP(nPUP, nNPC ); object oEnemy = GetNearestCreature( CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE); if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if (GetIsPuppet() && (GetIsObjectValid(GetPUPOwner()) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER) && !GetIsConversationActive() && !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) && GetCommandable() && (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0) && (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0)))) { ClearAllActions(); ActionFollowOwner(2.0); } } if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )) SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } if (Check ==5){ int nNPC = GetGlobalNumber("powerpup_owner"); int nPUP = PUP_OTHER2; AssignPUP(nPUP, nNPC ); object oEnemy = GetNearestCreature( CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE); if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if (GetIsPuppet() && (GetIsObjectValid(GetPUPOwner()) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER) && !GetIsConversationActive() && !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) && GetCommandable() && (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0) && (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0)))) { ClearAllActions(); ActionFollowOwner(2.0); } } if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )) SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } if (Check ==6){ int nNPC = GetGlobalNumber("powerpup_owner"); int nPUP = PUP_OTHER2; AssignPUP(nPUP, nNPC ); object oEnemy = GetNearestCreature( CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE); if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if (GetIsPuppet() && (GetIsObjectValid(GetPUPOwner()) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER) && !GetIsConversationActive() && !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) && GetCommandable() && (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0) && (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0)))) { ClearAllActions(); ActionFollowOwner(2.0); } } if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )) SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } if (Check ==7){ int nNPC = GetGlobalNumber("powerpup_owner"); int nPUP = PUP_OTHER2; AssignPUP(nPUP, nNPC ); object oEnemy = GetNearestCreature( CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE); if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if (GetIsPuppet() && (GetIsObjectValid(GetPUPOwner()) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER) && !GetIsConversationActive() && !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) && GetCommandable() && (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0) && (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0)))) { ClearAllActions(); ActionFollowOwner(2.0); } } if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )) SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } if (Check ==8){ int nNPC = GetGlobalNumber("powerpup_owner"); int nPUP = PUP_OTHER2; AssignPUP(nPUP, nNPC ); object oEnemy = GetNearestCreature( CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE); if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if (GetIsPuppet() && (GetIsObjectValid(GetPUPOwner()) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER) && !GetIsConversationActive() && !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) && GetCommandable() && (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0) && (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0)))) { ClearAllActions(); ActionFollowOwner(2.0); } } if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )) SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } if (Check ==9){ int nNPC = GetGlobalNumber("powerpup_owner"); int nPUP = PUP_OTHER2; AssignPUP(nPUP, nNPC ); object oEnemy = GetNearestCreature( CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE); if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if (GetIsPuppet() && (GetIsObjectValid(GetPUPOwner()) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER) && !GetIsConversationActive() && !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) && GetCommandable() && (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0) && (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0)))) { ClearAllActions(); ActionFollowOwner(2.0); } } if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )) SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } if (Check ==10){ int nNPC = GetGlobalNumber("powerpup_owner"); int nPUP = PUP_OTHER2; AssignPUP(nPUP, nNPC ); object oEnemy = GetNearestCreature( CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE); if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if (GetIsPuppet() && (GetIsObjectValid(GetPUPOwner()) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER) && !GetIsConversationActive() && !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) && GetCommandable() && (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0) && (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0)))) { ClearAllActions(); ActionFollowOwner(2.0); } } if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )) SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } if (Check ==11){ int nNPC = GetGlobalNumber("powerpup_owner"); int nPUP = PUP_OTHER2; AssignPUP(nPUP, nNPC ); object oEnemy = GetNearestCreature( CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, CREATURE_TYPE_IS_ALIVE, TRUE); if (!GN_GetSpawnInCondition(SW_FLAG_AI_OFF)) { if (GetIsPuppet() && (GetIsObjectValid(GetPUPOwner()) && (GetCurrentAction(OBJECT_SELF) != ACTION_MOVETOPOINT) && (GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOWOWNER) && !GetIsConversationActive() && !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) && GetCommandable() && (GetDistanceBetween2D(OBJECT_SELF, GetPUPOwner()) > 3.0) && (!GetIsObjectValid(oEnemy) || (GetDistanceBetween(oEnemy, OBJECT_SELF) > 20.0)))) { ClearAllActions(); ActionFollowOwner(2.0); } } if (GN_GetSpawnInCondition( SW_FLAG_EVENT_ON_HEARTBEAT )) SignalEvent(OBJECT_SELF, EventUserDefined(1001)); } if (Check ==14){ ExecuteScript("pa_dest_pup", OBJECT_SELF); AddAvailablePUPByObject( PUP_OTHER1, OBJECT_INVALID); AddAvailablePUPByObject( PUP_OTHER2, OBJECT_INVALID); } } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.