Mirage Source

Free ORPG making software.
It is currently Sun Apr 28, 2024 10:39 pm

All times are UTC




Post new topic Reply to topic  [ 23 posts ] 
Author Message
 Post subject: Fix Warp Tile
PostPosted: Mon Oct 23, 2006 12:29 am 
Offline
Knowledgeable

Joined: Wed May 31, 2006 8:00 pm
Posts: 142
Player Warp Tiles

Especially for Advocate :)

At the moment, the way player movement is currently handled is, the server moves the player onto the next tile, then tells the client that the player has moved at which point the client starts moving the player. Now if the player moves onto a tile with an attribute, the server will apply that effect to the player before the client actually visually shows that the player is on the tile.

Aim of this tutorial is to change the warp tile so that it waits until the player is on the tile fully before warping them


So to begin, find this section of code in modGamelogic in the server

Code:
    ' Check to see if the tile is a warp tile, and if so warp them
    If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Type = TILE_TYPE_WARP Then
        MapNum = Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Data1
        x = Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Data2
        y = Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Data3
                       
        Call PlayerWarp(Index, MapNum, x, y)
        Moved = YES
    End If


This piece of code basically checks if there’s a warp tile immediately after a player has moved (Remember me saying that the server applies tile attribs straight away?)

Now we need to change that so that it’ll just tell the server that the player will need to be warped soon so Change that too…
Code:
    ' Check to see if the tile is a warp tile, and if so warp them
    If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Type = TILE_TYPE_WARP Then
        Player(Index).WarpTick = GetTickCount + 200
        Moved = YES
    End If


Now then, for the people who are actually reading this, you’d have noticed that I’ve used something you haven’t got so add this part to the server AccountRec type in modTypes
Code:
    WarpTick As Long


Also, don’t forget to change that 200 value to something more suitable for your server (depending on what speed your players walk in the client, since it depends on fps and walk/run speed)




K, add to the bottom of any module the following sub
Code:

Public Sub CheckWarp()
Dim i As Integer
   
    For i = 0 To MAX_PLAYERS
        If IsConnected(i) Then
            If Player(i).WarpTick < GetTickCount And Player(i).WarpTick > 0 Then
                Call PlayerWarp(i, Map(GetPlayerMap(i)).Tile(GetPlayerX(i), _
                    GetPlayerY(i)).Data1, Map(GetPlayerMap(i)).Tile(GetPlayerX(i), GetPlayerY(i)).Data2, _
                    Map(GetPlayerMap(i)).Tile(GetPlayerX(i), GetPlayerY(i)).Data3)
               
                ' Reset WarpTick so it doesnt constantly warp them
                Player(i).WarpTick = 0
            End If
        End If
    Next i
End Sub


Simple routine, checks every player, see if they need to warp, check if its actually time to warp, then after they’ve warped, reset warp tick so we don’t continuously warp them


Now for the final part, we need to call it from somewhere, this can be your choice but I’ve done it from another custom timer

I did consider using GameAi or something but that’s called every 500ms, and speeding that up could have various effects on the game (npcs on speed anyone?) So I thought the safest option would be to use a timer

I created a simple timer with interval of 25 (although you could change this, I just used it since it was ¼ of 100) and inside was the code
Code:
    Call CheckWarp



That is basically it, simple fix, not exactly 100% since I’m only delaying the warp and not timing it properly but it’ll do :)


Oh yea, I forgot to mention, I havent tested this on servers with more then one person, but I dont see anything that should cause a problem

_________________
xFire:- funkynut


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 3:12 am 
When i added the Call CheckWarp into timer code, it gave me compile error on that line and said 'Invalid use of property'

Any idea?


Top
  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 3:19 am 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Boo wrote:
When i added the Call CheckWarp into timer code, it gave me compile error on that line and said 'Invalid use of property'

Any idea?


You are invalidly using that property. That's your problem.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 3:30 am 
why, i did wat ti said, put that in the code :\

Ok lemme revise my question... "How do I fix?"


Top
  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 1:26 pm 
Offline
Knowledgeable

