Aller au contenu

Photo

swimming script


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

#1
bealzebub

bealzebub
  • Members
  • 352 messages



//sets appearance for swimming
//unequips cloak.

int GetSwimmingAppearanceType(object oTarget)
{
int nSwimAppearance;
int nAppearance = GetAppearanceType(oTarget);

switch(nAppearance)
	{
	case 0://dwarf
		nSwimAppearance=4000;
		break;
	case 1://elf
		nSwimAppearance=4001;
		break;
	case 2://gnome
		nSwimAppearance=4002;
		break;
	case 3://halfling
		nSwimAppearance=4003;
		break;
	case 4://half-elf
		nSwimAppearance=4004;
		break;
	case 5://half-orc
		nSwimAppearance=4005;
		break;
	case 6://human
		nSwimAppearance=4006;
		break;
	case 563://assimar
		nSwimAppearance=4007;
		break;
	case 564://tiefling
		nSwimAppearance=4008;
		break;
	case 565://sun elf
		nSwimAppearance=4009;
		break;
	case 566://wood elf
		nSwimAppearance=4010;
		break;
	case 567://drow elf
		nSwimAppearance= 4011;
		break;
	case 568://svirfneblin
		nSwimAppearance=4012;
		break;
	case 569://gold dwarf
		nSwimAppearance=4013;
		break;
	case 570://duergar dwarf
		nSwimAppearance=4014;
		break;
	case 571://strongheart halfling
		nSwimAppearance=4015;
		break;
	case 1036://wild elf
		nSwimAppearance=4016;
		break;
	case 1037://earth gensai
		nSwimAppearance=4017;
		break;
	case 1038://fire genasi
		nSwimAppearance=4018;
		break;
	case 1039://air genasi
		nSwimAppearance=4019;
		break;
	case 1040://water genasi
		nSwimAppearance=4020;
		break;
	case 1041://half-drow elf
		nSwimAppearance=4021;
		break;
	case 40://yuan-ti pureblood
		nSwimAppearance=40;
		break;
	default://default = appearance invalid
		nSwimAppearance=-1;
	}
	
return nSwimAppearance;
}


//***************************************************************************

#include "inc_gui_timer"
#include "x0_i0_partywide"


void main()

{
object oEnter = GetEnteringObject();
int nOriginalAppearance = GetAppearanceType(oEnter);
int nAppearanceType = GetSwimmingAppearanceType(oEnter);
int nInWater = GetLocalInt(oEnter,"nInWater201");
object oCloak = GetItemInSlot(INVENTORY_SLOT_CLOAK,oEnter);

object oComp1 = GetNearestObjectByTag("bub_elwita");
object oComp2 = GetNearestObjectByTag("bub_freda");
object oComp3 = GetNearestObjectByTag("bub_blodgett");
object oComp4 = GetNearestObjectByTag("bub_dread_delgath");
object oComp5 = GetNearestObjectByTag("bub_karraway");
object oComp6 = GetNearestObjectByTag("bub_kayen");

if (nInWater == 1)
	{
	return;
	}

SetLocalInt(oEnter,"nInWater201",1);

if (GetIsObjectValid(oCloak))
	{
	AssignCommand(oEnter,ActionUnequipItem(oCloak));
	SetLocalString(oEnter,"s201SwimmingCloakTag",GetTag(oCloak));
	}

SetLocalInt(oEnter,"nAppearanceType",nOriginalAppearance);

if (nAppearanceType == -1)
	{
	SendMessageToPC(oEnter,"appearance type invalid, swimming not enabled");
	return;
	
	}

	SetCreatureAppearanceType(oComp1, 4000);
	SetCreatureAppearanceType(oComp2, 4006);
	SetCreatureAppearanceType(oComp3, 4003);
	SetCreatureAppearanceType(oComp4, 4006);
	SetCreatureAppearanceType(oComp5, 4006);
	SetCreatureAppearanceType(oComp6, 4001);
	
SetCreatureAppearanceType(oEnter,nAppearanceType);
StartTimer(60, "d10_timer_endscript", oEnter);
SetLocalIntOnAll(oEnter, "UNDER_WATER_IMMUNE", 1);
}
//turns off swimming animations by changing entering object's appearance
//also re-equips cloaks since they are not supported by swimming yet.


