lfnetwork.com mark read register faq members calendar

Thread: Puppet Removal
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 03-14-2006, 05:47 PM   #1
Patriarch
Rookie
 
Join Date: Oct 2005
Posts: 77
Puppet Removal

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:

Code:
//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);
}
}
Patriarch is offline   you may: quote & reply,
Old 03-14-2006, 07:46 PM   #2
Dak Vesser
Rookie
 
Dak Vesser's Avatar
 
Join Date: Sep 2004
Location: Taspir 3
Posts: 170
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.


You may call me: King Kong-Xbox, PC related, Darth Cowboy-Jedi-Ninja'Nerd
Dak Vesser is offline   you may: quote & reply,
Old 03-15-2006, 07:22 AM   #3
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
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.

stoffe is offline   you may: quote & reply,
Old 03-16-2006, 10:58 AM   #4
Patriarch
Rookie
 
Join Date: Oct 2005
Posts: 77
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;-)


Code:
/* 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);

}
}

Last edited by Patriarch; 03-16-2006 at 05:55 PM.
Patriarch is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Puppet Removal

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:46 PM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.