Mirage Source

Free ORPG making software.
It is currently Thu Mar 28, 2024 9:30 pm

All times are UTC


Forum rules


Make sure your tutorials are kept up to date with the latest MS4 releases.



Post new topic Reply to topic  [ 1508 posts ]  Go to page 1, 2, 3, 4, 5 ... 61  Next
Author Message
PostPosted: Sat Apr 11, 2009 1:30 am 
Offline
Pro
User avatar

Joined: Sun Aug 05, 2007 2:26 pm
Posts: 547
[SERVERSIDE]
First we have to add a new packet
In mod Enumerations under
Code:
SCastSpell

put
Code:
SUpdateNpcHP


Now let us make the sub to send the packet

AT the bottom of modServerTcp put
Code:
Public Sub SendNpcHp(ByVal Map As Long, ByVal Index As Byte)
    'check if the npc is dead
    If MapNpc(Map, Index).Vital(Vitals.HP) = 0 Then
    Call SendDataToMap(Map, SUpdateNpcHP & SEP_CHAR & Index & SEP_CHAR & 0 & SEP_CHAR & 0 & END_CHAR)
    Else
    Call SendDataToMap(Map, SUpdateNpcHP & SEP_CHAR & Index & SEP_CHAR & MapNpc(Map, Index).Vital(Vitals.HP) & SEP_CHAR & Npc(MapNpc(Map, Index).Num).Stat(Stats.Strength) * Npc(MapNpc(Map, Index).Num).Stat(Stats.Defense) & END_CHAR)
    End If
End Sub



Now lets send the packet. In the attacknpc sub, under
Code:
    ' Reduce durability of weapon
    Call DamageEquipment(Attacker, Weapon)

put
Code:
    'Lets update the hp of the npc incase it got hurt
    Call SendNpcHp(GetPlayerMap(Attacker), MapNpcNum)


[CLIENTSIDE]
We have to add the new packet to the client too.
In mod Enumerations under
Code:
SCastSpell

put
Code:
SUpdateNpcHP


We have to add a value to MapNpcRec called MaxHp
Find
Code:
Private Type MapNpcRec

under
Code:
    AttackTimer As Long

put
Code:
    MaxHp As Long


Now lets actually change the hp when we get the packet.
in modHandleData under
Code:
            HandleSpellCast Parse

put
Code:
        Case SUpdateNpcHP
            HandleUpdateNpcHP Parse


now at the bottom of modHandleData put this sub

Code:
' ::::::::::::::::::::::::::
' :: Update Npc Hp packet ::
' ::::::::::::::::::::::::::
Private Sub HandleUpdateNpcHP(ByRef Parse() As String)
    MapNpc(CByte(Parse(1))).Vital(Vitals.HP) = CLng(Parse(2))
End Sub


Now the last step, draw the hp bar. In sub BltNpc at the bottom put
Code:
        If MapNpc(MapNpcNum).Vital(Vitals.HP) = 0 Then Exit Sub
       
        Call DDS_BackBuffer.SetFillColor(RGB(255, 0, 0))
        Call DDS_BackBuffer.DrawBox(X, Y + 32, X + 32, Y + 36)
       
        Call DDS_BackBuffer.SetFillColor(RGB(0, 255, 0))
        Call DDS_BackBuffer.DrawBox(X, Y + 32, X + ((MapNpc(MapNpcNum).Vital(Vitals.HP) / 100) / (MapNpc(MapNpcNum).MaxHp / 100) * 32), Y + 36)

_________________
GIAKEN wrote:
I think what I see is this happening:

Labmonkey gets mod, everybody loves him, people find out his code sucks, he gets demoted, then banned, then he makes an engine called Chaos Engine.


Top
 Profile  
 
PostPosted: Sun Jun 28, 2009 7:50 pm 
Offline
Regular

Joined: Fri Jul 28, 2006 9:20 pm
Posts: 39
Location: <--soemwhere in that general direction
I having a little trouble getting this over to MS4, solely because ive been programming for over 12 hours on it lol, can anyone give me a hand by letting me know how i can get an NPC max health, on the client side? or do I have to make another packet? any help would be absolutely fantastic.


Top
 Profile  
 
PostPosted: Sat Jul 25, 2009 3:04 am 
Offline
Pro
User avatar

Joined: Sun Aug 05, 2007 2:26 pm
Posts: 547
What do you mean it sends the packet at the wrong time?

And the tutorial was written for an earlier version of ms, and i can guarantee for that version it worked fine.

_________________
GIAKEN wrote:
I think what I see is this happening:

Labmonkey gets mod, everybody loves him, people find out his code sucks, he gets demoted, then banned, then he makes an engine called Chaos Engine.


Top
 Profile  
 
PostPosted: Sun Aug 09, 2009 2:10 pm 
Offline
Regular

Joined: Sun Sep 30, 2007 9:59 pm
Posts: 27
All is needed is MP and SP bars.


Top
 Profile  
 
PostPosted: Wed Dec 01, 2021 8:51 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffuserhttp://semiasphalticflux.rusemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchuckинфоtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimate.rutemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:04 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Econ


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:05 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
92.6


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:06 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Bett


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:07 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Bett


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:08 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Greg


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:10 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Jewe


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:11 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
West


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:12 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Dant


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:13 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
XVII


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:14 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Mich


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:15 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
What


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:16 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Samb


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:17 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Appl


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:18 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Colu


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:20 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
John


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:21 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Else


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:22 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Mega


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:23 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Chin


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:24 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Hone


Top
 Profile  
 
PostPosted: Tue Jan 04, 2022 3:25 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 456192
Unde


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1508 posts ]  Go to page 1, 2, 3, 4, 5 ... 61  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 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:  
cron
Powered by phpBB® Forum Software © phpBB Group