|
||
|
|||||||
| Custom Script Release Archive This is a pre-script database archive of what our users had released. |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Newbie
|
Hey,
I made a gift for my players today and thought I would pass it on. It's a random colored HalloweenMask with nightsight and stam regen. You don't need a flashlight and you are running on a sugar high ![]() I don't know the 'proper way' to add a new item to a player's pack so I just add a few lines to PlayerMobile.cs Serialize routine. It takes a couple of [restarts but it works: Code:
HalloweenMask HMask = new HalloweenMask();
HMask.Name = this.Name + "'s Halloween Mask";
AddToBackpack( HMask );
base.Serialize( writer );...
Code:
/*
10/29/05
by Korbas
Beefed up tribal mask.
No need for a flashlight!
Enough sugar energy to keep going all night long!
*/
using System;
using Server.Items;
namespace Server.Items
{
public class HalloweenMask : BaseHat
{
public override int BasePhysicalResistance{ get{ return 7; } }
public override int BaseFireResistance{ get{ return 7; } }
public override int BaseColdResistance{ get{ return 7; } }
public override int BasePoisonResistance{ get{ return 7; } }
public override int BaseEnergyResistance{ get{ return 7; } }
[Constructable]
public HalloweenMask() : base( 0x154B )
{
// Big 6 colors: Black, Ice, Blaze, Toxic, Electrum and Platinum
int[] Hues = { 0x0001, 0x0480, 0x0489, 0x04F8, 0x04FE, 0x0481 };
Name = "Halloween Mask";
Weight = 1.0;
Hue = Hues[ Utility.Random ( Hues.Length ) ];
LootType = LootType.Blessed;
Attributes.NightSight = 1;
Attributes.RegenStam = 2;
}
public HalloweenMask( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}
|
|
|
|
|
#3 (permalink) |
|
Forum Expert
|
Sorry, but that is absolutely a horrible way to add this item for players. Please dont suggest stuff like that. If you want to know how to add gifts then look up GiftGiver.cs or do a forum search. Adding this into PLayermobile.cs this way is not something you should tell people to do. It will cause more errors and headaches then you can imagine.
|
|
|
|
|
#5 (permalink) | |
|
Forum Expert
|
I don't think he was saying that addtobank/addtopack were bad, but the method Korbas recommended was not the way to do it (modifying playermobile.cs!). At least I hope he wasn't referring to your post
...Using addtobank or addto pack is perfectly fine if you want to do it manually and especially fine for small shards. Obviously though, scripting it like giftgiver is even better Quote:
|
|
|
|
|
|
#8 (permalink) | |
|
Forum Expert
|
Quote:
[global addtobank halloweenmask where playermobile - Adds item to bankboxes for any characters already created on your shard online or off. [global addtopack halloweenmask where palyermobile - Adds item to backpacks for any characters already created on your shard online or off. [addtopack halloweenmask - Lets you target a specific player to add into their backpack [addtobank halloweenmask - Lets you target a specific player to add into the bankbox [global online addtopack halloweenmask where playermobile - Adds the item to backpacks for any characters that are online currently. [global online addtobank halloweenmask where playermobile - Adds the item to bankboxes for any characters that are online currently. |
|
|
|
|
|
#9 (permalink) |
|
Forum Expert
Join Date: Mar 2003
Location: where I belong
Posts: 1,787
|
AddToBank is not a distribution command. Don't suggest it without referencing the download URL.
__________________
"Misfortune shows those who are not really friends." -Aristotle "A multitude of words is no proof of a prudent mind." -Thales |
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|