#include "x0_i0_partywide"
#include "gogs_uw_inc"
#include "inc_gui_timer"

void main()
{
object oExit = GetExitingObject();
object oComp1 = GetNearestObjectByTag("bub_elwita");
object oComp2 = GetNearestObjectByTag("bub_freda");
object oComp3 = GetNearestObjectByTag("bub_blodgett");
object oComp4 = GetNearestObjectByTag("bub_dread_delgath");
object oComp5 = GetNearestObjectByTag("bub_karraway");
object oComp6 = GetNearestObjectByTag("bub_kayen");


string sCloakTag = GetLocalString(oExit,"s201SwimmingCloakTag");
int nOriginalAppearance = GetLocalInt(oExit,"nAppearanceType");

object oCloak = GetItemPossessedBy(oExit,sCloakTag);

RemoveUnderWaterEffects(oExit);
ClearUpTimer(oExit);
SetLocalIntOnAll(oExit, "UNDER_WATER_IMMUNE", 0);

if ((sCloakTag!="")&&
	(GetIsObjectValid(oCloak)))
	{
	AssignCommand(oExit,ActionEquipItem(oCloak,INVENTORY_SLOT_CLOAK));
	}

	SetCreatureAppearanceType(oComp1, 0);
	SetCreatureAppearanceType(oComp2, 6);
	SetCreatureAppearanceType(oComp3, 3);
	SetCreatureAppearanceType(oComp4, 6);
	SetCreatureAppearanceType(oComp5, 6);
	SetCreatureAppearanceType(oComp6, 1);
		
SetCreatureAppearanceType(oExit,nOriginalAppearance);


SetLocalInt(oExit,"nInWater201",0);

}

Hey everyone, I've been trying to edit these scripts, but I'm just not getting it.

The scripts go OnClientEnter and OnExit of an area.

I've added a countdown timer, when it reaches 0, you start to drown.

I want it to effect the PC and which ever companions happen to be there.

Both scripts work fine for the PC, and the timer works fine, but I can't get the comps to change. And then OnExit, the comps all change to dwarf.

Can any one spot where I'm going wrong?



#2
Tchos

Tchos
  • Members
  • 5 054 messages

Dwarf is the default appearance because its constant value is 0.  I haven't looked these over, but you could use my swimming scripts which change the whole party, including recruited NPC companions and player-created party members.  They have the benefit of having been already tested extensively.  They're in my module for the two swimming areas.  I recommend looking at the "undersea tour" area.



#3
bealzebub

bealzebub
  • Members
  • 352 messages

thanks, I'll give them a look.



#4
Dann-J

Dann-J
  • Members
  • 3 161 messages

I had similar dwarfification problems with a script that changes appearance types for using the RWS horses. If there's an error and a default value is passed (0 or -1), then your entire party starts singing "Hi-ho, Hi-ho, it's off to work we go...".



#5
bealzebub

bealzebub
  • Members
  • 352 messages

I modified Tchos's scripts and now everything works just fine.

Thanks Tchos!



#6
Tchos

Tchos
  • Members
  • 5 054 messages

It'll be good to see more swimming.  One other thing to note is that familiars and animal companions don't have swimming appearances, so I force unsummon them during the transition to the swimming area (separately from those scripts).



#7
Dann-J

Dann-J
  • Members
  • 3 161 messages

It'll be good to see more swimming.  One other thing to note is that familiars and animal companions don't have swimming appearances, so I force unsummon them during the transition to the swimming area (separately from those scripts).

 

I pity those poor unsummoned water elementals, just as they're about to return to their favourite environment.

 

I suppose you could always polymorph animal companions into sharks (then ride them).

 

7107627769_3607eedbf5_o.jpg