Alatar Posted August 30, 2010 Author Share Posted August 30, 2010 I was bored and decided to make something like adding a new attribute to Origins. The Checkpoint Attribute is a simple addition to [EO] that sets the basic of a checkpoint tile and stores it in a .ini file, so when a player dies he/she respawns there. This can easily be optimized in order to increase the utility of it, because the code below is a scratch of what could it be.No credits are needed ^^, hope you people find it useful ;D**Design**:- frmEditor_Map: Add a new option button below optSlide named “optCheckpointâ€Â.**Code**:**Server-Side**:- modConstants: Below this:```Public Const TILE_TYPE_SLIDE As Byte = 14 ```Add this:```Public Const TILE_TYPE_CHECKPOINT As Byte = 15 ```- modDatabase: In AddChar, below:```Player(Index).Class = ClassNum```Add:```Call PutVar(App.Path & "\Data\accounts\checkpoints.ini", "*SERVEROPTIONS*", "" & GetPlayerName(Index), "" & 0)```- modPlayer: In PlayerMove, below this:```' Check if it's a trap tile If .Type = TILE_TYPE_TRAP Then amount = .Data1 SendActionMsg GetPlayerMap(Index), "-" & amount, BrightRed, ACTIONMSG_SCROLL, GetPlayerX(Index) * 32, GetPlayerY(Index) * 32, 1 If GetPlayerVital(Index, HP) - amount <= 0 Then KillPlayer Index PlayerMsg Index, "You're killed by a trap.", BrightRed Else SetPlayerVital Index, HP, GetPlayerVital(Index, HP) - amount PlayerMsg Index, "You're injured by a trap.", BrightRed Call SendVital(Index, HP) End If Moved = YES End If```Add this before the End With:``` If .Type = TILE_TYPE_CHECKPOINT Then SetCheckpoint Index, .Data1, .Data2, .Data3 End If```In the same module, in Sub OnDeath, find this:``` With Map(GetPlayerMap(Index)) ' to the bootmap if it is set If .BootMap > 0 Then PlayerWarp Index, .BootMap, .BootX, .BootY Else Call PlayerWarp(Index, START_MAP, START_X, START_Y) End If End With```Replace with this:``` With Map(GetPlayerMap(Index)) 'Checkpoint If ValCheckPoint(Index) = True Then WarpToCheckpoint Index ' to the bootmap if it is set ElseIf .BootMap > 0 Then PlayerWarp Index, .BootMap, .BootX, .BootY Else Call PlayerWarp(Index, START_MAP, START_X, START_Y) End If End With```And at the end of the module add this subs:```'CheckpointPublic Sub SetCheckpoint(ByVal Index As Long, ByVal MapNum As Long, ByVal x As Long, ByVal y As Long) PlayerMsg Index, "Checkpoint activated!", BrightGreen Call PutVar(App.Path & "\Data\accounts\checkpoints.ini", "*SERVEROPTIONS*", "" & GetPlayerName(Index), "" & 1) Call PutVar(App.Path & "\Data\accounts\checkpoints.ini", "" & GetPlayerName(Index), "MAPNUM", "" & MapNum) Call PutVar(App.Path & "\Data\accounts\checkpoints.ini", "" & GetPlayerName(Index), "X", "" & x) Call PutVar(App.Path & "\Data\accounts\checkpoints.ini", "" & GetPlayerName(Index), "Y", "" & y)End SubPublic Sub WarpToCheckpoint(ByVal Index As Long) Dim MapNum As Integer Dim x As Integer Dim y As Integer MapNum = GetVar(App.Path & "\Data\accounts\checkpoints.ini", "" & GetPlayerName(Index), "MAPNUM") x = GetVar(App.Path & "\Data\accounts\checkpoints.ini", "" & GetPlayerName(Index), "X") y = GetVar(App.Path & "\Data\accounts\checkpoints.ini", "" & GetPlayerName(Index), "Y") Call PlayerWarp(Index, MapNum, x, y)End SubPublic Function ValCheckPoint(ByVal Index As Long) As Boolean If GetVar(App.Path & "\Data\accounts\checkpoints.ini", "*SERVEROPTIONS*", "" & GetPlayerName(Index)) = 1 Then ValCheckPoint = True Else ValCheckPoint = False End IfEnd Function```**Client-Side**:- modConstants: Below this:```Public Const TILE_TYPE_SLIDE As Byte = 14 ```Add this:```Public Const TILE_TYPE_CHECKPOINT As Byte = 15 ```- modGameEditors: Find this```' slideIf frmEditor_Map.optSlide.Value Then.Type = TILE_TYPE_SLIDE.Data1 = MapEditorSlideDir.Data2 = 0.Data3 = 0End If```Below it, add this:```'CheckpointIf frmEditor_Map.optCheckpoint.Value ThenIf movedMouse Then Exit SubX = X - (CurX * 32)Y = Y - (CurY * 32).Type = TILE_TYPE_CHECKPOINT.Data1 = GetPlayerMap(MyIndex).Data2 = CurX.Data3 = CurYEnd If```- modText: Find this:```Case TILE_TYPE_SLIDEDrawText TexthDC, tX, tY, "S", QBColor(BrightCyan)```Below, add this:```Case TILE_TYPE_CHECKPOINT DrawText TexthDC, tX, tY, "CP", QBColor(BrightGreen)``` Link to comment Share on other sites More sharing options...
Sir Cid Posted August 31, 2010 Share Posted August 31, 2010 This is what I needed so badly, would give it more dimension. I'm gonna try it out…EDIT: Works perfectly! Thanks so much, Alatar! Link to comment Share on other sites More sharing options...
Ertzel Posted August 31, 2010 Share Posted August 31, 2010 Nice code. I did this before with scripting but never tried it in EO with source editing. This will help me a lot :DThx for the tutorial. Link to comment Share on other sites More sharing options...
Icie Juicy Posted October 11, 2010 Share Posted October 11, 2010 Great code, I'll plug it in and play around with it. Link to comment Share on other sites More sharing options...
Helladen Posted October 25, 2010 Share Posted October 25, 2010 Bug here:``` If GetVar(App.Path & "\Data\accounts\checkpoints.ini", "*SERVEROPTIONS*", "" & GetPlayerName(Index)) = 1 Then```Needs to be changed to:``` If GetVar(App.Path & "\Data\accounts\checkpoints.ini", "*SERVEROPTIONS*", "" & GetPlayerName(Index)) = "1" Then```These "" tell that it's an integer and not a preset value that has been dimmed or a function. This is a very important fix, as it will cause regular players to crash the client/server. Link to comment Share on other sites More sharing options...
Alatar Posted October 26, 2010 Author Share Posted October 26, 2010 Thx to that! I haven't seen it xD Link to comment Share on other sites More sharing options...
Helladen Posted October 26, 2010 Share Posted October 26, 2010 It's in your tutorial… Link to comment Share on other sites More sharing options...
erkro1 Posted January 6, 2011 Share Posted January 6, 2011 Does this work with eo xmas?If not, would you please make a tutorial for it? Link to comment Share on other sites More sharing options...
westin444 Posted January 6, 2011 Share Posted January 6, 2011 I highly suggest you add this directly to the player data, not an INI :S Link to comment Share on other sites More sharing options...
Alatar Posted January 6, 2011 Author Share Posted January 6, 2011 Oh yea, the topic is from September, I think that storing in playerrec could be better and quicker. Link to comment Share on other sites More sharing options...
Skillzalot Posted January 19, 2011 Share Posted January 19, 2011 Nice little system you have here. I took your system and edited it to my needs and it works amazingly thank you. Link to comment Share on other sites More sharing options...
evilbunnie Posted January 19, 2011 Share Posted January 19, 2011 @Helladen:> These "" tell that it's an integer and not a preset value that has been dimmed or a function.![](http://www.indiastudychannel.com/pictures/gallery/prasannash__Funny-MonkeyReaction-full.jpg) Link to comment Share on other sites More sharing options...
ohnoitsbenjii Posted February 2, 2011 Share Posted February 2, 2011 This works beautifully. Perhaps there is a way to make a button that would allow you to go to the checkpoints, like a "gate out" function? if anyone could figure that out, please do share? <3 Link to comment Share on other sites More sharing options...
Ansonla Posted July 2, 2011 Share Posted July 2, 2011 can this be added in eo2? Link to comment Share on other sites More sharing options...
RaiKalGames Posted July 3, 2011 Share Posted July 3, 2011 yes Link to comment Share on other sites More sharing options...
Ansonla Posted July 4, 2011 Share Posted July 4, 2011 theres something wrong with this code. i don't know why. someone fix it. it's not working for me. Link to comment Share on other sites More sharing options...
Mondo Posted May 1, 2012 Share Posted May 1, 2012 Works Great! Thank you for sharing! :D Link to comment Share on other sites More sharing options...
quintensky Posted May 21, 2012 Share Posted May 21, 2012 @Ansonla:> theres something wrong with this code. i don't know why. someone fix it. it's not working for me.there is nothing wong with the code, you did it wrong…about the tut:Thanks alot, i needed this! map 1 and 2 are tutorial maps in my game :P and i don't want players to respawn inside the tutorial cave :S well, Thanks alot Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now