greetings all, this is very poor attempt (to the best of my c# knowledge) to create a system from scratch...

logic:
have an investment bag, once in a bankbox, you can add money to it. the money gets converted into an investmentcheck
the interest system provides interest to any investment checks in the world every hour (this system is separate and works well)
the investmentcheck is not movable, and once double clicked, gives the money back to the person in the form of a bankcheck in the player's bankbox

i've done TONS of errors and it won't compile - i did add comments to say what i intended for some clarity though... any help is appreciated.
 

Attachments

  • InterestBag.cs
    2.1 KB · Views: 1
  • InvestmentCheck.cs
    2.5 KB · Views: 1
hi all, i realize the above was a bit much for me to ask ...
I've since made the above compile and it does work as intended save for one thing.

When gold is dropped in the interestbag, i was the creation of a new investmentcheck
but, i also need to look inside the bag to see if there is already an investmentcheck there. If so, add to that amount.

in the code below, if the bag is empty it skips to the return false at the end, skippin the else... would anyone know why?

C#:
                    List<Item> ItemsInBag = this.Items;
                    if (ItemsInBag != null)
                    {
                        from.SendMessage( "items found in bag" );
                        for( int z = 0; z < ItemsInBag.Count; z++ )
                        {
                            Item inBag = ItemsInBag[z];
                                from.SendMessage( "checking in bag, found " + inBag );

                            if( inBag is InvestmentCheck )
                            {
                                from.SendMessage( "adding to investmentcheck" );
                                ((InvestmentCheck)inBag).Worth += investment;
                                dropped.Delete();
                                from.PlaySound( 0x42 );
                                from.SendMessage( "You add " + investment + " gold to your investment" );
                                return true;
                            }

                        }
                    }
                    else
                    {
                        from.SendMessage( "no items in bag" );
                        from.SendMessage( "placing new investmentcheck" );
                        this.AddItem(new InvestmentCheck( investment ));
                        dropped.Delete();
                        from.PlaySound( 0x42 );
                        from.SendMessage( "You make a new investment for " + investment + " gold." );
                        return true;
                    }
                    from.SendMessage( "didn't find items in bag, but the else didn't kick in...?????" );                   
                    return false;
Post automatically merged:

this thread can be removed, i've now created this system and will put in the releases :D
 
Last edited:
Back