|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Novice
Join Date: Dec 2006
Posts: 480
|
Hey guys, I'm just trying to make an item. it has a custom name. example: "a piece of pie" now, the graphic I used was NOT a stackable graphic, so in the items property section I have "stackable = true ;" and that works fine, and the item stacks, however after more than one, it says " 2 a piece of pie". I need it to say "2 pieces of pie" obviously.
What I was thinking I would do is have an IF statement something like the following... Code:
If (m.Amount > 1)
{
name = "pieces of pie" ;
}
![]() first of all: where in the script do I put the if statement, and what did I do wrong with it ? im running 2.0 RC1, and here is how the script looks: Code:
using System;
using Server.Network;
using Server.Items;
using Server.Targeting;
namespace Server.Items
{
public class pieceofpie : Item
{
[Constructable]
public pieceofpie()
: base(12696)
{
Name = "A Piece Of Pie";
Stackable = true;
}
public pieceofpie( 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();
}
}
}
__________________
legendsofkaine.page.tl
|
|
|
|
|
|
#2 (permalink) |
|
Newbie
Join Date: Nov 2007
Location: indiana
Age: 45
Posts: 52
|
hi...
try this: Code:
using System;
using Server.Network;
using Server.Items;
using Server.Targeting;
namespace Server.Items
{
public class pieceofpie : Item
{
[Constructable]
public pieceofpie(int amount)
: base(12696)
{
Name = "A Piece Of Pie";
Stackable = true;
Amount = amount;
}
public pieceofpie( 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();
}
}
}
hope this helps henry_r edit to add: after looking at your post closer...and looking at a few items in-game... take *empty bottle* for example; 1 bottle is *empty bottle*, 50 bottles stacked are *50 empty bottle*. it might be easier to rename *A piece of pie* to simply *piece of pie*. it wont be correct grammatical form, but your players will know what it is. edit 2 if you use CheeseSlice (base 0x97C) it looks like a slice of pie and has a stackable graphic counterpart ill shut up now ![]()
__________________
Scripts: Compiling C# scripts...done (0 errors, 0 warnings) WOOHOO Last edited by Henry_R; 03-19-2008 at 08:18 PM. |
|
|
|
![]() |
| Bookmarks |
| Tags |
| ifstatement, issues |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|