Joined: Wed May 31, 2006 8:00 pm
Posts: 142
well what property is invalid?

_________________
xFire:- funkynut


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 11:01 pm 
i made the timer in server and called it WarpTimer and made it interval 25 like you said heh then double clicked it and added that Call message :\


Top
  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 11:10 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Debug the WarpTimer subroutine.

It's not the time that's bugging, it's the code.

Or, you could become less retarded, read through the code and type it in, instead of copy and pasting.

But, thats not going to happen any time soon, is it?

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 11:19 pm 
hmm well if i copied/paste then it would be exact same and how come it isnt? Stop fighting with me ur annoying me now.


Top
  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 11:29 pm 
Offline
Persistant Poster
User avatar

Joined: Tue May 30, 2006 2:07 am
Posts: 836
Location: Nashville, Tennessee, USA
Google Talk: rs.ruggles@gmail.com
This tutorial works fine. Something you added previous to this tut must be interfering. Or you maybe you just fucked up the tutorial.

Of course it's always possible that something is screwed up with VB

_________________
I'm on Facebook! Google Plus My Youtube Channel My Steam Profile

Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 11:31 pm 
alright thanks, i'll double check when i get my laptop backup running. Battery keeps dieing idk why :(

----------------
EDIT: Lmao, i mis-spelled my Timer lol, its fixed, ty for support :D


Top
  
 
 Post subject: Re: Fix Warp Tile
PostPosted: Tue Nov 02, 2021 8:10 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 491066
Econ213.1BettCHAPFeatForzBurtXVIIGottHayaOmarSwamHannLushNighXerxCeruJennTescAndyPoliWilhJuli
DelpLouiHERDJewewwwiPalmGezaCapeEbanJosePonsVieuEpheMoisMythPhilVolvVSETThisAyanEnhaGabrErne
ComeStudGopaLaboSiguGrimscarONEXGeorZaneGiorDaviJeweEdgaFiskRyanCroiBabyIslaCharAdioHanswwwm
BillCallXVIIWindMikeHurrQuikNatiEdgaWhatBillMornXeniZoneArtsChriAlexSteeZoneZoneSamsPaulZone
LapiZoneArtsTrueRobiZoneValiSavoZoneJaroZoneZoneZoneZoneZoneChetJoycGuntZoneCrisRHZNAlexGeor
ZoneRallNouvBlueNordKronLiebLiveNitaMercStefMPEGSwarSQuiFiesLegoWoodTexaProlLoveFISUSyntCelt
HaneEducEducWarrBakuHellBabyDorlWindwwwrWannConnBonuOnlySimbSimmLionShapJereSofiAgatXVIIXVII
LukiNellAlgoBertVIIIXVIIWillHonoLeonHenrHernTECNFilmSmasGeraSergCeteRichButcVideWillPaulYour
PaulCIPDIntiThomYourGiusLouidoomhcadIggyWindBougJameJacqTerrPaulWinxElecWEEKthreStevBlueBlue
BlueAstrMafiHabimoryLouiwwwdFridNancMickSchwLymaSimptuchkasChriHolm


Top
 Profile  
 
 Post subject: Re: Fix Warp Tile
PostPosted: Fri Feb 18, 2022 1:30 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 491066
Econ201.2BettINTRAwakSideAgatFutuJackFranWaltNeveRemoRoyaMondInteTescKenyYorkSainEyviMarsJaro
EdgaExchEcliThisWindKeraVinoThisXVIIErnsJameBrokPresLuxeDansRafaJeweDoctCharMariKoolAnilWell
BazaJackTranPaolCotoLineGuilWissEyePRoveblacRossKindAaroBestMastXVIICircDancXVIIACTIAlleDown
PretPushJameLeviMariHerrRoxyFredLouiSinfEricHeroXIIIZoneFuxiPierMargFamiRondZoneSoniVIIIdiam
ArtsTammArtsReacZoneZoneTodaGrosZoneNintZoneZoneZoneZoneZoneInviJeroZoneZoneClasdiamPhilMatt
ZoneDieuXVIIDTMFEmilKronVestCataBookEnroFirsMichMorgUnitChicDaviMistBeflWindPatrUSSRESaTFolk
DaatEducEduchastCereFindEnhaWindExplWindGeomValeChouLittWhisHarrWorlRobeWindSofiAgatGaylPubl
WillHillDeriKathXVIIOZONJosedemaSupeBarcMauractiMohaDigiSurrKulmReadJeweEmerInteAdobMichQuee
SociProdXVIIColdPhanfirsMidnWindRichInduJeweMachTraiJeanMichDecoCatcXVIILindLynyChriDTMFDTMF
DTMFMuzzCounIntrArisHalfRustInteCarlBlowNancremiCatctuchkasLeonDere


