Author Topic: SetCreatureSize Function  (Read 406 times)

Legacy_Sadira of Tyr

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +0/-0
SetCreatureSize Function
« on: June 03, 2012, 12:45:07 pm »


               I am making some subrace scripts, but I cannot find a SetCreatureSize function. I can change the PCs appearance to that of a large creature, such as an ogre or giant, but it does not allow a PC to use a two  handed weapon in each hand, such as a large creature could do. I am sure that changing the creature size to large would allow this. However I can only find the function GetCreatureSize and the constant CREATURE_SIZE_LARGE. I tried including a few cep scripts, but I have had no luck. Is there a script I could include to get SetCreatureSize?

Thank you for any help you can provide.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
SetCreatureSize Function
« Reply #1 on: June 03, 2012, 02:59:36 pm »


               Creature size is bound with appearance, last time i did it i was able to wield scythe + tower shield with minotaur normally. Not sure about dual-wield though.
               
               

               
            

Legacy_Sadira of Tyr

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +0/-0
SetCreatureSize Function
« Reply #2 on: June 03, 2012, 03:57:48 pm »


               I tried with a greatsword and tower shield and it didn't work. Maybe ogre is not a large size. I'll have to try it with a giant.

Thank you for helping.
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
SetCreatureSize Function
« Reply #3 on: June 03, 2012, 05:53:49 pm »


               NWNX has a SetCreatureSize function.  Setting a characters apperance doesn't change their size unless they log out and back in with that appearance on, which can bug other things.

It's in nwnx_funcs for windows, not sure about for a linux setup.

// Changes the internal size of a creature to iSize (CREATURE_SIZE_*)
// This does not change the physical size of the creature model as seen in game
void NWNXFuncs_SetCreatureSize(object oCreature, int iSize = CREATURE_SIZE_MEDIUM);
               
               

               
            

Legacy_Sadira of Tyr

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +0/-0
SetCreatureSize Function
« Reply #4 on: June 03, 2012, 06:41:38 pm »


               Thank you for that, but I'm not sure about using external programs. I'm not the server admin, just the builder, but I do know that the server uses Linux. He does not like to use an external database or stuff like that, so I am limited in what I can do. I'm just making a script to change appearance and have the stats adjusted by a dm. However I would like to have the creature size change too. I did make some scripts that limit equipable items for certain subraces, and they worked fine.

What you mentioned about the size changing when you log would be good. I made the script to make the changes when a PC enters the module welcome area. However when the player logs and comes back, the appearance resets back to what it was before. I'm not sure how to make the appearance stay when a player logs. I tried having the on client enter script execute the subrace script, but it didn't work.

Any help would be appreciated.
               
               

               


                     Modifié par Sadira of Tyr, 03 juin 2012 - 05:43 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
SetCreatureSize Function
« Reply #5 on: June 03, 2012, 06:56:46 pm »


               

Failed.Bard wrote...

 Setting a characters apperance doesn't change their size unless they log out and back in with that appearance on, which can bug other things.

If this is true and no reason to believe its not, then try re-polymorph the character if the re-log using ActivatePortal isnt an option Sadira of Tyr.
               
               

               
            

Legacy_Sadira of Tyr

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +0/-0
SetCreatureSize Function
« Reply #6 on: June 04, 2012, 12:58:53 am »


               

ShaDoOoW wrote...

Failed.Bard wrote...

 Setting a characters apperance doesn't change their size unless they log out and back in with that appearance on, which can bug other things.

If this is true and no reason to believe its not, then try re-polymorph the character if the re-log using ActivatePortal isnt an option Sadira of Tyr.


You mean having the appearance change every time the player logs on the server? I tried that, but it didn't work. I could only get it to work when entering the start area. I could post the scripts, if it will help.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
SetCreatureSize Function
« Reply #7 on: June 04, 2012, 06:33:31 pm »


               

ShaDoOoW wrote...

Failed.Bard wrote...

 Setting a characters apperance doesn't change their size unless they log out and back in with that appearance on, which can bug other things.

If this is true and no reason to believe its not, then try re-polymorph the character if the re-log using ActivatePortal isnt an option Sadira of Tyr.


The way to do this without relogging is to change the appearance (to one with the desired size), polymorph (into anything) and unpolymorph then reset the appearance.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
SetCreatureSize Function
« Reply #8 on: June 04, 2012, 07:02:22 pm »


               Here is a sample of changing the size to tiny. This type of change will keep the original race and creature speed (assuming the Toolset setting for the speed is not different from the appearance.2da row).  My delays are probably longer than what is needed, and if performing this on a PC, (or a creature that might enter combat) you may have to set the controllable state to FALSE.

void SetTinySize(object oCreature = OBJECT_SELF)
{
int nAppearance =GetAppearanceType(oCreature);
SetCreatureAppearanceType(oCreature, APPEARANCE_TYPE_BADGER);
DelayCommand(5.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectPolymorph(0), oCreature, 10.0));
DelayCommand(20.0, SetCreatureAppearanceType(oCreature, nAppearance));
}


