Aller au contenu

Photo

rws swimming


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

#1
bealzebub

bealzebub
  • Members
  • 352 messages
so... Does any one have onenter/onexit scripts for swimming? I was sure there would be a demo .mod around or something, but I came up empty handed. Do I need to make my own?
If so, I'll post them for the rest of ya'.

#2
bealzebub

bealzebub
  • Members
  • 352 messages
Here are scripts in pastebin. If any one has any suggestions for improvement, they are welcome.
OnEnter
OnExit

and here is a demo.mod. You'll need the   swimming.hak
swimming_demo.rar

This is just the beta and does not support capes, wings or tails, and I wasn't sure how to remove them by script.

Modifié par bealzebub, 12 septembre 2012 - 05:05 .


#3
Tchos

Tchos
  • Members
  • 5 063 messages
Sorry I didn't see this earlier.  This is how I did it, based on some code kevL provided in my thread.


// This script should turn all party members into the swimming appearance.
// Use in underwater areas, in OnEnter script field.
// Tchos, 2012-06-24

void main()
{

    object oPC = GetFirstPC();
     object oFM;


int iOriginalAppearance, iChange;
int iAppearance = GetAppearanceType(oPC);

oFM =  GetFirstFactionMember(oPC, FALSE);
while( GetIsObjectValid(oFM) )
{

// There are quite a few of these appearances.  Hope I don't mistype any.
switch (iAppearance)
     {
          // dwarf walk <=> dwarf swim
          case 0: // dwarf
          {
               iChange = 4000; //swim dwarf
               break;
          }
          case 4000: //swim dwarf
          {
               iChange = 0;
               break;
          }
          // elf walk <=> swim
          case 1: // elf
          {
               iChange = 4001; //swim elf
               break;
          }
          case 4001: //swim elf
          {
               iChange = 1;
               break;
          }
          // gnome walk <=> swim
          case 2: // gnome
          {
               iChange = 4002; //swim gnome
               break;
          }
          case 4002: //swim gnome
          {
               iChange = 2;
               break;
          }
          // halfling walk <=> swim
          case 3: // halfling
          {
               iChange = 4003; //swim halfling
               break;
          }
          case 4003: //swim halfling
          {
               iChange = 3;
               break;
          }
          // half-elf walk <=> swim
          case 4:
          {
               iChange = 4004; 
               break;
          }
          case 4004:
          {
               iChange = 4;
               break;
          }
          // half-orc walk <=> swim
          case 5:
          {
               iChange = 4005;
               break;
          }
          case 4005:
          {
               iChange = 5;
               break;
          }
          // human walk to human swim
          case APPEARANCE_TYPE_HUMAN: // #6, Appearance.2da
          {
//               SetLocalInt(oPC, "iOriginalAppearance", iAppearance);
               iChange = 4006; //swim human
               break;
          }
          // human swim to human walk
          case 4006: //swim human
          {
//               iOriginalAppearance = GetLocalInt(oPC, "iOriginalAppearance");
//               DeleteLocalInt(oPC, "iOriginalAppearance");
               iChange = APPEARANCE_TYPE_HUMAN;
               break;
          }
          // Aasimar walk <=> swim
          case 563: // Written as "assimar" in the 2da
          {
               iChange = 4007;
               break;
          }
          case 4007:
          {
               iChange = 563;
               break;
          }
          // Tiefling walk <=> swim
          case 564:
          {
               iChange = 4008;
               break;
          }
          case 4008:
          {
               iChange = 564;
               break;
          }
          // Sun elf walk <=> swim
          case 565:
          {
               iChange = 4009;
               break;
          }
          case 4009:
          {
               iChange = 565;
               break;
          }
          // Wood elf walk <=> swim
          case 566:
          {
               iChange = 4010;
               break;
          }
          case 4010:
          {
               iChange = 566;
               break;
          }
          // Drow walk <=> swim
          case 567:
          {
               iChange = 4011;
               break;
          }
          case 4011:
          {
               iChange = 567;
               break;
          }
          // Svirfneblin walk <=> swim
          case 568:
          {
               iChange = 4012;
               break;
          }
          case 4012:
          {
               iChange = 568;
               break;
          }
          // Gold dwarf walk <=> swim
          case 569:
          {
               iChange = 4013;
               break;
          }
          case 4013:
          {
               iChange = 569;
               break;
          }
          // Duergar walk <=> swim
          case 570:
          {
               iChange = 4014;
               break;
          }
          case 4014:
          {
               iChange = 570;
               break;
          }
          // Strongheart halfling walk <=> swim
          case 571:
          {
               iChange = 4015;
               break;
          }
          case 4015:
          {
               iChange = 571;
               break;
          }
          // Wild elf walk <=> swim
          case 1036:
          {
               iChange = 4016;
               break;
          }
          case 4016:
          {
               iChange = 1036;
               break;
          }
          // Earth genasi walk <=> swim
          case 1037:
          {
               iChange = 4017;
               break;
          }
          case 4017:
          {
               iChange = 1037;
               break;
          }
          // Fire genasi walk <=> swim
          case 1038:
          {
               iChange = 4018;
               break;
          }
          case 4018:
          {
               iChange = 1038;
               break;
          }
          // Air genasi walk <=> swim
          case 1039:
          {
               iChange = 4019;
               break;
          }
          case 4019:
          {
               iChange = 1039;
               break;
          }
          // Water genasi walk <=> swim
          case 1040:
          {
               iChange = 4020;
               break;
          }
          case 4020:
          {
               iChange = 1040;
               break;
          }
          // Half drow walk <=> swim
          case 1041:
          {
               iChange = 4021;
               break;
          }
          case 4021:
          {
               iChange = 1041;
               break;
          }
          // Yuan-ti pureblood walk <=> swim
          case 40:
          {
               iChange = 4022;
               break;
          }
          case 4022:
          {
               iChange = 40;
               break;
          }

//          default:
//               SendMessageToPC(GetFirstPC(FALSE), "Appearance Change : oops, missed one !");
     }

     SetCreatureAppearanceType(oFM, iChange);

     oFM = GetNextFactionMember(oPC, FALSE);
}

}

