Jump to content

Home

Theoretical Scripting Question (Puppets)


harIII

Recommended Posts

For the last few years now I've been under the influence that only party members are permitted to have puppets. Can anyone actually provide me with a little insight as to why that is? I'm just wonder if there is a weird and kinky way of getting around it because I've managed to be able to do some bizarre things by editing the nwscript file. What is actually preventing the pc from having a puppet?

Link to comment
Share on other sites

I believe I heard that oldflash did this in his/her Final Touch mod, and from what I've looked at (though there are a lot of files to look through, and I'm not sure what all is going on with these scripts for sure), it seems that it spawns via an armband that runs this script:

// pc_remote.nss

void main() 
{
object oPC = GetFirstPC();
vector vPos = GetPosition(oPC);
float fPCFace = GetFacing(oPC);
location lLoc = Location(vPos + AngleToVector(fPCFace) * 1.5f, fPCFace);
object oCurHide = GetItemInSlot( INVENTORY_SLOT_CARMOUR, oPC );
if ( !GetIsObjectValid( oCurHide ) && !GetIsObjectValid(GetObjectByTag("pc_remote"))) {
	object oRemote = CreateObject(OBJECT_TYPE_CREATURE, "pc_remote", lLoc);
	SetNPCAIStyle(oRemote, 13);
	object oNewHide = CreateItemOnObject( "p_rem_chk", oPC, 1, TRUE );
	DelayCommand(0.1,ActionEquipItem( oNewHide, INVENTORY_SLOT_CARMOUR ));}
else { if (GetIsObjectValid(GetObjectByTag("pc_remote"))) {
		DestroyObject(GetObjectByTag("pc_remote"), 0.0, TRUE); 
			if ( GetIsObjectValid( GetObjectByTag("p_rem_chk"))) {
			DelayCommand( 0.01, ActionUnequipItem( oCurHide ) );
			SetItemStackSize(GetObjectByTag("p_rem_chk"), 1);
			DelayCommand( 0.15, DestroyObject( GetObjectByTag("p_rem_chk"), 0.0f, FALSE, 0.0f, TRUE));} } }
}

 

And this is the heartbeat script used for "pc_remote.utc" (though that may not be the only one you'd want to look at):

// pc_remote.nss

void main() 
{
object oPC = GetFirstPC();
vector vPos = GetPosition(oPC);
float fPCFace = GetFacing(oPC);
location lLoc = Location(vPos + AngleToVector(fPCFace) * 1.5f, fPCFace);
object oCurHide = GetItemInSlot( INVENTORY_SLOT_CARMOUR, oPC );
if ( !GetIsObjectValid( oCurHide ) && !GetIsObjectValid(GetObjectByTag("pc_remote"))) {
	object oRemote = CreateObject(OBJECT_TYPE_CREATURE, "pc_remote", lLoc);
	SetNPCAIStyle(oRemote, 13);
	object oNewHide = CreateItemOnObject( "p_rem_chk", oPC, 1, TRUE );
	DelayCommand(0.1,ActionEquipItem( oNewHide, INVENTORY_SLOT_CARMOUR ));}
else { if (GetIsObjectValid(GetObjectByTag("pc_remote"))) {
		DestroyObject(GetObjectByTag("pc_remote"), 0.0, TRUE); 
			if ( GetIsObjectValid( GetObjectByTag("p_rem_chk"))) {
			DelayCommand( 0.01, ActionUnequipItem( oCurHide ) );
			SetItemStackSize(GetObjectByTag("p_rem_chk"), 1);
			DelayCommand( 0.15, DestroyObject( GetObjectByTag("p_rem_chk"), 0.0f, FALSE, 0.0f, TRUE));} } }
}

Link to comment
Share on other sites

Yes it is true old flash made a "puppet" for the PC but it was really just an ally set to follow you around that you also had to spawn in each new module. From the experimenting I've done it appears the the PC can't have a puppet simply because there is no spot for the PC on the puppet table which is hard coded.

 

While they're is workarounds to this it would require duplicating everysingle module as you would have to put a follower into the onenter script. Sorry to be the one to kill this.

 

-Supreme Kotor

Link to comment
Share on other sites

 

While they're is workarounds to this it would require duplicating everysingle module as you would have to put a follower into the onenter script. Sorry to be the one to kill this.

Right there works. And, HarIII, you are making a total conversion so it wouldn't be too out of the question to do that.

Link to comment
Share on other sites

My guess is it's the NPC integer. The player's is -1, while the party members' are 0 through 11. If the AssignPUP function was not set up to accept -1, then you wouldn't be able to give the PC a puppet. And I'd say not allowing for negative numbers is pretty much the default attitude. I doubt it was anything more than simple oversight.

Link to comment
Share on other sites

Well the reason I ask this is because I want to make a pet for the player. I'm debating having an option where it will be a companion you can have in your party or a puppet that follows you or someone else. I just wanted to see what exactly we know about this puppet system issue with the pc before I made any decisions.

Link to comment
Share on other sites

My guess is it's the NPC integer. The player's is -1, while the party members' are 0 through 11. If the AssignPUP function was not set up to accept -1, then you wouldn't be able to give the PC a puppet. And I'd say not allowing for negative numbers is pretty much the default attitude. I doubt it was anything more than simple oversight.

 

Looks like that might not be the only reason:

 

 

If you make a party member with a puppet the main character the puppet will disappear while they are. Maybe one of the reasons you're never offered the choice of making Bao-Dur the leader of the Dxun away team in TSL. :)
Link to comment
Share on other sites

  • 1 month later...

I didn't assign the puppet to PC. The drone is running a script in heartbeat and test the presence of an item in hidden slot, presence of pc and presence of drone (as should not be more than one drone in map).

object oCurHide = GetItemInSlot( INVENTORY_SLOT_CARMOUR, oPC );

if ( !GetIsObjectValid( oCurHide ) && !GetIsObjectValid(GetObjectByTag("pc_remote"))) 

As for the armband, it only test if the hidden item is equipped or not and change the state.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...