| 11-10-2004, 09:45 PM | #1 |
ok i need to know how to make a banking system... yes it's old but who cares... any comments would be most appreciated ![]() |
| 11-10-2004, 10:46 PM | #2 |
Well, the easiest would be a string format. I don't have enough time to draft you up the exacty trigger, but then again that's not what we are here to do. :) Events: Players enters a chat string with "-" as (the first character, don't rememebr if you can say that in events or conditions) Conditions: --- Actions: Convert triggering chat string to an intiger from character 2 to 5. If-triggering player has at least amount of gold as intiger Then-(multiple actions) -remove gold from player, set PlayerGold[# of triggering player] to (PlayerGold[# of triggering player] + string integer.) -display message for player "(string integer) gold despeted" Else-Display message for player "you don't have enough gold" By god that was poorly done on my part, but I hope you understand. The 2, 5 in the actions are for the string characters. - X X X X 1 2 3 4 5 So if someone typed -1035 It would extract the numbers 1035 as they are from space 2 to 5. You would need to modify the trigger so the spacing is correct for something like "-deposit XXXX" or "-withdraw XXXX". The PlayerGold[#of triggering player] being an array of course. Hope that helped, and if it didn't I'm sorry. Just speak up if you don't understand anything and I'll try to help you out. |
| 11-11-2004, 01:00 AM | #3 |
hmm yes that was rather confuzing... here's what i got out of it... and if you wouldn't mind i'd appreciate if you would give me the exact triggers like this (which is what i got from your repsonse) Deposit Events Player - Player 1 (Red) types a chat message containing -deposit as An exact match Conditions (String((Integer((Entered chat string))))) Equal to (Substring((Entered chat string), 1, 5)) Actions Set Deposit_P1 = (Entered chat string) If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions (Player 1 (Red) Current gold) Greater than or equal to (Length of Deposit_P1) Then - Actions Set Bank_P1 = (Bank_P1 + (Length of Deposit_P1)) Player - Set Player 1 (Red) Current gold to ((Bank_P1 - (Length of Deposit_P1)) - 1) Game - Display to (All players) the text: (Deposited + (Entered chat string)) Else - Actions Do nothing |
| 11-11-2004, 01:48 AM | #4 |
There are a few errors in there, but it was very good for a first try. Give me... oh say an hour to get my work done then I'll whip it up for you. |
| 11-11-2004, 02:23 AM | #5 |
hey thanks you the man ![]() |
| 11-11-2004, 02:43 AM | #6 |
Code:
Banking
Events
Player - Player 1 (Red) types a chat message containing -deposit as A substring
Player - Player 2 (Blue) types a chat message containing -deposit as A substring
Player - Player 3 (Teal) types a chat message containing -deposit as A substring
Conditions
(Substring((Entered chat string), 1, 9)) Equal to -deposit
Actions
Set bankAmount = (Integer((Substring((Entered chat string), 10, 13))))
-------- "bankAmount" is an integer variable. --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
bankAmount Greater than or equal to 1
((Triggering player) Current gold) Greater than or equal to bankAmount
Then - Actions
Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - bankAmount)
Set playerBank[(Player number of (Triggering player))] = (playerBank[(Player number of (Triggering player))] + bankAmount)
-------- "playerBank" is an integer array from 1 to 16 (the number of players in a game). This, combined with the player#, enables you to have up to 16 different variables that each store a gold ammount for the individual player. --------
Game - Display to (All players matching ((Matching player) Equal to (Triggering player))) the text: (You have deposited + ((String(bankAmount)) + ( gold into your bank for a total of + ((String(playerBank[(Player number of (Triggering player))])) + gold.))))
Else - Actions
Game - Display to (All players matching ((Matching player) Equal to (Triggering player))) the text: Either this is inco...
Set bankAmount = 0Now, minor details: The two variables I used are described in the comment fields in the trigger. Copy and paste the conditions that you want and simply change the player number for each player you want to be able to use the bank. My substring numbers are actualy correct if you count them, remember to always put a space after the deposit text so it is "-deposit ". (Notice the space after it.) To make a withdraw trigger simple change the propper objects. The "-withdraw " string would be 1 to 10, and the number after it is from 11 to 14. Instead of checking if the player has enough gold currently, remember to check how much he has in his bank. (greater or equal to "playerBank[(Player number of (Triggering player))]".) Also, here is the text from the Else Actions, it can be whatever you want, but remember to make it helpful to the player. "Either this is incorrect format or you do not have enough gold. Please use "-deposit XXXX" replacing the X's with the amount. (Insert zeros if the amount is less then four numbers.)" Well, that's how I do it. You might want to request someone else check it over, as I have a serious eye-irritation and can't see very well right now. (Can't find some bloody eye drops.) Hope I helped out and you understand it! Oh, and I normaly think it's rude to ask for rep, but if you feel like giving me some it would be great! (Trying to build up some rep for my soon-to-open StockMarket Business.) Thanks man, and good luck. :god_help_us: ![]() |
| 11-11-2004, 05:01 AM | #7 |
hey thanks again ![]() |