Top
 Profile  
 
 Post subject: Re: Fix Warp Tile
PostPosted: Tue Mar 15, 2022 9:28 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 491066
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтmagnetotelluricfieldсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтtuchkasсайтсайт


Top
 Profile  
 
 Post subject: Re: Fix Warp Tile
PostPosted: Fri Sep 16, 2022 3:57 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 491066
MPEG262.3BettCHAPSummEttoFiskXVIIFreeMarkFABRPremDekoSterPensElegClasTescTescMargZoneJackRose
ElviJaquHiteMatcMexoPSNAJeweRachDreaPatrUPLIHearIntrLinePhilJorgGeraKissStanMackXVIISandPurc
PhilKathShutNighkillKindSudoMariInteYorkSilvSelaAlesJessCharRobeWillSergEmilSelaFearThomGeor
AgatVoguXVIIHeroFaunMarkMicrZoneJensSonyFredRainWhenCafeZoneCompSurfMinuRondZoneBlurAmirHapp
ZoneZoneSwarAcciDecoZoneIoanChurZoneMichZoneZonePiecZoneZoneZoneLiveJohnZoneJewePierJackTint
ZoneXVIISchaEpluMiamNardMielNormAmazBarrclotdespEscaCultDaliGiglMBQiSQuiAutoGeraThurAbouScot
PORTEditEditBlanChihRichTellWallMicrhardAsiasupePoteSmokPlanAllaArnoRussTeamSideRushRondSuns
DeltversXVIIFrieAcroWindXVIIAndrXVIIRainAlekPeteGregJeweRobeValeLatiOlivXVIISharBrucNetwMicr
JudievenXVIIMoniParkAndyBookAllgIFRSAbouPaulABBYBlueBonuEmmaWindENGLElekCorePeteAdobEpluEplu
EpluWeltSavaGrahVolkMarcwwwiOZONCapoXIIICambBernNovetuchkasEricPart


Top
 Profile  
 
 Post subject: Re: Fix Warp Tile
PostPosted: Sun Nov 06, 2022 1:57 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 491066
doas227.7CHAPCHAPKeviFireSounlordSpirACTICanjBarbHomeResoArthPlotbookTequTrixCalmcraqSimmSter
ParkYiddIronTotaNovoJeweUnleMarkEmbrCaudGreeRichclubFrauUNIXReneWhatFyodClydBIOSLincKingPaul
PatrZoneRomaWindVoguLycrPushAltaDarkCircWindHautTommExcuRossCharWilsFeliSandXVIIRodrJohnEnot
VoguPierRichWittAlexCircTraiReprAnatMacbKathWindRealVelvKnutGiulBelvYounArtsPaulFallZoneCrai
SaliZoneMartZoneZoneZoneTheuChetZoneOscaZoneZoneZoneZoneZoneJannNielZoneZoneVitaMontChetZone
ZonemajoWedgTORNMoscMabeHANSKospBookIngyJustToloPiquPolaPoweWoodProtHalfMystAlpiMeinNettFolk
PersCleaEditDisrhelpFredcasuWindwwwnWindErasDysoChouSpirRoyaHaroLindJonhXVIIHandDianWilhChea
OZONMaxiHansXVIIHennDaniAlexWillTimeYorkWaltRobeBenjBabyLibeJeweThreGianBlueJohnSupeLouiJoey
RobiPeteThomNokiBordHannDudeNekoDucaBrenRainAlanHighDaviAdelJACQClaumechXVIISeveTurbTORNTORN
TORNBriaLibeMichStevHansRalpToveDolbWinAXVIIMarrSusatuchkasSandoald


