Okay, i am a newbie at escript, but i have been trying to make a Robe that changes color everytime you put it on, but i also wanted it to be specific colors to pick randomly out of...
if someone could plz help me that would be great....also if you are willing to help me out on telling me how to do this i would greatly apprecative and you can contact me via msn : i_roxxorz@hotmail.com
thnx ahead
Newbie:Someone please help me...
You will want to look at the equip script in \pol\pkg\systems\combat.
Using that as an example you could set this as the equipscript for your robe. It has not been tested but I think it will work. Any item using this script will change colour.
The script will not change the colour back on removing the item however. You would do that in the unequip script.
Save it as some other name than equip.src. Perhaps coloured_equip.src. Then set the equip script entry for your robe in the itemdesc.cfg file to the name of this script. Minus the '.src' suffix ofcourse.
Using that as an example you could set this as the equipscript for your robe. It has not been tested but I think it will work. Any item using this script will change colour.
The script will not change the colour back on removing the item however. You would do that in the unequip script.
Save it as some other name than equip.src. Perhaps coloured_equip.src. Then set the equip script entry for your robe in the itemdesc.cfg file to the name of this script. Minus the '.src' suffix ofcourse.
Code: Select all
use uo;
use os;
use cfgfile;
include "include/client";
include "include/attributes";
include "equip";
program equipweapon(who, item)
var val := HandleMods(who, item);
var col := RandomInt (10) + 1; // change the '10' to however many different colours you wish to have
// The 'case' statement sets the appropriate colour based on what the value of 'col' is
// You can add more options to the case statement or remove some if you have fewer choices of colours
case (col)
1 : item.color := o; // change 0 to the appropriate number
2 : item.color := o; // change 0 to the appropriate number
3 : item.color := o; // change 0 to the appropriate number
4 : item.color := o; // change 0 to the appropriate number
5 : item.color := o; // change 0 to the appropriate number
6 : item.color := o; // change 0 to the appropriate number
7 : item.color := o; // change 0 to the appropriate number
8 : item.color := o; // change 0 to the appropriate number
9 : item.color := o; // change 0 to the appropriate number
10 : item.color := o; // change 0 to the appropriate number
endcase
return val;
endprogramYou can also do...
Code: Select all
se uo;
use os;
use cfgfile;
use util;
include "include/client";
include "include/attributes";
include "equip";
program equipweapon(who, item)
var val := HandleMods(who, item);
var colors := array{ 2, 3, 4, 5, 6 }; // Add all colors within the brackets seperated by commas.
var rand := RandomInt(colors.size()) + 1;
item.color := colors[rand];
endprogram-
Ninja
-
Firedancer
- Grandmaster Poster
- Posts: 104
- Joined: Fri Feb 03, 2006 6:32 am
actually that is the script for the robeNinja wrote:so when i do that, i still have to make a script for the robe correct? or thats all i need to do?
You gotta compile it though and you have to edit the robe-entry in your itemdesc.cfg file, telling it that this script should be started upon equipping it.
-
Ninja
OK first you will need to look in the file named objtypes.txt that exists in \pol folder. Look for a number above 0x4000 that is not used. Write it down.
Now load up the itemdesc.cfg file in \pol\pkg\skills\tailoring. Look for the entry for a robe. It will look like this:
You will want to copy that entry. Everything from the word Armor to the } and paste it in the file again. Working with the newly added robe entry, enter the number you got from the objtypes.txt file in the newly pasted entry replacing the one after the word Armor. Let's assume you saved your special colour changing script in the combat folder as robecolour.src and compiled it. See in the entry where it says " equipscript :combat:equip:"? You will need to change that to read equipscript :combat:robecolour
You will need to give your robe a new name. So for now I'll call it robeofcolour. You need to put that in the Name field. To make it display as "a robe of colour" when you single click on it you would add a desc field as well. Your entry for the new robe will look something like this:
Note that if your robe is going to be a special robe granting better armour rating you can edit the AR field to raise it's armour rating. Higher number is better.
Remember that you need to compile the special script for it to work. Also when making edits to itemdesc files you must shutdown and restart POL for the new changes to take effect.
Now assuming you did everything correctly, once you restart POL and log in you simply do .create robeofcolour (or whatever name you gave it) and voilla' you have your robe. When you put it on it should change to whatever random colour it is supposed to.
Now load up the itemdesc.cfg file in \pol\pkg\skills\tailoring. Look for the entry for a robe. It will look like this:
Code: Select all
Armor 0x9945
{
Name Robe
Graphic 0x1f03
AR 4
Coverage Body
Coverage Legs/feet
Coverage Arms
VendorSellsFor 68
VendorBuysFor 34
maxhp 20
dyeable 1
equipscript :combat:equip
unequipscript :combat:unequip
controlscript :combat:itemControl
destroyscript :combat:destroy
}
You will need to give your robe a new name. So for now I'll call it robeofcolour. You need to put that in the Name field. To make it display as "a robe of colour" when you single click on it you would add a desc field as well. Your entry for the new robe will look something like this:
Code: Select all
Armor <insert the unused number from objtypes.txt here>
{
Name robeofcolour
Desc robe of colour
Graphic 0x1f03
AR 4
Coverage Body
Coverage Legs/feet
Coverage Arms
VendorSellsFor 68
VendorBuysFor 34
maxhp 20
dyeable 1
equipscript :combat:robecolour
unequipscript :combat:unequip
controlscript :combat:itemControl
destroyscript :combat:destroy
}
Remember that you need to compile the special script for it to work. Also when making edits to itemdesc files you must shutdown and restart POL for the new changes to take effect.
Now assuming you did everything correctly, once you restart POL and log in you simply do .create robeofcolour (or whatever name you gave it) and voilla' you have your robe. When you put it on it should change to whatever random colour it is supposed to.