RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[RUO 2.0] Shard Voting

Orbit Storm

Sorceror
okay but how can I create anothwer stone? wich files should I copy, Votestone or configscript?

As Vorspire said, one vote-site, per stone. Simply add (and configure) a new stone for each voting site you've registered your server with. No need for "copying scripts", etc.
 

davidovo

Page
yeah but when I do it like this, When player used it after a server restart the server crash maybe its another items who bugged but it was everytime we dclick on a new stone that we config mannually, the server crashed 5 time in a row.
 

Pure Insanity

Sorceror
You have to setup the vote sites correctly, as the stones aren't programmed with checks to keep it from crashing (if you use one without setting it up properly.)
 
Here's my sloppy code I added to give tokens and a chance for a reward item (which you will have to make). I hope it works for you but it seems to work nice on my shard. Just wanted to contribute.

Code:
  public override void OnVote(Mobile m, VoteStatus status)
        {
            base.OnVote(m, status);

            if (status == VoteStatus.Success)
                m.AddToBackpack(new 
                    Tokens(5000));
              if( Utility.Random( 34 ) < 34 ) 
            switch ( Utility.Random( 34 ))
            {
                 case 0 - 29:
                break;
                case 30:
                    
                        m.AddToBackpack(new VoteHalf());
                       break;
                case 31:
                    {
                         
                        m.AddToBackpack(new VoteEarrings());
                       
                        break;
                    }

                   

                case 32: // Voterobe
                    {
                       
                        m.AddToBackpack(new VoteShroud());
                      
                                               
                                                break;
              
                    }
                case 33: // Vote Sandals
                    {
                        
                        m.AddToBackpack(new VoteSandals());
                       
              break;
                    }
            }
        
        }

Let me know if I did anything wrong or if there are possible improvements.. I'm learning myself.
 

Baranein

Traveler
I use this, and works perfectly. But When I add an extra item on the OnVote line, even when they cant vote again they get the item. If I put it in front of the gold, then they get the gold even when they cant make another vote.
Code:
public override void OnVote( Mobile m, VoteStatus status )
{
    base.OnVote( m, status );
    if( status == VoteStatus.Success )
        m.AddToBackpack( new VoteTokens( 1000 ) );
        m.AddToBackpack( new Gold( 1000 ) );   
}

So using that code, when they vote they get 100 vote tokens, and 1000 gold. If they click the stone immediatly again, they get another 1000 gold. And they can just keep clicking stone and getting gold, even though they cant vote.
 

Vorspire

Knight
The second line of code is always "out of scope" in respect to the "if" statement that checks the status.
Just wrap it up with some curly braces:
Code:
public override void OnVote( Mobile m, VoteStatus status )
{
    base.OnVote( m, status );

    if( status == VoteStatus.Success )
    {
          m.AddToBackpack( new VoteTokens( 1000 ) );
          m.AddToBackpack( new Gold( 1000 ) );
    }
}
 

fwiffo

Sorceror
I always like your systems, clean, OO, customizable, maybe they always need some tweak, but that's part of the fun!

Thank you!
 

MrNice

Squire
I got this crash when a player went to double click the stone after he already got his rewards:

error

Code:
RunUO Version 2.2, Build 4819.33330
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
.NET Framework: 2.0.50727.5420
Time: 3/23/2013 2:13:46 PM
Mobiles: 18967
Items: 152357
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
  at Server.Voting.VoteEvents.OnVoteRequest(VoteRequestEventArgs e)
  at Server.Voting.VoteEvents.InvokeVoteRequest(VoteRequestEventArgs e)
  at Server.Voting.VoteItem.CastVote(Mobile from)
  at Server.Voting.VoteItem.OnDoubleClick(Mobile from)
  at Server.Mobile.Use(Item item)
  at Server.Engines.XmlSpawner2.XmlAttach.UseReq(NetState state, PacketReader pvSrc)
  at Server.Network.MessagePump.HandleReceive(NetState ns)
  at Server.Network.MessagePump.Slice()
  at Server.Core.Main(String[] args)
 
Top