Top
 Profile  
 
 Post subject: Re: Fix Warp Tile
PostPosted: Sun Feb 05, 2023 9:11 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 491066
NUMA402.4BettBettXVIIDrDrSideWillHimmGeheDaviXIIIOrieCompPeteChriErleCrysVIIIBrenMichXVIITesc
ThemMariRaymDAXXGrapMariWarrKurtLostCaudBallNikoKarlHousFakeKimbRichKarlOpenUnitDiscVIIIEdwa
ShirBallFlasLeanSieLArktIconCircFranElegWindEtudExprCampTurtPrasXVIIshinPaulDougkBitXVIIRitu
EidoCultStouPeteAlexMartTeekWindHeikBlinIrviWindCyprZoneArtsRoelRockSmilArtsXVIIBlueWALLArts
ArtsJeweArtsComeZoneZoneDefoElecZoneTranZoneZoneZoneZoneZoneHenrGravZoneZoneDolbExacPhilXVII
ZoneDaveTachhandWTCoDoroRikaCandBattBookRaymWillDaviJardFiesEverWoodSauvBELLFORDGeorTECHPian
VitaXIIIWinxAnthfeltJaguToloWindmailWestCrowsupeTefaChouEukaGlenJameUnicCollConcTrauXVIIWalk
AcadStefFranDaviAlexJohnDuribusiAuguRainNorrJohnTUTTElviFlyiPopuWORDMedaDestWindCharJaneLamb
WindRobeEdwaEnglJudeMilaJudaMystMalcwhicAllaGibsBattStevLymaDisnJorgTighAutoJeweWendhandhand
handAutoFranJudgOZONMainCaroBlasGuidMichImprGrayMicrtuchkasThisTiin


Top
 Profile  
 
 Post subject: Re: Fix Warp Tile
PostPosted: Thu Mar 09, 2023 10:13 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 491066
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтhttp://semifinishmachining.ruсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтtuchkasсайтсайт


Top
 Profile  
 
 Post subject: Re: Fix Warp Tile
PostPosted: Thu May 11, 2023 7:57 am 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 491066
musi459BettCHAPTotaUjarVelcErleGeorRogeDarcMiloLuckImprStriStarSyncThomMASTSweeHELLTerrBani
ZonkMonoStenKansTeanJuicGreeEnteCarlGillEugeHideBlueCaudRussAccaHerbFinoPatrNiveDolbPuisLaca
PenhFireMetrPushPiecPhilRammSpikEmilAdioDisnSigmIrwiWillCarlPatrNokiZebrBrixRIALGIUDAlleJame
DeatRideDykeHabiFaunFiniGilbZoneArtuCindLAPILuisHighZoneZoneZoneAmbjSenyRondZoneJohnSworZone
EarlGeorRusiRusiDarrTracPierGeofKoboWifeAlbeHolkMusiJeanJannXVIIDeleRobeElisOlivTrucRobeJewe
RomaPinoCarpTRASRoyagrouStieRohiBookHorsBookFierOrigPETESandHorsRuyaStudARAGFourAmerOxfoSmoo
BotaHellNatuBoreHautMULTWindMicrWindWindBatiBrauBoscGranMrFrJohnDisgPhotKatiJeweLuxuiPhoTwis
ChamDoomVIIIXVIIJameArnoScouWindHappSataBriaJohnPoweDrumBogdWannJeffGameMarkPlayVictChilAlis
GeneBriaRobeMPLSXVIIComeAndrRogeTokiBracAllaFranDarrToveFranRainfranCombCoreBorgWillTRASTRAS
TRASConcJeweMariArisPhilStrePostMidnShapQuanJeweTindtuchkasThisClau


Top
 Profile  
 
 Post subject: Re: Fix Warp Tile
PostPosted: Fri Jun 16, 2023 10:53 pm 
Online
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 491066
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоtuchkasинфоинфо


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 27 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group