ProtectFromGroundDamage

Posts 1–12 of 12 · Page 1 of 1
ProtectFromGroundDamage
how do i add protectfromgrounddamage to an item

for example im trying to make a robe resistant to lava


thanks in advance
You'll have to add a new tag in Descriptors.cs defining to protect the user from all damages taken from the ground
getting mad errors,its not easy
Show me what you changed
decriptors.cs
public enum ConditionEffects
{
Dead = 1 << 0,
Quiet = 1 << 1,
Weak = 1 << 2,
Slowed = 1 << 3,
Sick = 1 << 4,
Dazed = 1 << 5,
Stunned = 1 << 6,
Blind = 1 << 7,
Hallucinating = 1 << 8,
Drunk = 1 << 9,
Confused = 1 << 10,
StunImmume = 1 << 11,
Invisible = 1 << 12,
Paralyzed = 1 << 13,
Speedy = 1 << 14,
Bleeding = 1 << 15,
NotUsed = 1 << 16,
Healing = 1 << 17,
Damaging = 1 << 18,
Berserk = 1 << 19,
Paused = 1 << 20,
Stasis = 1 << 21,
StasisImmune = 1 << 22,
Invincible = 1 << 23,
Invulnerable = 1 << 24,
Armored = 1 << 25,
ArmorBroken = 1 << 26,
Hexed = 1 << 27,
LavaImmune = 1 << 28,





playerground.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using wServer.svrPackets;
using wServer.cliPackets;

namespace wServer.realm.entities
{
public partial class Player
{
long l = 0;
void HandleGround(RealmTime time)
{
if (time.tickTimes - l > 500)
{
if (HasConditionEffect(ConditionEffects.LavaImmune) ||
HasConditionEffect(ConditionEffects.Paused))
HasConditionEffect(ConditionEffects.Invincible);
return;

WmapTile tile = Owner.Map[(int)X, (int)Y];
ObjectDesc objDesc = tile.ObjType == 0 ? null : XmlDatas.ObjectDescs[tile.ObjType];
TileDesc tileDesc = XmlDatas.TileDescs[tile.TileId];
if (tileDesc.Damaging && (objDesc == null || !objDesc.ProtectFromGroundDamage))
{
int dmg = Random.Next(tileDesc.MinDamage, tileDesc.MaxDamage);
dmg = (int)statsMgr.GetDefenseDamage(dmg, true);

HP -= dmg;
UpdateCount++;
if (HP <= 0)
Death("lava");

l = time.tickTimes;
}
}
}
public void GroundDamage(RealmTime time, GroundDamagePacket pkt)
{
}
}
}



additions.xml

<Object type="0xf01" id="Robe of Someone">
<Class>Equipment</Class>
<Item/>
<Texture>
<File>lofiObj3</File>
<Index>0x86</Index>
</Texture>
<SlotType>14</SlotType>
<Description>The invincible robe of Someone</Description>
<ActivateOnEquip stat="22" amount="100">IncrementStat</ActivateOnEquip>
<Activate effect="LavaImmune">ConditionEffectSelf</Activate>
<BagType>2</BagType>
<FameBonus>5</FameBonus>
<Soulbound/>
</Object>
Nvm, I done goofed
@forsh
I am completely new to all this, but looking at the code

Have you checked to see if, HasConditionEffect(ConditionEffects.LavaImmune) is returning 1 when the item is equipped?

What causes lava to do damage on the client side, does the server send a damage packet or something like that,
or does the client do the damage automatically?


Code:
void HandleEffects(RealmTime time)
        {
            if (HasConditionEffect(ConditionEffects.Healing))
            {
                if (healing > 1)
                {
                    HP = Math.Min(Stats[0] + Boost[0], HP + (int)healing);
                    healing -= (int)healing;
                    UpdateCount++;
                    healCount++;
                }
                healing += 28 * (time.thisTickTimes / 1000f);
            }
            if (HasConditionEffect(ConditionEffects.Quiet) &&
                MP > 0)
            {
                MP = 0;
                UpdateCount++;
            }
            if (HasConditionEffect(ConditionEffects.Bleeding) &&
                HP > 1)
            {
                if (bleeding > 1)
                {
                    HP -= (int)bleeding;
                    bleeding -= (int)bleeding;
                    UpdateCount++;
                }
                bleeding += 28 * (time.thisTickTimes / 1000f);
            }

            if (newbieTime > 0)
            {
                newbieTime -= time.thisTickTimes;
                if (newbieTime < 0) 
                    newbieTime = 0;
            }
        }
it looks like the client does the dmg iteself automaticly


the servers rebuild ok and i can play the game

the lava still does the damage but if i die in the lava the server crashes
@forsh

i think the client and server both do the same lava damage independently of each other

I think you might have to edit the client as well, because it looks like the client is also automaticly decreasing the hp when the players on a lava tile


The only other way I can think of to do this is ,
check when standing on lava,
check there is a LavaImmune condition
Send hp to the client from the server

set the hp
Code:
//etc
HP += dmg;   
HP=100


UpdateCount++;
if (HP <= 0)
Death("lava");
Quote Originally Posted by Botmaker View Post
@forsh

i think the client and server both do the same lava damage independently of each other

I think you might have to edit the client as well, because it looks like the client is also automaticly decreasing the hp when the players on a lava tile


The only other way I can think of to do this is ,
check when standing on lava,
check there is a LavaImmune condition
Send hp to the client from the server

set the hp
Code:
//etc
HP += dmg;   
HP=100


UpdateCount++;
if (HP <= 0)
Death("lava");


this makes everyone immune from lava ,there -HP flashes up on the char but the HP bar stays where it is
and wearing the Robe or not wearing the Robe makes no difference

its looking like its possible to do but finding a way is hard

---------- Post added at 07:28 AM ---------- Previous post was at 07:26 AM ----------

Quote Originally Posted by C453 View Post
I don't think you can
Code:
<Activate effect="LavaImmune">ConditionEffectSelf</Activate>
on equips. I thought they had to be activated.

What I thought you wanted to do was add a tag, like

Code:
<LavaImmune/>
But I don't think that would work.

it would work on a spell and tomb and orb ,but its looking difficult to do on a robe
its not a stat and it would be good if it could be activateonequip stat



1 other way round it is to add another stat other then Vis Wis Att and Deff etc

but this is behond my skills

im still learning C#
I don't think you can
Code:
<Activate effect="LavaImmune">ConditionEffectSelf</Activate>
on equips. I thought they had to be activated.

What I thought you wanted to do was add a tag, like

Code:
<LavaImmune/>
But I don't think that would work.
Quote Originally Posted by forsh View Post
this makes everyone immune from lava ,there -HP flashes up on the char but the HP bar stays where it is
and wearing the Robe or not wearing the Robe makes no difference

its looking like its possible to do but finding a way is hard
Since you said adding hp does in fact keep the player from dieing
You should be able check in the HandleGround function
If the player as a particular item equipped and only then increase the hp, if not decress the hp

not sure of the code to achive it

Code:
bool CheckResurrection()
        {
            for (int i = 0; i < 4; i++)
            {
                Item item = Inventory[i];
                if (item == null || !item.Resurrects) continue;

                HP = Stats[0] + Stats[0];
                MP = Stats[1] + Stats[1];
                Inventory[i] = null;
                psr.SendPacket(new TextPacket()
                {
                    BubbleTime = 0,
                    Stars = -1,
                    Name = "",
                    Text = string.Format("{0}'s {1} breaks and he disappears", Name, item.ObjectId)
                });
                psr.Reconnect(new ReconnectPacket()
                {
                    Host = "",
                    Port = 2050,
                    GameId = World.NEXUS_ID,
                    Name = "Nexus",
                    Key = Empty<byte>.Array,
                });

                resurrecting = true;
                return true;
            }
            return false;
        }
Posts 1–12 of 12 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Need help?