Rowboat phenotype script (RESOLVED)!

Hi everyone,

I have downloaded some new phenotypes (rowboat and swimming).

Now I am trying to create scripts to use on a widget(s) to make the PC change phenotype to rowing (later make one for swimming using this script once fixed as a template).

This is my script but I get an error on it. Don’t understand how to fix it. This script below is my best attempt at scripting this using a mix of other scripts. I think it is close…I think:

#include "nw_i0_spells"
#include "x2_inc_toollib"


void main()
{


object oPC =GetItemActivator();
int irowboat=GetLocalInt(oPC,"rowboat");


SetPhenoType(43,oPC);
    }

SetCreatureTailType(9970, oPC);

object ooar = CreateItemOnObject ("oar", oPC);
DelayCommand(0.1, AssignCommand(oPC, ActionEquipItem(ooar, INVENTORY_SLOT_RIGHTHAND)));
     }
   {
DelayCommand(1.0,SetCameraHeight(oPC,0.45));
SpeakString("rowboat",TALKVOLUME_SILENT_TALK);
SetActionMode(oPC, ACTION_MODE_STEALTH, TRUE);
SetLocalInt(oPC,"rowboat",1);


        }
      else
        {
          FloatingTextStringOnCreature("You must have a humanoid appeareance to row a boat !" ,oPC);
          }
        }


 if (irowboat==1)
    {

     SetLocalInt(oPC,"rowboat",0);
     SpeakString("debout",TALKVOLUME_SILENT_TALK);
     SetPhenoType(0,oPC);

     }
}

I get this error:


How do I fix this. That " SetCreatureTailType(9970, oPC); " is a legitimate variable is it not? It references the correct tail model number of the boat I have on that line.

Just took a quick look at your script. I’m sorry to say it looks really weird. Why do you have a curly bracket after SetPhenoType(43,oPC); ? It’s not an “if statement” so…
You do understand when you need curly brackets, right? If you don’t then…well…

EDIT: I took your script into Notpad++ to make it more readabl, but it got even weirder when I did that.

EDIT2: To me, it looks like you want some kind of “if statements” where there are none…

#include "nw_i0_spells"
#include "x2_inc_toollib"


void main()
{


object oPC =GetItemActivator();
int irowboat=GetLocalInt(oPC,"rowboat");


SetPhenoType(43,oPC);

    } //What the heck is this? What do you want to do here?

		SetCreatureTailType(9970, oPC);

		object ooar = CreateItemOnObject ("oar", oPC);
		DelayCommand(0.1, AssignCommand(oPC, ActionEquipItem(ooar, INVENTORY_SLOT_RIGHTHAND)));
    }
	
   
	{ //And again here? I mean...what?
   
		DelayCommand(1.0,SetCameraHeight(oPC,0.45));
		SpeakString("rowboat",TALKVOLUME_SILENT_TALK);
		SetActionMode(oPC, ACTION_MODE_STEALTH, TRUE);
		SetLocalInt(oPC,"rowboat",1);


    }
      
	else  //and then all of a sudden there's an "else" here even though there was no "if" before it...
    {
        FloatingTextStringOnCreature("You must have a humanoid appeareance to row a boat !" ,oPC);
    }
    
	} //And then, this makes no sense at all


	if (irowboat==1) //Now this here makes sense, I think
    {

		SetLocalInt(oPC,"rowboat",0);
		SpeakString("debout",TALKVOLUME_SILENT_TALK);
		SetPhenoType(0,oPC);

     }
	 
}

First thing I can see is that Void main code starts at line 6 with the first { and end at line 14 with the next }… after that nor me nor the system knows what to do with that…

You’ll have to paste in more sensefull way.

Sigh…it’s me again trying to splice two scripts I had to make this…sorry. But thanks for the help bud.

Alright. What does the two scripts you try to splice together look like?

I redid the rowboat script below…got another error…ugh…trying my best to do this…you are right I suck at this scripting…trying though…lol. I will post the two scripts below my new script I just tried and failed again at:

