Eclipse - Free 2D Mmorpg Maker
September 02, 2010, 10:22:40 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 314piwm
[Today at 10:21:04 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: Portal System  (Read 2217 times)
0 Members and 1 Guest are viewing this topic.
January 29, 2006, 10:06:25 PM
Similac Child
Owner
Demi God
*
User No : 13358
Posts: 7477
  • 1425 credits
  • View Inventory
  • Send Money To Marsh
  • Comfort the disturbed disturb the comfortable
    • View Profile
    • WWW
    Made by: Unknown_Raven

    Ok once again I have finished another tutorial. I hope you enjoy this script as it took me 2 and a half hours to make.

    Description: Ok what this does is it allows you to create scripted tiles that the user steps on and a list of locations are displayed. The player then can type the command /warpkey <location number> and then step on the scripted tile once more and they are instantly warped to the new location. The script was designed to be flexable so you can within a few minutes setup other warps with a completely new list or number of selections. Like all my scripts there is a little bit of scripting knowledge required but I am sure it will not take much to figure it all out.

    Installation
    First thing you have to do is copy and paste this at the bottom of your main.txt.



    Code: [Select]
    ' *********************
    ' * Portal System 1.0 *
    ' * Made by: Grey     *
    ' *********************
    Sub SetWarpKey(index, keynum)
          Call PutVar("accounts\" & GetPlayerLogin(index) & ".ini ", "CHAR" & GetPlayerCharNum(Index), "WarpKey", cdbl(keynum))
    End Sub

    Sub SetupWarpFile(warpkeys)
       x = 1
       Do While x <= warpkeys
      Call PutVar("Warps.ini", "AREA1", "name" & x, "blank")
      Call PutVar("Warps.ini", "AREA1", "map" & x, 0)
      Call PutVar("Warps.ini", "AREA1", "X" & x, 0)
      Call PutVar("Warps.ini", "AREA1", "Y" & x, 0)
      x = x+1
       Loop
    End Sub

    Sub WarpList(index, area, keys)
       Call PlayerMsg(index, "Please type /warpkey <keynum> then step on this warp again to be transfered to the desired location.", 15)
       Call PlayerMsg(index, "WARP LIST", 2)
       x = 1
       Do While x <= keys
      Call PlayerMsg(index, x & ".) " & GetWarpName(area, x), 2)
           x = x+1
         Loop
    End Sub

    Sub Warp(index, area, key)
       Call setwarpkey(index, 0)
       Call PlayerMsg(index, "You were warped to the " & GetWarpName(area, key), 14)
       Call PlayerWarp(index, GetWarpMap(area, key), GetWarpX(area, key), GetWarpY(area, key))
    End Sub
     
    Function GetWarpName(areanum, keynum)
                GetWarpName = Trim(GetVar("Warps.ini", "AREA" & areanum, "name" & keynum))
    End Function
       
    Function GetWarpMap(areanum, keynum)
                GetWarpMap = Int(GetVar("Warps.ini", "AREA" & areanum, "map" & keynum))
    End Function

    Function GetWarpX(areanum, keynum)
                GetWarpX = GetVar("Warps.ini", "AREA" & areanum, "X" & keynum)
    End Function

    Function GetWarpY(areanum, keynum)
                GetWarpY = GetVar("Warps.ini", "AREA" & areanum, "Y" & keynum)
    End Function  

    Function GetWarpKey(index)
         GetWarpKey = GetVar("accounts\" & GetPlayerLogin(index) & ".ini ", "CHAR" & GetPlayerCharNum(Index), "WarpKey")
    End Function


    Next we need to add this at the top of the main.txt right in the section JoinGame(index)


    Code: [Select]
    If GetPlayerExp(index) = 0 Then
          If GetPlayerLevel(index) = 1 Then
             Call SetWarpKey(index, 0)
          End If
    End If


    Next you have to go into the /commands area of the main.txt and insert this code. Insert it at the bottom of the sub but make sure it is in the right section. It is quite easy to tell this by looking at the format of the script. You should see other scripts above it that use the "x = int(textsay)"

    Code: [Select]
    If LCase(Mid(TextSay, 1, 8)) = "/warpkey" Then
            If Len(TextSay) > 9 Then
                TextSay = Mid(TextSay, 9, Len(TextSay) - 8)
                x = Int(TextSay)
                If IsNumeric(x) Then        
                   If x > 0 Then
                  Call PlayerMsg(index, "Location Set.", 14)
                  Call SetWarpKey(index, x)  
                   End If                      
                End If        
            End If
            Exit Sub
        End If


    Now that you have installed the /warpkey command it is time to setup the scripted tiles. Find the section for scripted tiles and for case 0 or whatever case you want it as paste this.

    Code: [Select]
    Case 0
    ' this is for resetting players warp key
            Call setwarpkey(index, 0)


    Preferably paste this next part under case 1. You can however choose another empty case if case 1 is in use.
    Code: [Select]

    Case 1
            ' warp for area 1 maps
            key = GetWarpKey(index)
            If key = 0 Then
               Call WarpList(index, 1, 5)
            Else
               If key <= 5 Then ' set 5 to the max warpkey
                   Call Warp(index, 1, key)
                End If
            End If


    Ok, case one is known as the exit and case 1 is the warp. When the player steps on case 0 it sets their warp selection to 0 which makes it impossible for them to warp if they should step on the case 1 scripted tile. The idea is to place the case 0 around the case 1 tiles but leaving atleast one square of space between the two.

    Next you must make the warps.ini file. First make a new .ini file and be sure to call it "Warps". Next copy this and paste it inside.

    Code: [Select]
    [AREA1]
    name1=Darkfields
    map1=7
    X1=5
    Y1=5
    name2=Woods
    map2=6
    X2=5
    Y2=5
    name3=Castle
    map3=1
    X3=1
    Y3=1
    name4=blank
    map4=1
    X4=1
    Y4=1
    name5=blank
    map5=1
    X5=1
    Y5=1



    What you must do now is fill in the locations with names and coordinates. You can easily add more locations or even an entirely new area. All you have to do is adjust the numbers. For instance look at this example.

    Code: [Select]
    [AREA1]
    name1=Darkfields
    map1=7
    X1=5
    Y1=5
    name2=Woods
    map2=6
    X2=5
    Y2=5
    name3=Castle
    map3=1
    X3=1
    Y3=1

    [AREA2]
    name1=blank
    map1=7
    X1=5
    Y1=5
    name2=Fire Palace
    map2=6
    X2=5
    Y2=5
    name3=Moon
    map3=1
    X3=1
    Y3=1


    How it works:
    The player will step onto case 1 and it will show them the list of locations to warp. They then walk off of the scripted tile and type /warpkey <num>. The number they fill in is the location they wish to warp to. After they have selected a place they step back onto the warp tile and wham they are wvooshed away. This is why you need to leave atleast one square of space between case 0 and case 1 tiles.

    Adjustments
    Ok now as you can see some of the commands have already been filled in with numbers. Note the "Call WarpList" The 1 you see is set for the area the list will look in and the 5 is to signify how many possible warp locations there are.

    Now I will breifly go over all the handy commands that have been added.



    Code: [Select]
    GetWarpName(area, key)

    -Gets the Location name for the specified area and key.

    Code: [Select]
    GetWarpMap(area, key)

    -Gets the location map number.


    Code: [Select]
    GetWarpX(area, key)

    -Gets the location X coordinate.


    Code: [Select]
    GetWarpY(area, key)

    -Gets the location Y coordinate.


    Code: [Select]
    GetWarpKey(index)

    -Gets the Key Value the player currently has set in their account file.


    Code: [Select]
    Call SetWarpKey(index, keynum)

    -Used to set a key value within their accounts file.



    Code: [Select]
    SetupWarpFile(warpkeys)

    -This actually can setup a Warps.ini file within seconds but only for area1. Just fill in warpkeys with the ammount of locations you want within area1.


    Code: [Select]
    WarpList(index, area, keys)

    -Displays a list of locations for the specified area. Keys must be filled in with the max number of locations. Say Area1 goes all the way up to map5, x5, y5 then your keys value would be 5.


    Code: [Select]
    Warp(index, area, key)

    -This command warps the player to the specified area location key. Just fill in the area and key number.
    Logged

    don't call your mother - don't call your priest
    don't call your doctor - call the police
    you bring the razor blade - I'll bring the speed
    Take off your coat - it's gonna be a long night
    January 30, 2006, 01:30:29 AM
    Lord Of Spleens
    Administrator
    Teh Uberleet
    *
    User No : 166
    Posts: 2951
  • 0 credits
  • View Inventory
  • Send Money To Baron
  • Location : Australia
    Badges? We dont need no stinkin' badges!
    • View Profile
    Hrmmm, quite a complicated script for a relatively simple concept.

    I may post a much simpler and more versatile version then the one currently here soon that has a similar effect.
    Logged


    Apparently ICT thinks that:
    [ 98% of Eclipse forums thinks baron is cool. Put this in your signature if you are on of the 2% that knows he's an asshôle ]

    If I'm only pissing 1 in 50 people off, I don't think that is too bad at all :D
    January 30, 2006, 02:35:47 AM
    Active Member
    ***
    User No : 147
    Posts: 104
  • 0 credits
  • View Inventory
  • Send Money To Darkwolf
    • View Profile
    Thats the problem with scripting in Eclipse at the moment. Thinga are overly complicated and don't always work.
    Logged
    January 30, 2006, 03:41:14 AM
    Lord Of Spleens
    Administrator
    Teh Uberleet
    *
    User No : 166
    Posts: 2951
  • 0 credits
  • View Inventory
  • Send Money To Baron
  • Location : Australia
    Badges? We dont need no stinkin' badges!
    • View Profile
    Right. scripts work perfectly if you know what you're doing. Look at this script here for a warp back to town style portal system.

    http://www.createforum.com/phpbb/viewtopic.php?t=921&mforum=marsh0

    Only involves creating one folder, pasting in 2 sets of dims and pasting 2 sections of code.

    Lets you jump back to your last touched "portal" spot (like in a  town)

    This code sets up the BASIC FRAMEWORK for a town portal system. With very little scripting you could modify the script so that it worked similar to diablo 2's waypoint system, letting you make a map thatd only take you back to a location if you had been there before.
    Logged


    Apparently ICT thinks that:
    [ 98% of Eclipse forums thinks baron is cool. Put this in your signature if you are on of the 2% that knows he's an asshôle ]

    If I'm only pissing 1 in 50 people off, I don't think that is too bad at all :D
     


    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.246 seconds with 30 queries.