EDIT: Just realized I had used a non-standard polymorph from back when I was testing huge weapons in both shifted and unshifted forms.  Polymorph number corrected to 0.
               
               

               


                     Modifié par WhiZard, 04 juin 2012 - 06:24 .
                     
                  


            

Legacy_Sadira of Tyr

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +0/-0
SetCreatureSize Function
« Reply #9 on: June 05, 2012, 12:42:36 am »


               I will try that. Thank you very much. 'Image
               
               

               
            

Legacy_Birdman076

  • Sr. Member
  • ****
  • Posts: 320
  • Karma: +0/-0
SetCreatureSize Function
« Reply #10 on: June 05, 2012, 01:15:25 am »


               If you are using Shayan's Subrace System still its very easy. Line 237 of sha_subr_methds explains how to Restrict item use based on subrace.

EXAMPLE CODE:
 
[i]//Item Restriction: No shields, Only large weapons
    SubraceRestrictUseOfItems("Giant-Hill", ITEM_TYPE_WEAPON_SIZE_SMALL_DOWN|ITEM_TYPE_WEAPON_SIZE_MEDIUM|ITEM_TYPE_SHIELD_ANY, TIME_BOTH); [/i]

sha_subr_methds:

[i]// Restricting the use of Items (both weapons and armour) for a given subrace.
// Use this for each of the four TimeOfDay you want. (TIME_DAY, TIME_NIGHT, TIME_SPECIAL_APPEARANCE_NORMAL and TIME_SPECIAL_APPEARANCE_SUBRACE)
//          ItemType should be a mix of the following (mix them by using | ):
//
//            --------- Weapon Restrictions ---------
//
//
//              - ITEM_TYPE_WEAPON_MELEE           - Melee Weapons (incl. Monk Gloves) Does NOT include Bracers.
//              - ITEM_TYPE_WEAPON_RANGED_THROW    - Ranged Weapons (Throwing Weapons)
//              - ITEM_TYPE_WEAPON_RANGED_LAUNCHER - Ranged Weapons (Launchers) Does "incl." Ammonition (Ammo can still be equipped but is not usable)
//              - ITEM_TYPE_WEAPON_RANGED          - Ranged Weapons (Both Launchers and Throwing)
//              - ITEM_TYPE_WEAPON                 - All Weapons (Both Ranged and Melee)
//
//              - ITEM_TYPE_WEAPON_PROF_SIMPLE     - Simple Weapons
//              - ITEM_TYPE_WEAPON_PROF_MARTIAL    - Martial Weapons
//              - ITEM_TYPE_WEAPON_PROF_EXOTIC     - Exotic Weapons
//              - ITEM_TYPE_WEAPON_PROF_ANY        - All Weapon Prof.
//
//              - ITEM_TYPE_WEAPON_SIZE_TINY       - Tiny Weapons
//              - ITEM_TYPE_WEAPON_SIZE_SMALL      - Small Weapons
//              - ITEM_TYPE_WEAPON_SIZE_MEDIUM     - Medium Weapons
//              - ITEM_TYPE_WEAPON_SIZE_LARGE      - Large Weapons
//
//              - ITEM_TYPE_WEAPON_SIZE_SMALL_DOWN - All Small or smaller Weapons (Small, Tiny)
//              - ITEM_TYPE_WEAPON_SIZE_MEDIUM_UP  - All Medium or Larger Weapons (Medium, Large)
//              - ITEM_TYPE_WEAPON_SIZE_ANY        - All Weapon Sizes.
//
//
//
//            --------- Armour, Helm and Shield Restrictions ---------
//
//              - ITEM_TYPE_SHIELD_SMALL           - Small Shields
//              - ITEM_TYPE_SHIELD_LARGE           - Large Shields
//              - ITEM_TYPE_SHIELD_TOWER           - Tower Shields
//              - ITEM_TYPE_SHIELD_ANY             - All Shields.
//
//              - ITEM_TYPE_ARMOR                  - Torso Armour Only (AC 0-8)
//              - ITEM_TYPE_ARMOR_TYPE_CLOTH       - Cloth Torso Armour only (AC 0)
//              - ITEM_TYPE_ARMOR_TYPE_LIGHT       - Light Torso Armour only (AC 1-3)
//              - ITEM_TYPE_ARMOR_TYPE_MEDIUM      - Medium Torso Armour only (AC 4-6)
//              - ITEM_TYPE_ARMOR_TYPE_HEAVY       - Heavy Torso Armour only (AC 7-8)
//
//              - ITEM_TYPE_ARMOR_AC_0             - Torso Armour with 0 AC
//              - ITEM_TYPE_ARMOR_AC_1             - Torso Armour with 1 AC
//              - ITEM_TYPE_ARMOR_AC_2             - Torso Armour with 2 AC
//              - ITEM_TYPE_ARMOR_AC_3             - Torso Armour with 3 AC
//              - ITEM_TYPE_ARMOR_AC_4             - Torso Armour with 4 AC
//              - ITEM_TYPE_ARMOR_AC_5             - Torso Armour with 5 AC
//              - ITEM_TYPE_ARMOR_AC_6             - Torso Armour with 6 AC
//              - ITEM_TYPE_ARMOR_AC_7             - Torso Armour with 7 AC
//              - ITEM_TYPE_ARMOR_AC_8             - Torso Armour with 8 AC
//
//              - ITEM_TYPE_HELM                   - Helms
//
//              - ITEM_TYPE_FULL_ARMOR_SET         - All Armours, Shields and Helms.
//
//            --------- Misc. Restrictions ---------
//
//              - ITEM_TYPE_JEWLERY                - Rings and Amulets
//              - ITEM_TYPE_MISC_CLOTHING          - None-Torso clothing (Cloak, Braces, Boots) Does NOT include Jewlery
//              - ITEM_TYPE_NONE_BIOWARE_ITEM      - ALL None Standard Bioware Items (e.g. CEP Items)
//
//
//
//          TimeOfDay should either be any mix of TIME_DAY,TIME_NIGHT, TIME_BOTH for time-based restrictions OR
//               a mix of TIME_SPECIAL_APPEARANCE_SUBRACE, TIME_SPECIAL_APPEARANCE_SUBRACE for appearance-based restrictions.
//               Appearance-based will override Time-based in case of conflict!
//
//          Allow should be a mix of the follow constants:
//              - ITEM_TYPE_REQ_ALL - Must meet ALL requirements (applies to Weapons-req. only) e.g. only weapons that are Large Weapons AND Simple Weapons can be used
//              - ITEM_TYPE_REQ_ANY - Must just meet one of the requirements  e.g. Large Weapons or simple weapons can be used.
//              - ITEM_TYPE_REQ_DO_NOT_ALLOW - Subrace CANNOT use ItemType during TimeOfDay (input is reversed)
void SubraceRestrictUseOfItems(string subrace, int ItemType, int TimeOfDay = TIME_BOTH, int Allow = ITEM_TYPE_REQ_DO_NOT_ALLOW);[/i]

               
               

               


                     Modifié par Birdman076, 05 juin 2012 - 12:17 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
