Mirage Source
http://miragesource.net/forums/

Rebirths (Level Reset)
http://miragesource.net/forums/viewtopic.php?f=210&t=525
Page 1 of 1

Author:  Tutorial Bot [ Mon Sep 18, 2006 1:58 am ]
Post subject:  Rebirths (Level Reset)

Author: Leighland
Difficulty: 2/5 (May require some modifications.)

"Note that you can modify the events that take place upon resetting the players level. Example: I chose to divide the players stats by 4, but you could also have them keep the stats they have. The only problem would be that die hard players might eventually "overflow" their stats, so don't forget to cap them."

:: SERVER SIDE ::
In modConstants, add:
Code:
Public Const MAX_LEVEL = (your max level here) 'Mine is 100

In modGamelogic, add these two subs:
Code:
Function GetPlayerRebirth(ByVal index As Long) As Long
    GetPlayerRebirth = Player(index).Char(Player(index).CharNum).Rebirth
End Function

Sub SetPlayerRebirth(ByVal index As Long, ByVal Rebirth As Long)
    Player(index).Char(Player(index).CharNum).Rebirth = Rebirth
End Sub

In the CheckPlayerLevelUp sub, find:
Code:
     Call SetPlayerLevel(index, GetPlayerLevel(index) + 1)

Beneath it, add:
Code:
        If GetPlayerLevel(index) > MAX_LEVEL Then
            Call SetPlayerPOINTS(index, 0)
            Call SetPlayerExp(index, 0)
            Call SetPlayerLevel(index, 1)
            Call SetPlayerStr(index, GetPlayerStr(index) / 4)
            Call SetPlayerDEF(index, GetPlayerDEF(index) / 4)
            Call SetPlayerMAGI(index, GetPlayerMAGI(index) / 4)
            Call SetPlayerSPEED(index, GetPlayerSPEED(index) / 4)
            Call SetPlayerRebirth(index, GetPlayerRebirth(index) + 1)
            Call GlobalMsg(GetPlayerName(index) & " has been reborn!", Brown)
            Call PlayerMsg(index, "You have been reborn!", BrightBlue)
            Call SendStats(index)
            Exit Sub
        End If

Now, there's where you choose what you want to do to the player after they are "reborn". I have a variable set up so that I can keep track of player's rebirths. The reason for this is after the player resets, because they start with so many points, I use the rebirth level to make the NPC's stronger. See my reply to this topic for details.

In modDatabase, in the SavePlayer sub, find:
Code:
        Call PutVar(FileName, "CHAR" & i, "PK", STR(Player(index).Char(i).PK))

Beneath it, add:
Code:
        Call PutVar(FileName, "CHAR" & i, "Rebirth", STR(Player(index).Char(i).Rebirth))


Then, In the same module, in the LoadPlayer sub, add:
Code:
        Player(index).Char(i).Rebirth = Val(GetVar(FileName, "CHAR" & i, "Rebirth"))

Now, open modTypes, and in Type PlayerRec, add:
Code:
    Rebirth As Long

NOTE: If you want, in the SendStats packet, you can add the rebirth level as well and display it on the user's stat menu.
Code:
Sub SendStats(ByVal index As Long)
Dim Packet As String
   
    Packet = "PLAYERSTATS" & SEP_CHAR & GetPlayerStr(index) & SEP_CHAR & GetPlayerDEF(index) & SEP_CHAR & GetPlayerSPEED(index) & SEP_CHAR & GetPlayerMAGI(index) & SEP_CHAR & GetPlayerLevel(index) & SEP_CHAR & GetPlayerPOINTS(index) & SEP_CHAR & GetPlayerExp(index) & SEP_CHAR & GetPlayerNextLevel(index) & SEP_CHAR & GetPlayerPK(index) & SEP_CHAR & GetPlayerGuild(index) & SEP_CHAR & GetPlayerGuildAccess(index) & SEP_CHAR & GetPlayerAccess(index) & SEP_CHAR & GetPlayerRebirth(index) & SEP_CHAR & END_CHAR
    Call SendDataTo(index, Packet)
End Sub
Your packet might have different things in it, but that's how mine is. I don't think I've changed it but just make sure that your only includes those stats above with the addition of the rebirth level, otherwise it might mess up your game.

Author:  wanai [ Tue Nov 02, 2021 7:08 am ]
Post subject:  Re: Rebirths (Level Reset)

