Author Topic: Script to make non palette item?  (Read 330 times)

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Script to make non palette item?
« on: April 10, 2014, 12:32:37 am »


               

Is it possible to make a script that would create a Longsword +2 with a name of "Longsword" but not pull it from a precreated item in the item palette? Any direction would be helpful. 


Thanks!


 


 



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Script to make non palette item?
« Reply #1 on: April 10, 2014, 01:09:22 am »


               

Just create one of bioware's +2 longswords from the palette and then rename it with SetName()



               
               

               
            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Script to make non palette item?
« Reply #2 on: April 10, 2014, 03:08:19 am »


               

If I know how to add stats to a generic item and rename it, I could make randomish loot on certain creatures. Maybe conceptually the below code will better help show what I'm trying to accomplish. 


 



    object oItem = CreateItemOnObject("longsword", OBJECT_SELF);

 

    effect Effect1;

    Effect1 = EffectAttackIncrease(2);

    ApplyEffectToObject(DURATION_TYPE_PERMANENT, Effect1, oItem);

    SetName (oItem, "Some Longsword");

 


               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Script to make non palette item?
« Reply #3 on: April 10, 2014, 03:23:54 am »


               

you can add item properties as well, but you'd probably want to work from a very basic item such as the default bioware longsword, and then add item properties to that.

 

I use this function for that quite often:
IPSafeAddItemProperty(object, itemproperty, float, int, int, int)


 


So read that page, and learn how adding an item property works with that function. Also note that you are probably adding item properties rather than effects. I've never tried doing this with effects, and don't believe it would work. In my experience its item properties that you want to apply to the item


 


In essence you will


  • select a resref for a base item

  • create an item with that resref

  • define an itemproperty

  • add that item property to your item

Resources



               
               

               
            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Script to make non palette item?
« Reply #4 on: April 10, 2014, 03:30:28 am »


               

I'm very grateful Henesua, thank you for the link, looks like that is the direction I needed!



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Script to make non palette item?
« Reply #5 on: April 10, 2014, 03:33:00 am »


               

i edited my post with some more. take a look. and good luck.


 


i appologize for my style of help since i prefer not to give you the solution but rather show you how to approach teh problem. my hope is that more of us will become experts by learning on our own with forum guidance rather than simply asking for scripts and not knowing how they work.



               
               

               
            

Legacy_Vincent07

  • Jr. Member
  • **
  • Posts: 77
  • Karma: +0/-0
Script to make non palette item?
« Reply #6 on: April 10, 2014, 04:43:34 am »


               

I have a bit of code that will generate random weapons on creatures as they spawn.  It allows for some bit of customization as well.