Eclipse - Free 2D Mmorpg Maker
September 02, 2010, 10:18:30 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Shop Arcade chat Login Register  
 
 
   
 
collapse

* No Spam Or Websites

Refresh History
  • Ertzel: So... Anyone with basic/none/limited photoshop or even paint skills want to make some money converting sprites for me?
    Today at 10:07:35 PM
  • Gamma™: weaver why are you oflfine on H&H? :S
    Today at 10:04:26 PM
  • Ertzel: Ya, only one try per knife, my one try failed :(
    Today at 10:00:17 PM
  • LegendWeaver: is it one use?
    Today at 09:43:15 PM
  • Ertzel: Wish I didnt spend my 1k+ credits to buy the stupid knife that failed at stealing Robins credits >.<
    Today at 09:42:42 PM
  • Wraith: ) Kreator!
    Today at 09:06:52 PM
  • Wraith: yes! you were! (in red text
    Today at 09:06:46 PM
  • ToshiroHayate: Kreator!
    Today at 08:25:02 PM
  • Kreator: o_0 Was I supposed to Wraith?
    Today at 08:16:02 PM
  • [Pie] ICT: Don't worry.. I commented.
    Today at 07:55:08 PM
  • Wraith: Ay, kreator, wtf is up with you not posting anything about my new cliffs??
    Today at 07:50:36 PM

* Recent Topics

[EO] Attaching Problem. by Ertzel
[Today at 10:11:57 PM]


Project Vertigo [2d Tile-based Side-Scrolling Engine] by Miguu
[Today at 10:03:22 PM]


Zacaras Empire (Hiring) by Ertzel
[Today at 08:43:54 PM]


custom cliff tiles by ToshiroHayate
[Today at 08:29:15 PM]


.: RPG Kingdom :. by LegendWeaver
[Today at 08:25:20 PM]


What do you think? by [Pie] ICT
[Today at 07:54:54 PM]


[Show Off] Aztec Stuff by [Pie] ICT
[Today at 07:50:07 PM]


So I herd you liek mudkipz by Kreator
[Today at 07:36:52 PM]


Haven and Hearth: Epic Screenshot Thread by Tompwnage™
[Today at 07:14:21 PM]


The Lonliest Star [RP] by DDunit
[Today at 07:09:46 PM]


* Who's Online


Site Author : Topic: Dice Rolling Game (script submission, 2/5 difficulty)  (Read 3150 times)
0 Members and 1 Guest are viewing this topic.
June 16, 2006, 05:46:38 AM
The Uber-Scriptor
Advanced Member
****
User No : 375
Posts: 590
  • 0 credits
  • View Inventory
  • Send Money To Ilnair
  • Location : Netherlands, The
    The Uber-Scriptor
    • View Profile
    • WWW
    And another nice script from me.

    Difficulty:
    Newb: 2/5
    Advanced Scripter: 0/5
    Me/Unnown/Baron (:D): like -200/5
    In short, very easy to use script.


    It works like this, inside a casino, a player can buy Game Coins, and a Game Dice. If a player uses the dice, he will lose 1 game coin (or a few, it depends on what you want). After that, 2 dices will roll, and if the number rolled is higher than the number the computer rolled previously, you'll win 60% of all Game Coins players lost by rolling the dice. If he loses, his coin will be gone, and someone else can try it.

    Anyway, here it goes.

    Step 1: Create a game dice. Make it a scripted item, and make it run script X (ie: 1 or 2).

    Step 2: Find Sub ScriptedItem, and add the following below End Select:
    Code: [Select]
    Case X
        Call CasinoDiceGame(index)
    Exit Sub

    And replace X by the number you used. If you can not find Sub ScriptedItem, please enter this at the bottom of you main:
    Code: [Select]
    Sub ScriptedItem(index, Script)
    Select Case Script
    Case X
        Call CasinoDiceGame(index)
    Exit Sub
    End Select
    End Sub

    And once again, replace X by the number you used.


    Step 3: enter the following script at the bottom of your main, and replace cost=int(1) by the number of coins you want gambling to cost, and replace Int(83) by the item number of your game coins:

    Code: [Select]
    '****************************************************************
    'Dice Script, ©Dinand Mentink - ILNAIR!!!!!
    '****************************************************************

    Sub CasinoDiceGame(index)
    Dim diceroll1
    Dim diceroll2
    Dim diceroll
    Dim prevroll
    Dim item
    Dim itemvalue
    Dim itemslot
    Dim jackpot
    Dim cost
    Dim prevroller

    cost = Int(1)
    item = Int(83)
    itemslot = Int(GetPlayerInvItemSlot(index, item))

    If itemslot = 0 Then
    Call PlayerMsg(index, "You do not have any Game Coins!", 12)
    Exit Sub
    End If

    itemvalue = Int(GetPlayerInvItemValue(index, itemslot))

    If itemvalue < cost Then
    Call PlayerMsg(index, "You do not have enough Game Coins to play!", 12)
    Exit Sub
    Else
    prevroller = GetVar("vars.ini", "Dice", "prevroller")

    If prevroller = GetPlayerName(index) Then
    Call PlayerMsg(index, "Give someone else a chance!", 12)
    Exit Sub
    End If

    Call PutVar("vars.ini", "Dice", "prevroller", GetPlayerName(index))

    prevroll = Int(GetVar("vars.ini", "Dice", "prevroll"))
    jackpot = Int(GetVar("vars.ini", "Dice", "jackpot"))

    diceroll1 = Int((6 - 1 + 1) * Rnd) + 1
    diceroll2 = Int((6 - 1 + 1) * Rnd) + 1
    diceroll = Int(diceroll1 + diceroll2)

    If diceroll > prevroll Then
    Call GlobalMsg(GetPlayerName(index) & " rolls the powerdice and" & " rolls a " & diceroll1 & " and a " & diceroll2 & "! This is " & diceroll & " in total and wins!", 10)
    Else
    Call GlobalMsg(GetPlayerName(index) & " rolls the powerdice and" & " rolls a " & diceroll1 & " and a " & diceroll2 & "! This is " & diceroll & " in total and loses!", 12)
    jackpot = Int(jackpot + cost)
    Call PutVar("vars.ini", "Dice", "jackpot", "" & jackpot)
    Call GlobalMsg("The jackpot is " & Int(jackpot * 0.6) + 1 & " Game Coins for a " & prevroll + 1 & "!", 14)

    If itemvalue = cost Then
    Call SetPlayerInvItemNum(index, itemslot, 0)
    Call SetPlayerInvItemValue(index, itemslot, 0)
    Call SendInventoryUpdate(index, itemslot)
    Else
    Call SetPlayerInvItemValue(index, itemslot, itemvalue - cost)
    Call SendInventoryUpdate(index, itemslot)
    End If

    Exit Sub
    End If

    itemslot = GetPlayerInvItemSlot(index, item)

    If itemslot = 0 Then
    itemslot = GetPlayerInvItemSlot(index, item)
    Call SetPlayerInvItemNum(index, itemslot, item)
    Call SetPlayerInvItemValue(index, itemslot, Int(jackpot * 0.6) + 1)
    Call SendInventoryUpdate(index, itemslot)
    Else
    Call SetPlayerInvItemValue(index, itemslot, itemvalue + Int(jackpot * 0.6))
    Call SendInventoryUpdate(index, itemslot)
    End If


    prevroll = Int((11 - 5 + 1) * Rnd) + 5
    Call PutVar("vars.ini", "Dice", "prevroll", "" & prevroll)
    jackpot = Int((3 - 1 + 1) * Rnd) + 1
    Call PutVar("vars.ini", "Dice", "jackpot", "" & jackpot)
    Call GlobalMsg("The jackpot is " & Int(jackpot * 0.6) + 1 & " Game Coins for a " & prevroll + 1 & "!", 14)


    End If

    End SUb

    '****************************************************************
    'End of Dice Script!, ©Dinand Mentink - ILNAIR!!!!!
    '****************************************************************

    Step 4: create a .ini file called vars.ini, and put the following in it:
    Code: [Select]
    [Dice]
    jackpot=1
    prevroll=6
    prevroller=Ilnair
    Logged

    Ilnair
    Uber-Scriptor

    Nishansu, beta testing. Have a look at http://www.nishansu.com
    July 18, 2006, 08:40:02 PM
    Mid Scripter
    Member
    **
    User No : 1174
    Posts: 40
  • 0 credits
  • View Inventory
  • Send Money To Cantinfla
  • Location : The continent of Akaran...
    • View Profile
    I tried and failed so I got a question, how you start the dice game?

    Can I make it like if you step on a scripted tile, it plays the dice game?
    Since I wana make a casino like place...
    Logged

    Status = ""

    Proud to be...
         
    July 19, 2006, 09:29:02 AM
    The Uber-Scriptor
    Advanced Member
    ****
    User No : 375
    Posts: 590
  • 0 credits
  • View Inventory
  • Send Money To Ilnair
  • Location : Netherlands, The
    The Uber-Scriptor
    • View Profile
    • WWW
    Well, I'm using a scripted item, called dice. But you could make an npc/scripted tile/command, just run the same sub.
    Logged

    Ilnair
    Uber-Scriptor

    Nishansu, beta testing. Have a look at http://www.nishansu.com
    July 20, 2006, 04:35:17 PM
    Active Member
    ***
    User No : 658
    Posts: 144
  • 0 credits
  • View Inventory
  • Send Money To Lee_Dragoon
    • View Profile
    Yay! I love games for players! thank you!
    Logged
    November 11, 2007, 01:36:33 PM
    Chit Chat God
    Demi God
    User No : 4374
    Posts: 6389
  • 2011 credits
  • View Inventory
  • Send Money To Bone
  • Location : All up in this shiznit
    [SB] Commodore
    • View Profile
    Is this right?

    cost = Int(1)
    item = Int(5)
    itemslot = Int(GetPlayerInvItemSlot(index, item))

    or is this right?

    cost = 1
    item = 5
    itemslot = Int(GetPlayerInvItemSlot(index, item))



    tell me please
    Logged

    Admiral for President...

    Quote
    "With it we will all find peace and love, and learn to accept each other for who we are, because we all have one common purpose in life, and that is to enjoy its taste"
    - From the Gospel, JBA 5:18


    January 29, 2008, 07:19:48 PM
    Newb
    *
    User No : 5252
    Posts: 7
  • 0 credits
  • View Inventory
  • Send Money To Kiath
    • View Profile
    Awsome!
    Logged
    January 29, 2008, 07:35:57 PM
    Chit Chat God
    Demi God
    User No : 4374
    Posts: 6389
  • 2011 credits
  • View Inventory
  • Send Money To Bone
  • Location : All up in this shiznit
    [SB] Commodore
    • View Profile
    Awesome it is ;)

    But try not to post when its not neccesary
    Logged

    Admiral for President...

    Quote
    "With it we will all find peace and love, and learn to accept each other for who we are, because we all have one common purpose in life, and that is to enjoy its taste"
    - From the Gospel, JBA 5:18


    January 30, 2008, 09:29:32 AM
    Newb
    *
    User No : 5252
    Posts: 7
  • 0 credits
  • View Inventory
  • Send Money To Kiath
    • View Profile
    sorry :-[
    Logged
    February 16, 2008, 06:48:38 AM
    Teh Awesomeness
    Newb
    *
    User No : 5704
    Posts: 12
  • 0 credits
  • View Inventory
  • Send Money To Jewel
  • Location : Right behind you...
    I bet 3 dollars you are reading my personal text
    • View Profile
    the script looks cool, I have no use for it but it still looks cool, great job!
    Logged


    He is so cool!!!
     


    Powered by MySQL Powered by PHP Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
    SimplePortal 2.3.1 © 2008-2009, SimplePortal
    Valid XHTML 1.0! Valid CSS!
    Page created in 0.303 seconds with 30 queries.