Author Topic: need more scripts  (Read 415 times)

Legacy_fumm

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
need more scripts
« on: September 14, 2014, 03:57:23 am »


               

Hello. thanks for the help so far but i need several more scripts. i need one for making the chests respawn items every 15 minutes after its looted. one for making all the spawned mobs in an area disappear if no player character has been there for 15 minutes. one for making all the commoners, defenders and merchants in an area non-hostile to the player character on his entering the said area. one for modifying the starting inventory of a character(only the first time he logs on with that character). and one for making equipments unequip on equip if the player character doesnt meet the custom level requirement of that item(which can be modified). 



               
               

               
            

Legacy_Ed Venture

  • Full Member
  • ***
  • Posts: 200
  • Karma: +0/-0
need more scripts
« Reply #1 on: September 14, 2014, 01:33:18 pm »


               

fumm,


My first mod was no more than a tutorial build. It took me about 6 months. It was a simple, fight the bad guys, get the item and finish the quest. It taught me alot of the basics on how to use the toolset. It even used some basic scripting. After I finished the tutorial, I kept adding on to the mod, just for my own XP. I only posted it on the vault, because I needed to know how to do that.


My second mod was built after doing several tutorials on basic and advanced scripting. It took 8 months. I did the math when I finished it and it came out to about 36 days. Had to work hard. Had to get it done.


My current build is not going at a pace anywhere near that. I look at it kind of like building a diorama. Take your time and work on the details.


I have come to these forums many times asking for help, but I also take a great deal of pride in the fact that I have learned and done alot on my own. While I find the people here most friendly and helpful, I try not to ask their help untill I have tried everything I can think of.


 


I still consider myself a noob, and as such I would say, take your time, do the work. Half of the fun of this is banging your head against the table. I think you will have more fun and take more pride in what you can do for yourself.


 


For what it's worth,


Ed



               
               

               
            

Legacy_fumm

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
need more scripts
« Reply #2 on: September 14, 2014, 02:07:06 pm »


               

I wanted to get it done because i dont like any of the pw servers there currently are to choose from, but i still wanted to play. I guess i cant depend on other people forever, so might as well learn it for myself. And yes, it will be more fun and satisfying if i knew how to script and stuff and did my own work. Thanks for reminding me that '<img'> . 



               
               

               
            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
need more scripts
« Reply #3 on: September 15, 2014, 05:12:46 am »


               

try Lands of Larinia... PW Action.. direct connect in the sig... lots of stuff... no DLs.. just try to keep in mind.... it's a mod for those that like to use their brains when doing quests.. unlike the sad excuses for quests that games like WoW put out... there are of course the quick and easy ones labeled "jobs"... but most you actually have to use your brain to finish.


 


if you have gone there, please do my a solid and give me your feedback in a PM... thanks



               
               

               
            

Legacy_fumm

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
need more scripts
« Reply #4 on: September 15, 2014, 05:25:16 am »


               

hey i wrote a code that should take the user of a placeable to level 10. But it seems to take the user to level 40. heres the code:


 


void main()

{

    object oPC = GetLastUsedBy();

    int nCheck = GetHitDice(oPC);

 

    while(nCheck < 10)

    {

        GiveXPToCreature(oPC, 1000);

        nCheck = GetHitDice(oPC);

    }

}

 

What am I doing wrong? 

 

And Im going to check out Lands of Larinia now. 


               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
need more scripts
« Reply #5 on: September 15, 2014, 05:48:09 am »


               

your problem is that nCheck  is set to the PC's HD outside of the loop.    therefore nCheck will always be whatever HD the PC was when the script first runs. creating an infinite loop that will just keep giving the PC xp until a TMI happens.    


 


You however do not need a loop to get the result that you want.   Just check the PC's  XP    If it is less then the XP needed for 10th level set it to the XP needed for 10th level.   



               
               

               
            

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
need more scripts
« Reply #6 on: September 15, 2014, 05:51:54 am »


               

Probably because the PC who has used the placeable isn't level 11}


 


What your code says is, "Look at the PC who just used this placeable.  What level is he/she?  Currently less than 10?  Great, give him/her another 1k xp.   Now let me check again."


 


What's happening is that your PC probably hasn't leveled-up in the seconds after using the placeable, therefore is still level 1 or whatever, so continues to get xp in 1k increments until he/she has enough to take him/her to level 40 because the metric you use...the current level of the PC...hasn't changed.  If you were to quickly level the PC as it gets xp, up to 10, you'd probably see the loop exit since it would recognize that, finally, the PC is level 10.


 


You should check the xp instead and if it is less than the xp required to be level 10, calculate the difference between what he/she has and how much is needed, and give that much xp.


               
               

               
            

Legacy_fumm

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
need more scripts
« Reply #7 on: September 15, 2014, 08:34:28 am »


               
I wrote a code where if a PC is less than level20 he automatically unquip any +4 weapons on equip. But it wont compile

 

 

void main()

{

 object oEquipment = GetPCItemLastEquipped();

 object oPC = GetPCItemLastEquippedBy();

 int nLevel = GetHitDice(oPC);

 

//make iEnhancement an itemproperty variable with the property weapon enhancement

 

 itemproperty iEnhancement = ItemPropertyEnhancementBonus(ITEM_PROPERTY_ENHANCEMENT_BONUS);

 

//assign the weapon enhancement value of the item just equipped to nEnhancement

 

int nEnhancement = GetItemPropertyParam1Value(iEnhancement);

 

//If the enhancement bonus is 4 and PC level is less than 20 then unequip

 

 if(nEnhancement == 4)

    {

    if(nLevel < 20)

        {

        ActionUnequipItem(oEquipment);

        FloatingTextStringOnCreature("your level is not high enough", oPC);

        }

     }


               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
need more scripts
« Reply #8 on: September 15, 2014, 06:38:00 pm »


               

Firstly, you should grab a copy of the NWN Lexicon if you don't already have it. It can be found here: http://neverwinterva...wn-lexicon-v169

 

Secondly, when a script doesn't compile, the compiler usually alerts you to the first line of the script that doesn't make sense and a clue to as to why it doesn't.

 

In this case ....

Quote
9/15/2014 1:28:32 PM: Error. '111' did not compile.
111.nss(28): ERROR: UNEXPECTED END COMPOUND STATEMENT

 

Line "111" doesn't actually exist, but ... this tells us that your script is missing something. that something in this case seems to be a bracket.

 

Quote

void main()
{
 object oEquipment = GetPCItemLastEquipped();
 object oPC = GetPCItemLastEquippedBy();
 int nLevel = GetHitDice(oPC);

//make iEnhancement an itemproperty variable with the property weapon enhancement

 itemproperty iEnhancement = ItemPropertyEnhancementBonus(ITEM_PROPERTY_ENHANCEMENT_BONUS);

//assign the weapon enhancement value of the item just equipped to nEnhancement

int nEnhancement = GetItemPropertyParam1Value(iEnhancement);

//If the enhancement bonus is 4 and PC level is less than 20 then unequip

 if(nEnhancement == 4)
    {
    if(nLevel < 20)
        {
        ActionUnequipItem(oEquipment);
        FloatingTextStringOnCreature("your level is not high enough", oPC);
        }
     }

}

Quote

 

Now it'll compile.