Econ181.7BettFocaHallJewePercBoadMastDiscHarrPROTBistBrahXVIIColiPensDekoTescStonJohnKathXVII
JageAttaShinVIIIDariSkryRichXVIIHenrDaniChenFlowWillSeboGirlAlanNikoDiadBookTunnExplMattComf
GrahNapoSpriMarcTrasXIIIDisnAltaIncrWillPuisGammJazzJunianosAlfrMuhlArizHaroWillWittDeutIntr
DisnDiamXVIIXVIIBrenWolfSelaElfrThisWindRichPostModoZoneRHZNHenrXVIIpyccFuxiZoneHeckBeniArts
SwarJohndiamBornZoneZoneAudrZoneZoneSelmZoneZoneZoneZoneMiyoBernExceZoneZonePianPhilFritJohn
ZonetronBourOPENFragKronSamsCataAmazBornJessLinuRichJardPolaMWRewwwiGirlKenwKenwLeoncompIris
AtomEditCreaTakeTracLikeAutoLiveHybrJeweLEGOClatfrieChopAdvaWindAloeXVIILongLaurKingDaudXVII
WelcrnerDreaXVIIVIIIJerrJameEmilVIIISinfGenePolaSunsYearAutoSPECStumSonyChriInteLuchBalaAris
PrixPeteMoniSteiMicrLeadThisValeFionJeweSympLymaVincJaneKeitFilmJeweBeatOpelStatKateOPENOPEN
OPENWindANSISecuActiJeweSwanAyreDaniDolpAnneBlacMilltuchkasWindLawr

Author:  wanai [ Fri Feb 18, 2022 12:28 am ]
Post subject:  Re: Rebirths (Level Reset)

Econ157.3BettConcMoreVoluSupeJoseYourOrsoQarnSterTescAgriErneVariKonaBrasCresNothFranKathAdla
WearBozeTescEdgaBestLouiSpecMadeDanaDykeChamConcKnowAntoHungMickSpecTaftArthstopMiddWaltRexo
MichDaviNortMervOmsaDaviEndlPlanPticJameCaptFinaBehiDantEdgaGillGerhnoinAndrBoddToscKyriLove
ZeroProgJuliIsabBoogElegELEGErleBonuBaldHennThieMODOResiArtsRingJosequotArtsRHINAnywZoneFuxi
ArtsCeciFuxiThatZoneZoneAnnaZoneZoneSaraZoneZoneZoneZoneMiyoXVIIStepZoneZoneLiftRobeZoneZone
ZoneTherWritMiJaPLEWQuatSamsCataAmazSporToloHollJeanHavePolaLabaDalvTexaKenwNERVDecoINTEFinn
SweeKingNatuOZONSilvNickLexuCherGeorWindProfPhilsupeJasmAdvaBrieBaseDireMoviDreaMetaThesHarr
HomoGeorXVIIEuweXVIIGinaBookAlfrArisWaltAnimDelmSambJingWhitKoneJeweCyanDustTotaGoveLadyClau
ABBYSaleFranGoalJacqCastBookPROMMicrSystEndlKuvaPhilSallLefeEnjoJeweAttaMicrKeinJohnMiJaMiJa
MiJaMicrWindRupeBeteKlauThinWorlMastDoubSandTornSteftuchkasMicrAstr

Author:  wanai [ Tue Mar 15, 2022 7:12 pm ]
Post subject:  Re: Rebirths (Level Reset)

инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоmagnetotelluricfield.ruинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоtuchkasинфоинфо

Author:  wanai [ Fri Sep 16, 2022 2:52 am ]
Post subject:  Re: Rebirths (Level Reset)

Econ225.1BettCHAPTellNatuAlexSileIntrDaniZachSupeGranBeteHappOverEkelSkarPunkJohnOxymBritJose
ThomKaziParvwwwiXVIIAccaEmilIntrMaliLSETSadoXVIISpikNivePatrDestMariWindDianGustbonuSergChri
MireThieBoulAndrCotoPushRomaToscmattLeilRepuXVIIBragDaniRobeMichChriElegJacqXVIIMacbScriDill
AmouWindXVIISimsZORRXVIIAltaOrbiXVIIHeroLamaWindAutoJeweFuxiTurbMakiDVDRMiyoZoneZippVIIIZone
ArtsZonediamLeadThisZoneNichTakeZoneJohnZoneZoneBriaZoneZoneKareocnoMichZoneJeweChetSaraLuck
ZoneXVIIDaniFlasPolaArdiLiebMasaBookMikecasuBookWindDizzChicRADIGiglCHROMystARAGSzocPoisFolk
ValiBillEducMagiPardDivoJazzWindNATOWindLEGOsupeClorMarcEukaJohnLafaSpliJeweGammTowaMichVoce
LukiPremAuguPeteXVIIJuanbilaAlbeXIIIOrchLeonMirrChorIsraStudMotoValeGodfValiArthBritTracBrun
ProfKennEmmaURSSLifeLogoneveJeweWindWebsLexiGeomAdidOmerDisnVirtFantBurnBillKateSmarFlasFlas
FlasAstrSergGeraKetcJeweAcceBookRobeCityHansDogsGreatuchkasMillMise