Modifié par Tchos, 12 septembre 2012 - 10:40 .


#4
MasterChanger

MasterChanger
  • Members
  • 686 messages
Wait, the new appearance rows were not just done as original row + a constant = new row? The new (swimming) rows are not in the same order as the original appearance rows? :pinched:

I understand that reserved rows might have made that difficult, but not putting them in order makes the scripting way more difficult.

#5
Dann-J

Dann-J
  • Members
  • 3 161 messages
I'd rather have the swimming appearance entries in alphabetical order, rather than in the order the non-swimming appearances occur. That way elves, for instance, would all be clustered together ('Elf_Wild', 'Elf_Wood', etc), rather than the scattered order their non-swimming appearances are in.

You only have to write such scripts once, so any particular order hardly makes scripting 'way more difficult'. You're still just typing in pairs of numbers. If I was to use swimming in a module, I'd probably just modify the scripts I wrote for the RWS mounts.

I usually completely recreate such 2DA entries in my own modules, since I laugh in the face of reserved line numbers. My version of a 2DA only has to work with the module the HAK is attached to.

#6
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
This seems like it is falling far short of what is possible - the example here only support a few races, and the codes is doing more work to get similar results among those fewer options.

I set this up for the monster pack and the CSL like this ( and this was all discussed while swimming, riding and the rest was being developed ). Code discussed is in cslcore_appearance.nss

( This is entirely by memory so the specifics are definitely wrong. Assuming here 1 is offset for human overrides, 6 is the actual appearance for humans, and 4000-4199 is swimming and 4200-4399 is riding and that i have ranges going from 4000-4999 which are all reserved. This can all easily be varied. )

Figured out all the creatures which had the 5 skeletons types ( human, elf, gnome, dwarf, etc )