SetCreatureSize Function
« Reply #11 on: June 05, 2012, 03:00:20 am »


               

Birdman076 wrote...

If you are using Shayan's Subrace System still its very easy. Line 237 of sha_subr_methds explains how to Restrict item use based on subrace.


There is a difference between changing size and restricting items.  A tiny creature gets a two-handed strength bonus for wielding a small weapon, also this creature is disallowed a shield when a small weapon is equipped (but not a tiny weapon).  Additionally tiny creatures get additional bonuses to AB, AC, and stealth beyond that of a small creature.
               
               

               
            

Legacy_Birdman076

  • Sr. Member
  • ****
  • Posts: 320
  • Karma: +0/-0
SetCreatureSize Function
« Reply #12 on: June 05, 2012, 03:49:13 am »


               Right, the subrace system allows for the changing of size via appearance and then its up to you to restrict items based on size of the creature you are setting the player up as. Sadira's mod is an offshoot of Rhun therefore if they are still using the subrace system it would be much easier to set the subrace to the appearance desired and place restrictions on weapon sizes based on the appearance in the subrace scripts as opposed to creating from scratch that which may cause problems with a system already in place. I've done this with Hill Giants in a Rhun module that allowed them to use two-handed swords and a shield or duel wield two-handed swords which is what I think Sadira is after.
               
               

               


                     Modifié par Birdman076, 05 juin 2012 - 02:51 .
                     
                  


            

Legacy_Sadira of Tyr

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +0/-0
SetCreatureSize Function
« Reply #13 on: June 05, 2012, 10:51:04 am »


               Thanks for the help guys. 'Image

The polymorph thing worked great. I could use a two handed weapon with a tower shield with an ogre or minotaur. However I could only dual weild a two handed weapon with a one handed weapon. Two great swords did not work.

We used to use the Shayan subraces, but they were removed because of too many problems, and too many resourses used. I'm trying to make new subraces that don't need a whole lot of scripts running all the time. I had made my own script for tiny creatures item restrictions, but I did not know about tiny creatures and benefits with small weapons. Thanks for the examples though. Now I can add some armour restrictions too.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
SetCreatureSize Function
« Reply #14 on: June 05, 2012, 12:46:53 pm »


               I am posting this chart, which I had posted in another thread, to provide the full scenario spectrum for mixing polymorphs and appearance changes.



Creature has appearance A
1) Appearance is set to appearance B
2) Polymorph to appearance C
3) Appearance is set to appearance D
4) Un-polymorph
5) Appearance is set to appearance E



       1    2   3    4    5
Size        A    C   C    B    B
Race       A    C   C    A    A
Speed      B    B   D    D    E

               
               

               


                     Modifié par WhiZard, 05 juin 2012 - 11:47 .