#include "x2_inc_toollib"

 void main()
{


object oPC =GetItemActivator();
int irowboat=GetLocalInt(oPC,"rowboat");

if (GetLocalInt(oPC,"stop")==1)
{
  return;
}


if (irowboat==0)
  {

if( GetAppearanceType(oPC)<7)
     {
DelayCommand(1.0,SetCameraHeight(oPC,0.45));
SetPhenoType(45,oPC);
SetCreatureTailType(9970, oPC)
object ooar = CreateItemOnObject ("oar", oPC)
DelayCommand(0.1, AssignCommand(oPC, ActionEquipItem(ooar, INVENTORY_SLOT_RIGHTHAND)));
     }

DelayCommand(1.0,SetCameraHeight(oPC,0.45));
SpeakString("rowboat",TALKVOLUME_SILENT_TALK);
SetLocalInt(oPC,"rowboat",1);

      {   }
      else
        {
          FloatingTextStringOnCreature("You must have a humanoid appeareance to row a boat !" ,oPC);
          }
        }


 if (irowboat==1)
    {

     SetLocalInt(oPC,"rowboat",0);
     SpeakString("debout",TALKVOLUME_SILENT_TALK);
     SetPhenoType(0,oPC);

     }
}

Will post the two scripts. The first one is from a crawling animation I have on a widget I found a long time ago on the vault:

#include "nw_i0_spells"

void RemoveAllEffect(object oPJ)
  {
    effect eLoop=GetFirstEffect(oPJ);

while (GetIsEffectValid(eLoop))
  {
      RemoveEffect(oPJ, eLoop);
      eLoop=GetNextEffect(oPJ);
  }
}



void main()
{
effect eLent=EffectMovementSpeedDecrease(60);
effect eSuperLent=ExtraordinaryEffect(eLent);

effect eSilent=EffectSkillIncrease(SKILL_MOVE_SILENTLY,15);
effect eSuperSilent=ExtraordinaryEffect(eSilent);

effect eHide=EffectSkillIncrease(SKILL_HIDE,15);
effect eSuperHide=ExtraordinaryEffect(eHide);

effect eAc2=EffectACIncrease(2,AC_DODGE_BONUS,DAMAGE_TYPE_PIERCING);
effect eSuperAc2=ExtraordinaryEffect(eAc2);

effect eWeakSlash=EffectDamageImmunityDecrease(DAMAGE_TYPE_SLASHING,50);
effect eSuperWeakSlash=ExtraordinaryEffect(eWeakSlash);

effect eWeakBludge=EffectDamageImmunityDecrease(DAMAGE_TYPE_BLUDGEONING,50);
effect eSuperWeakBludge=ExtraordinaryEffect(eWeakBludge);



object oPC =GetItemActivator();
int iRampe=GetLocalInt(oPC,"rampe");


if (GetLocalInt(oPC,"stop")==1)
{
  return;
}

if (iRampe==0)
  {

if( GetAppearanceType(oPC)<7)
     {
DelayCommand(1.0,SetCameraHeight(oPC,0.45));
SetPhenoType(20,oPC);
SpeakString("rampe",TALKVOLUME_SILENT_TALK);
SetActionMode(oPC, ACTION_MODE_STEALTH, TRUE);

SetFootstepType(FOOTSTEP_TYPE_SOFT);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eSuperLent,oPC);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eSuperHide,oPC);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eSuperSilent,oPC);

ApplyEffectToObject(DURATION_TYPE_PERMANENT,eSuperAc2,oPC);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eSuperWeakSlash,oPC);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eSuperWeakBludge,oPC);

SetLocalInt(oPC,"rampe",1);


        }
      else
        {
          FloatingTextStringOnCreature("You must have a humanoid appeareance to crawl !" ,oPC);
          }
        }


 if (iRampe==1)
    {

     SetLocalInt(oPC,"rampe",0);
     SpeakString("debout",TALKVOLUME_SILENT_TALK);
     SetPhenoType(0,oPC);
     SetFootstepType(FOOTSTEP_TYPE_DEFAULT);
     RemoveSpecificEffect(EFFECT_TYPE_AC_INCREASE,oPC);
     RemoveSpecificEffect(EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE,oPC);
     RemoveSpecificEffect(EFFECT_TYPE_SKILL_INCREASE,oPC);
     RemoveSpecificEffect(EFFECT_TYPE_MOVEMENT_SPEED_DECREASE,oPC);
     SetActionMode(oPC, ACTION_MODE_STEALTH, FALSE);
     }
}

This second one is from the test module OnEnterArea script of the rowboat animation I downloaded from. I need it to work from a widget…not on entering an area.

#include "x2_inc_toollib"

void main()
{

object oPC = GetEnteringObject();

TLChangeAreaGroundTilesEx(GetArea(oPC), 401, 2.2f);

if (GetPhenoType(oPC) == 2)
    {
    SetPhenoType(44, oPC);
    }
else
    {
    SetPhenoType(43, oPC);
    }

SetCreatureTailType(9970, oPC);

object ooar = CreateItemOnObject ("oar", oPC);
DelayCommand(0.1, AssignCommand(oPC, ActionEquipItem(ooar, INVENTORY_SLOT_RIGHTHAND)));

}