Setup a block of 200 organized by skeleton type for swimming, then i copied this entire block for riding and carefully used hellfires skeletons for each ( basically it's a pattern so easy to replace. ) If it's not supported, i just leave the original values and assume it's probably NPC's anyway. It is required to have appearance.2da follow the pattern inside each block of 200. This is all in pains monster pack for swimming.

Created a script function ( CSLGetAnimateOffsetByAppearance ) to get the offset for a given creature as from the first row of the 200. ( IE if a creature is appearance 6, it spits out a 1, and i add the offset of 4000 to it to get 4001 )

Created a script function (CSLGetAppearanceByAnimateOffset ) to get the the actual appearance. ( IE if a creature is appearance > 4000 and < 4999, and in this case 4001, i subtract 4000 to get 1, and feed the 1 into the function to return a 6 thus reversing the previous function, if it's not an override it's no real over head )

These 2 scripts allow me to support EVERY possible race in a simple manner. And this is safe, it knows how to undo the appearance easily-if it's in the given range, just get the original appearance. ( if you save it or it logs off with a override appearance, it will be permament and any variables might get lost. ) I also do a double switch, so it first divides the appearance by 10, then it jumps to the specific section of possible values, thus ensuring it never needs to check more than 20 values and generally only 10. These 2 functions are very intense, and need to be updated when appearance.2da changes, but they actually are doing less actual work due to using a switch inside of a switch.

And this supports a more complex situation, where you have someone swimming who then mounts a horse, since it supports both systems via a single system.

Some examples:
I have a creature with appearance 4201. This is a real block from 4200-4399 so i know it's riding. I subtract 4200 from this number to get a 1, then I use my lookup function to get it original appearance which is 6. If the creature just is loading in the module or if they die, i can put them back to appearance 6 just based on their current appearance.

Now if they are appearance 6. I do a lookup to get their offset which is 1. If they are supposed to be swimming i add this to 4000 to get 4001, and then i set this.

If they are apperance 4001, and i want to make them riding, i first check to see if they are appearance 4000-4999 range, and use the first process to get appearance 6, and then use the lookup function to get appearance 4201.

Now since my 2 functions include a bit over 100 creatures, this supports robots, vampires, all the npc's and all the creatures in pains monster pack - the only reason it is not supported is due to hellfire not providing a skeleton.

And the 2 functions are shared by code setup for riding and swimming - i even setup fake gender changes using the same basic ideas, and again the limit is on what hellfire decides to release. ( riding was only for humans when i was testing it, but as long as you follow the same pattern it will just work. )

The only part of the CSL which is needed is the usage of the same patterns within those ranges in appearance.2da, and the 2 lookup functions, and some similar logic - this should be able to drop into the systems described here and improve them substantially, and make it so the results are more compatible and don't require completely different appearance.2da's - you'd be able to use pains monster pack or a revised version thereof.

For CSL i added features like the ability to define, disable and enable ranges via a simple 2da, caching of the values, a appearance tool for DMs that lets them set appearance overrides in game ( did this to debug the system actually ), male and female genders, not to mention methods to determine the height of a dwarf so he'll drown in shallow water if his nose goes under while a human won't.

( note that you also have to adjust the creaturespeed.2da to make the PC speed and the monster speed the same, as appearance changing techniques will make the player lose the custom setting which is only applied on character creation. )

Modifié par painofdungeoneternal, 21 septembre 2012 - 02:20 .


#7
Tchos

Tchos
  • Members
  • 5 063 messages
Well, the code I used only supports those races, because those are the only races' GR2 files included in the RWS swimming pack. I'd be glad if there were also files that would support certain monstrous humanoids, but...

#8
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
And you base this on what knowledge???

I have already implemented what i am talking about and seen it work.

I think you are assuming it says human skeleton, therefore only humans work. A lot of creatures use the skeletons for human, elf, dwarf, etc.

Take a look a the appearance.2da that comes with my monster pack, try the appearances for swimming in the toolset, i think you will be surprised how many of them work.

#9
Dann-J

Dann-J
  • Members
  • 3 161 messages
There are quite a few creatures that use the human animations (skeletons, liches, death knights, for instance), but I wasn't aware of any non-playable races that used the dwarf or elf animations.

Tchos is correct though - I doubt there are swimming animations for creatures that use non-playable race skeletons (dog-leg, devil, etc).

#10
bealzebub

bealzebub
  • Members
  • 352 messages
I allways feel like a 1st grader in a college class when I read Pain's posts. It takes me 4-5 reads and a day of reflection to pick up what he's laying down.

#11
Tchos

Tchos
  • Members
  • 5 063 messages

painofdungeoneternal wrote...
And you base this on what knowledge???
Take a look a the appearance.2da that comes with my monster pack, try the appearances for swimming in the toolset, i think you will be surprised how many of them work.

I think you misunderstand what I said.  I'm not claiming any special knowledge.  I'm saying that my code supports only those races, because those were the only GR2 files in the pack.

I will be happy to know how to use those for other creatures.  I'll look in your 2DA to see what's in there.

Addendum:
Further clarification, since I see that was pretty much the same phrasing I already used -- In other words, I did it the way that I did because of what I had in the folder.

Modifié par Tchos, 20 septembre 2012 - 11:37 .


#12
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
My point is it's missing ( skeletons, liches, death knights ) and others, plus all the companions.

Easily puts the number over 100 possible options. Add in custom content, a lot of that works with it as well - swimming teletubbies anyone?

( I know it does not support dog leg and devil skeletons, but not all devils use the devil skeleton, some use human as well )

#13
Dann-J

Dann-J
  • Members
  • 3 161 messages
Ah, yes - Mephasm uses the human skeleton, and he's technically a 'devil'. As do things like erinyes (can't remember if they're 'devils' or 'demons'). Then there are githyanki, planetars, solars, vampires... it's quite a list of possibilities.

I'd be curious to see how someone could justify skeletal creatures with swimming abilities though. Surely they'd sink like stones, especially the armoured variety like death knights. Undead floaties perhaps? Image IPB

Modifié par DannJ, 21 septembre 2012 - 01:00 .


#14
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
Same ideas are behind horse riding, there you need those creatures riding - and skeletons and death knights are on the top of the list.

I would leave it to the DM's and module builders to decide that.

By the same logic how can you justify dwarves swimming. Should only work if they took a swimming feat really, and probably if they are not encumbered and not in full armor.

I would imagine if an aquatic elf died, it would have leave a skeleton that could swim / float thru teh water in a subterranean and submerged dungeon, could be very creepy looking.

#15
Dann-J

Dann-J
  • Members
  • 3 161 messages
I've already done skeletons riding horses:
http://www.neverwint...ds.com/mods/129

Sea-cliff dwarves (detailed in Stormwrack) are also expert swimmers.