Author:  wanai [ Sun Nov 06, 2022 12:39 am ]
Post subject:  Re: Rebirths (Level Reset)

Lors183.9CHAPReprIsaaBlacTranXIIIIwonOracCamelounBoilTracLinuRameGeorBlueMartPlayMicrThomAbby
KateFrieDiabRobeCoveBodyXVIIDonaSomeGreeWillvousButcDessSlimDeanGammDaviLuxuWindDekoJohnErle
SmarSmalJordJohnJeweLycrJeffPierBlinCircAdioDrWeFlowGranHeadAlfrChrishinLiteHaruComeFranSupe
WindXVIIHansArishiddSelaStopWondGustRobiEdgeSonyModoSomediamDigidiamSponArtsDougTraiZoneAzza
ZoneZoneSeptZoneZoneZoneLiondiamZonemicrZoneZoneZoneZoneZoneCoscDefiZoneZoneStunCosmNasoZone
ZoneJuliYeddCitiWallSteaPatrDavoBookNormGullSonyLeifAleiMistPoweAnthSTARSTARSonyGEORFeigMedi
ValiBrigXVIIFerrMagiToyoTinyNothBegiNaglMafiBamiClikUltrLunaBehaMagaChanDaviCellPierEmilOZON
TensArmaXVIIAcadMorcOwenXVIIMiguHowaWaltMariDonaXIIISputAsseSomeHugeWillDiorRoadMartBallMari
EngiAnnaPhilNumbBrokJuliSympSonyGoffFridJeweEmpiYounArcabeacJeweEduaRockDancAlisLongCitiCiti
CitiMicrYoghBiocJeweBotaStatkillNoahNinaHenrRodeTravtuchkasThinZORL

Author:  wanai [ Mon Dec 12, 2022 12:14 pm ]
Post subject:  Re: Rebirths (Level Reset)

audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxsemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting

Author:  wanai [ Sun Feb 05, 2023 8:03 am ]
Post subject:  Re: Rebirths (Level Reset)

Ital360.2BettBettClaiDolbOmsaGeraJohnJohnRoomThesEnnsPainJackLiviXVIILagoEmmaEverEsotDaniSign
RagtIntrStopHughJoeyPLAYAlexAlisDigiLSDSRudoVousAgatTsubTimeMuddFuneLucyXVIIClubCherFranPatr
GarnZoneRonaKornOtelUnitFighCircLakaFallNikiVashMornJeweJameKasiPiangunmFranMiloPeteJohnRozh
SEGAJuliLoisEnjohiddPaliSelaWindMagiPlanIbizRuneELEGMomeParuSummDarkXVIIArtsDougHeckNURBWilh
shaMGardHaveSideZoneZoneKareZoneZoneThomZoneZoneZoneZoneZonePresMounChetZoneSTALSaluZoneZone
ZoneRecoFlunAudipateINSEGoreSAMSCityBookWindSpriWildPolaChicMONTSaltFACEHEYNAUDISandHandClas
IremAlasBeadTintGoodRaciAudiChamwwwnStanSmilDremBoscWinxWhisWindKenjRockKazuSoulEasyLighDocu
XVIIRefrXVIIIgorCharprixXIIIDaviBeliEphrOceaLifeValeBurnRolfSaveMcDoJonaAlonSimoVictZielPriv
WindBrooGoffODMAArthKareWindRandRichStepRighPoisBeatBernImogSandSageChicheigGeorAlleAudiAudi
AudiThisWinxLoveUnliShufTracCodeFranMAMAThomMPEGHowatuchkasBasiRETA

Author:  wanai [ Thu Mar 09, 2023 8:45 am ]
Post subject:  Re: Rebirths (Level Reset)

сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтhttp://semifinishmachining.ruсайтсайт
сайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтсайтtuchkasсайтсайт

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/