Not sure if I need each include from each script?

See…I tried to blend both…the crawl animation gives me what I need but I need to make the rowboat work from a widget but not from an on enter area as the second script does. :frowning:

I tried to make your script a bit more readable, and maybe it compiles now? I have no idea about the content of the script though, as I haven’t yet looked at that.

#include "x2_inc_toollib"

void main()
{


object oPC =GetItemActivator();
int irowboat=GetLocalInt(oPC,"rowboat");

if (GetLocalInt(oPC,"stop")==1) return;

	if (irowboat==0)
	{

		if( GetAppearanceType(oPC)<7)
		{
			DelayCommand(1.0,SetCameraHeight(oPC,0.45)); //Here you set the camera height.
			SetPhenoType(45,oPC);
			SetCreatureTailType(9970, oPC);
			object ooar = CreateItemOnObject("oar", oPC);
			DelayCommand(0.1, AssignCommand(oPC, ActionEquipItem(ooar, INVENTORY_SLOT_RIGHTHAND)));
		}

		DelayCommand(1.0,SetCameraHeight(oPC,0.45)); //So, if your AppearanceType is less than 7, you set the camera height again. Should this be an "else statement" perhaps? It makes sense if your AppearanceType is above 7 to use this here but if it's less than 7 you use this same thing twice.
		SpeakString("rowboat",TALKVOLUME_SILENT_TALK);
		SetLocalInt(oPC,"rowboat",1);

    }
      
	else
    {
         FloatingTextStringOnCreature("You must have a humanoid appeareance to row a boat !" ,oPC);
         
    }


	if (irowboat==1)
    {

		SetLocalInt(oPC,"rowboat",0);
		SpeakString("debout",TALKVOLUME_SILENT_TALK);
		SetPhenoType(0,oPC);

    }
}


Gotta go sleep now. Half past midnight here.

EDIT: Made a small mistake, I believe. Corrected that.

1 Like

Thanks bud. I will test this

Sorry, I made a mistake. Copy and paste again, please.

ok…will do…thanks

Looking at my own attempt at correcting things again…It’s a bit odd that you use the DelayCommand(1.0,SetCameraHeight(oPC,0.45)); inside the if statement and then the exact same thing outside the if statement…Don’t know what you want with that…

I guess in the rowboat test mod I dowloaded…it was to show your PC from a high position in the water when you spawned into the lake in the boat…I am guessing. The water would spawn into the area too. Perhaps it was to adjust the level at which the boat/PC would be at in the water??

But why do you use the exact same thing twice is what I wonder…

I’ll edit my post with my script to explain better…one moment.

EDIT: Ok, now it’s edited. Good night. Will check back here tomorrow.

Works great…only ONE issue…lol

When I use the widget again to (hopefully restore to original pheno)…I get the boat on my head. I guess the pheno type is corrected, but now need to take the tail (boat) off the PC.


Would have been nice to to get an oar…but the oar in the base module that had this animation would have overwritten some parts of my magic staffs…sigh…almost perfect. I use a stick to push myself along…lol…

Looking at the script again, I’m not sure what is causing the rowboat to appear, but my guess is that it’s this?

SetLocalInt(oPC,"rowboat",1);

If that’s the case, then you set the int to 0 in the if (irowboat==1) and then it ought to work…

But…Where is the local int “stop” set? It’s not in this script, that’s for sure. If it’s somewhere and you try to run this script again, it won’t run because of if (GetLocalInt(oPC,"stop")==1) return; By the way, this could maybe also be written as if (GetLocalInt(oPC,"stop")) return; depending on if it needs to check the integer to be exactly 1.

Can’t you edit the 2da file then, or maybe the mdb? At least that’s how that stuff works with NWN2…

Sigh…I made your suggested changes (see script below) but now when I use the widget I get the boat on my head as in pic number 2 above:

#include "x2_inc_toollib"

