Eclipse
January 05, 2009, 07:39:43 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 +-
The New Eclipse Raid on Runscape by Sʎ|3><(_)z
Today at 07:39:30 PM

Last one to post Wins by Dr. Who Cares
Today at 07:39:24 PM

Spike's Adminishness! by Marsh
Today at 07:36:56 PM

My Game by Sʎ|3><(_)z
Today at 07:36:22 PM

THE Cult by ‪‫‬‭‮‪‫‬‭The Admiral
Today at 07:34:15 PM

Server Issue by Xavi
Today at 07:33:20 PM

Azkanan's Workshop (Graphics) by Devogen
Today at 07:28:02 PM

New DezireSoft forums by The BanHammer! [Thor!]
Today at 07:27:15 PM

Makai Realms by Sʎ|3><(_)z
Today at 07:25:28 PM

Lostica [Project Revamp] by Sʎ|3><(_)z
Today at 07:23:54 PM

Members Online +-
16 Guests, 27 Users
Sʎ|3><(_)z,
Marsh,
Dr. Who Cares,
‪‫‬‭‮‪‫‬‭The Admiral,
Hikaru,
2guns,
ʇıunpp ʎqɹıʞ࣭,
Echo ♥ Pie,
Xavi,
The BanHammer! [Thor!],
Teh_General,
Dimx,
Airscar,
grenegg1,
Kreator,
Baron,
Ambard,
karminezr0x,
westin444,
Southern,
shrig94,
Devogen,
Simius Cruentus,
dragonlord52,
Keebler Elf,
Niko,
MrAreth
Pages: [1]
  Print  
Author Topic: daMoose's OnDeath Subs  (Read 762 times)
0 Members and 1 Guest are viewing this topic.
daMoose_Neo
Member
**
Offline Offline

Posts: 84


View Profile Email
« on: July 31, 2006, 08:43:23 AM »

Ahkay, irritated by the lack of functionality in the game's Dungeon respawning, I wrote my own code for dying and reappearing. Very simple, actually, but I like it ^_^

First step: This following block goes under the Commands sub, preferably before the Select Case portion, at least that's where I have it:

Code: [Select]


'*********************************************************************************************
'OnDeath - daMoose's Commands v.01 7/31/2006
'*********************************************************************************************
' These Subs allow you to define regions and outputs to OnDeath.ini When a player dies, OnDeath
' is consulted for the player's current map, then warped to the appropriate restart point.

    If LCase(Mid(TextSay, 1, 10)) = "/setregion" Then

If GetPlayerAccess(index) < 3 Then
Call PlayerMsg(index,"You do not have the authority to use this command.",2)
Exit Sub
End If


        If Len(TextSay) > 11 Then
TextSay = Mid(TextSay, 11, Len(TextSay) - 10)
Call PutVar("Scripts/OnDeath.ini", "Maps",GetPlayerMap(index), Trim(TextSay))
Call PlayerMsg(index,"You have set Map " & GetPlayerMap(index) & " to region " & Trim(TextSay) & ".",2)
Exit Sub
        End If
Call PlayerMsg(index,"Please specify a region...",2)
        Exit Sub
    End If      
   
   If LCase(Mid(TextSay,1,11)) = "/setrestart" then

If GetPlayerAccess(index) < 3 Then
Call PlayerMsg(index,"You do not have the authority to use this command.",2)
Exit Sub
End If

If Len(TextSay) > 12 Then
TextSay = Trim(Mid(TextSay, 12, Len(TextSay) - 11))
Call PutVar("Scripts/OnDeath.ini",Trim(TextSay),"StartX", GetPlayerX(index))
Call PutVar("Scripts/OnDeath.ini",Trim(TextSay),"StartY", GetPlayery(index))
Call PutVar("Scripts/OnDeath.ini",Trim(TextSay),"StartMap", GetPlayerMap(index))
Call PlayerMsg(index,"You have marked this map as a restart point!",2)
Exit Sub
End If
   Call PlayerMsg(index,"Please specify a region...",2)
   Exit Sub
   End If
'*********************************************************************************************
'End daMoose's Subs
'*********************************************************************************************


This gives us the commands "/setrestart" and "/setregion".
How to use these commands:

/setrestart <Region Name> = This designates the map and your coordnates when you use it as the restart point for the specified region. Typically, you want to set a "region" or a restart point for each dungeon or area. This allows the players to warp back to the entrance.

/setregion <Region Name> = This sets the map where you are when you use this command to a particular region name, such as "Capitol", "Cave", etc. When a player dies on the map, they are warped to that region's designated restart point, defined by the above command.

Both of these commands output to the file OnDeath.ini, which will appear in your scripts folder when you use this.
This does include rudementary "hack-proofing" by checking the player's access level. I currently have it set to 3, as I don't neccesarily want my mappers defining the whole world, but thats just me. You can set it down to 2 if you prefer or up to 4 for absolute Admin-only access.

Now, for the OnDeath sub itself:
Code: [Select]

'*********************************************************************************************
'daMoose's OnDeath Script v.01 7/31/2006
'*********************************************************************************************
Dim ToRegion
Dim ToX
Dim ToY
Dim ToMap

ToRegion = GetVar("Scripts/OnDeath.ini", "Maps", GetPlayerMap(index))

ToX = Int(GetVar("Scripts/OnDeath.ini", Trim(ToRegion),"StartX"))
ToY = Int(GetVar("Scripts/OnDeath.ini", Trim(ToRegion),"StartY"))
ToMap = Int(GetVar("Scripts/OnDeath.ini", Trim(ToRegion),"StartMap"))

Call PlayerWarp(index, ToMap ToX, ToY)

'*********************************************************************************************
'End OnDeath Script
'*********************************************************************************************


Simply plug that into your OnDeath sub and it's ready to rock & roll!
I would appreciate leaving the header tags in place, I don't post my scripts often so I'd appreciate keeping the couple tag notes in place, thanks!

Hopefully, some other folks find this as useful as it was for me.
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.278 seconds with 33 queries.