Eclipse
January 05, 2009, 06:16:33 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Chat Help Rules Arcade Search Calendar Gallery Login Register  
 
 
 
Recent Topics +-
Post Your Desktop. by Gwendalin
Today at 06:11:56 PM

New DezireSoft forums by The BanHammer! [Thor!]
Today at 06:05:55 PM

Showoff :P by The BanHammer! [Thor!]
Today at 06:03:25 PM

MOVED: Stat Command by ‪‫‬‭‮‪‫‬‭Admiral Refuge
Today at 06:02:43 PM

STOP COMPARING EVERYTHING TO RUNESCAPE by The MrMiguu™ [pizza pretzles]
Today at 06:02:16 PM

Key by The MrMiguu™ [pizza pretzles]
Today at 06:01:11 PM

Free movies? by ‪‫‬‭‮‪‫‬‭Admiral Refuge
Today at 06:00:29 PM

Gwen VS Adulese by Gwendalin
Today at 05:59:13 PM

New sprites for Lostica?! by The MrMiguu™ [pizza pretzles]
Today at 05:57:47 PM

The New Eclipse Raid on Runscape by ‪‫‬‭‮‪‫‬‭Admiral Refuge
Today at 05:57:30 PM

Members Online +-
19 Guests, 20 Users
Peter,
Gwendalin,
Simius Cruentus,
Kreator,
ʇıunpp ʎqɹıʞ࣭,
Echo ♥ Pie,
Almighty Wing,
kdjrgej,
Hikaru,
The BanHammer! [Thor!],
‪‫‬‭‮‪‫‬‭Admiral Refuge,
newman,
The Troy,
Leaf [zach],
THE Tim,
Jax The Mighty,
SarrowTave,
Ninja-Tech,
The MrMiguu™ [pizza pretzles],
Electrokinesis
Pages: [1]
  Print  
Author Topic: Portal System  (Read 821 times)
0 Members and 1 Guest are viewing this topic.
Marsh
Demi God

Offline Offline

Posts: 7,280


Comfort the disturbed. Disturb the comfortable.


View Profile WWW Email
User is on moderator watch listWatched
« on: January 29, 2006, 10:06:25 PM »

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.
Baron
Lord Of Spleens
Administrator
Teh Uberleet
*
Offline Offline

Posts: 2,735


Genesis CoCreator - Eclipse Evo Developer


View Profile WWW Email
« Reply #1 on: January 30, 2006, 01:30:29 AM »

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.
Darkwolf
Active Member
***
Offline Offline

Posts: 104


View Profile Email
« Reply #2 on: January 30, 2006, 02:35:47 AM »

Thats the problem with scripting in Eclipse at the moment. Thinga are overly complicated and don't always work.
Baron
Lord Of Spleens
Administrator
Teh Uberleet
*
Offline Offline

Posts: 2,735


Genesis CoCreator - Eclipse Evo Developer


View Profile WWW Email
« Reply #3 on: January 30, 2006, 03:41:14 AM »

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.
Pages: [1]
  Print  
 
 

Powered by EzPortal
Powered by MySQL Powered by PHP Powered by SMF 2.0 Beta 4 | SMF © 2006–2008, Simple Machines LLC | Sitemap Valid XHTML 1.0! Valid CSS!
Page created in 0.357 seconds with 34 queries.