void main()
{


object oPC =GetItemActivator();
int irowboat=GetLocalInt(oPC,"rowboat");

if (GetLocalInt(oPC,"stop")) return;

    if (irowboat==0)
    {

        if( GetAppearanceType(oPC)<7)
        {
            DelayCommand(1.0,SetCameraHeight(oPC,0.45)); //Here you set the camera height.
            SetPhenoType(43,oPC);
            SetCreatureTailType(9970, oPC);
            object ooar = CreateItemOnObject("oar", oPC);
            DelayCommand(0.1, AssignCommand(oPC, ActionEquipItem(ooar, INVENTORY_SLOT_RIGHTHAND)));
        }

        DelayCommand(1.0,SetCameraHeight(oPC,0.45)); //So, if your AppearanceType is less than 7, you set the camera height again. Should this be an "else statement" perhaps? It makes sense if your AppearanceType is above 7 to use this here but if it's less than 7 you use this same thing twice.
        SpeakString("rowboat",TALKVOLUME_SILENT_TALK);
        SetLocalInt(oPC,"rowboat",1);

    }

    else
    {
         FloatingTextStringOnCreature("You must have a humanoid appeareance to row a boat!" ,oPC);

    }


    if (irowboat==0)
    {

        SetLocalInt(oPC,"rowboat",0);
        SpeakString("debout",TALKVOLUME_SILENT_TALK);
        SetPhenoType(0,oPC);

    }
}

Also, for some weird reason it creates three oars too…ugh

Years ago I had Baragg on the vault create a script to remove the tail off my barrel riding pheno as I had the same issue now as the boat. This same widget will remove the barrel AND the boat as per your original script that worked. But I was hoping your script would do that without using this tail widget. Perhaps you can look at this script and incorporate parts of it into the script you made where the boat works.

// Baragg 6-15-12 Created for Imtherealthing
// This script is to be used in tag based scripting to allow a PC to ride
// a barrel. In the Shadow Mountain module we allow PCs to set tail models on
// their PC so I am gonna account for that possibility in this script.

const int PHENO_BARREL = 545; // change this to the correct number
// const int PHENO_CARPET1 = 491; // This is the first model type of carpet
// const int PHENO_CARPET2 = 492; // This is the second model type of carpet


void main()
{
    object oPC = GetItemActivator();

    if( GetLocalInt( OBJECT_SELF, "TAIL_SET_BARREL" ) == 0 )
    {// if the PC is NOT ridding a barrel set pheno to barrel riding and set local on widget
        int nCheck = GetPhenoType( oPC );
        int nTail = GetCreatureTailType( oPC );

        if( nCheck == PHENOTYPE_NORMAL )
        { // if the PCs normal phenotype is PHENOTYPE_NORMAL
            SetLocalInt( OBJECT_SELF, "TYPE_PHENO", 1 );
        }
        else if ( nCheck == PHENOTYPE_BIG )
        { // if the PCs normal phenotype is PHENOTYPE_BIG
            SetLocalInt( OBJECT_SELF, "TYPE_PHENO", 2 );
        }

        // If the PC already has some type of tail we store that int here on the
        // widget just incase
        if( nTail > 0 )
        {
            SetLocalInt( OBJECT_SELF, "TAIL_B4_BARREL", nTail );
        }

        SetPhenoType( PHENO_BARREL, oPC );                  // set PC as riding
        SetLocalInt( OBJECT_SELF, "TAIL_SET_BARREL", 1 );  // mark widget
        ExportSingleCharacter( oPC );                      // save character incase
    }
    else
    {// if the PC IS riding the barrel reset pheno back to the norm and delete locals
        int nCheck = GetLocalInt( OBJECT_SELF, "TYPE_PHENO" );      // retrieve stored int indicating normal pheno
        int nTail = GetLocalInt( OBJECT_SELF, "TAIL_B4_BARREL" );

        if( nCheck == 1 ) SetPhenoType( 0, oPC );          // return PC to PHENOTYPE_NORMAL
        else if( nCheck == 2 ) SetPhenoType( 2, oPC );      // else return PC to PHENOTYPE_BIG
        DeleteLocalInt( OBJECT_SELF, "TYPE_PHENO" );        // delete local indicating "normal" pheotype
        DeleteLocalInt( OBJECT_SELF, "TAIL_SET_BARREL" );  // delete local indicating PC IS riding


        // Here set the tail type to none
        SetCreatureTailType( 0, oPC );

        /*
        if( nTail > 0 )
        {// if the PC had a tail before they started riding the barrel reset that tail
            SetCreatureTailType( GetLocalInt( OBJECT_SELF, "TAIL_B4_BARREL" ), oPC );
            DeleteLocalInt( OBJECT_SELF, "TAIL_B4_BARREL" );  // delete local from widget
        }
        */

        ExportSingleCharacter( oPC );                      // save character
    }
}

Ah…besides it creating more oars it also for some weird reason creates copies of my PC (saves the PC every time I use the widget). So when I opened the game I had just as many copies of my character as I used the widget…crazy…why?