Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Probably Not Possible But I Thought I'd Ask


Gohan
 Share

Recommended Posts

If you've watched anime, you'd know warriors sometimes catch their second wind when they are on the edge of their limits. I'd like to(but I don't need to) simulate that somehow. I haven't been able to think of even one way to do it, so I thought I'd ask, is there a way to do it?
Link to comment
Share on other sites

@Kimimaru:

> Do you mean you want to make it so that your character will get stronger when low on health? If so, it's definitely possible; you'd just have to edit the source code to accomplish it.

Well, that and other things. Like getting back up when you're down when you SHOULD be unconscious for hours or even dead.

But not getting back up due to items or buffs, but by mere chance or willpower.
Link to comment
Share on other sites

Well, do you mean for real hours, or in-game hours? It's possible both ways, but I don't think you'd like to do it for real hours. Also, preventing you from dying can also definitely be done; you'd just have to edit the source as well.
Link to comment
Share on other sites

@Kimimaru:

> Well, do you mean for real hours, or in-game hours? It's possible both ways, but I don't think you'd like to do it for real hours. Also, preventing you from dying can also definitely be done, you'd just have to edit the source as well.

I mean stuff like when many warriors in anime are severely injured, and they stand up staggeringly to continue fighting out of sheer willpower. Like when Hinata fought Neji in Naruto during the Chunin Exams
Link to comment
Share on other sites

You can edit the OnDeath sub so that when someone "dies" if they have X level or X willpower point or something, to respawn them immediately with no experience penalty, at half max HP. Or something like that. Then if they "die" again, actually let the OnDeath script run and do the normal death actions.
Link to comment
Share on other sites

@Anna:

> You can edit the OnDeath sub so that when someone "dies" if they have X level or X willpower point or something, to respawn them immediately with no experience penalty, at half max HP. Or something like that. Then if they "die" again, actually let the OnDeath script run and do the normal death actions.

Hmm… could I do that but instead on each PVP or arena death have a X% chance to respawn at the same spot with /X HP and 0 exp penalty. Also have this effect retry every 2 seconds for 10 seconds until it works, during which the player appears to be lying down? Is that possible?
Link to comment
Share on other sites

Yes but it would be much more complicated. You'd have to turn paperdoll off (if you use it) and change the player's sprite to a downed version and lock their movement and actions while the timer for this death/recover check runs. One problem with that is NPCs would still detect the player as being there and will attack as if the player is "alive" – you can't get around this without editing the source.
Link to comment
Share on other sites

@Anna:

> Yes but it would be much more complicated. You'd have to turn paperdoll off (if you use it) and change the player's sprite to a downed version and lock their movement and actions while the timer for this death/recover check runs. One problem with that is NPCs would still detect the player as being there and will attack as if the player is "alive" – you can't get around this without editing the source.

Change player sprite to downed version… that can be done with Custom=1 right?
Link to comment
Share on other sites

Entirely possible.

In the death script, generate a random number 1-5
If random number is 1,
  Cast a "second wind" spell effect at player location.
  Heal the player back to maybe 50% health.
  Output to the map "Playername" has gained his second wind!
  don't do anything else death related
else number is not 1
  do standard death stuff
Link to comment
Share on other sites

@Baron:

> Entirely possible.
>
> In the death script, generate a random number 1-5
> If random number is 1,
>   Cast a "second wind" spell effect at player location.
>   Heal the player back to maybe 50% health.
>   Output to the map "Playername" has gained his second wind!
>   don't do anything else death related
> else number is not 1
>   do standard death stuff

Wouldn't making a spell to do this just require making another script? Why not just make the respawn script there instead? lol
Link to comment
Share on other sites

No, not possible. This would require a source edit. The OnDeath sub runs after declaring a player "dead", so there will still be a global message saying the player dies, plus their health, MP, and SP will be restored, not to mention that the other player will already gain PK status and EXP if this is PVP.

In short, yeah, you could stop them from warping away, but that's only one of like 8 death effects that trigger. All the rest are hardcoded.

Oh, and also, OnDeath runs in 2 or 3 other places besides just being killed. If an admin or the server host kills a player for whatever reason, this might trigger a boost in stats, which would be counterproductive to the original intent.
Link to comment
Share on other sites

@Ballie:

> No, not possible. This would require a source edit. The OnDeath sub runs after declaring a player "dead", so there will still be a global message saying the player dies, plus their health, MP, and SP will be restored, not to mention that the other player will already gain PK status and EXP if this is PVP.
>
> In short, yeah, you could stop them from warping away, but that's only one of like 8 death effects that trigger. All the rest are hardcoded.
>
> Oh, and also, OnDeath runs in 2 or 3 other places besides just being killed. If an admin or the server host kills a player for whatever reason, this might trigger a boost in stats, which would be counterproductive to the original intent.

Would that be an edit server side or client side?
Link to comment
Share on other sites

@Ballie:

> Just search for the sub names from the script files in the source code. I believe that would be OnPlayerPK or OnPlayerArenaKill or something. It's been ages since I've even opened up a script file. xD

Okay I did and both took me to Sub AttackPlayer:
```
Sub AttackPlayer(ByVal Attacker As Long, ByVal Victim As Long, ByVal Damage As Long)
    Dim Exp As Long
    Dim n As Long

    ' Make sure the attack is a valid index.
    If Not IsPlaying(Attacker) Then
        Exit Sub
    End If

    ' Make sure the victim is a valid index.
    If Not IsPlaying(Victim) Then
        Exit Sub
    End If

    ' Remove one SP point every time the player attacks.
    If SP_ATTACK = 1 Then
        If GetPlayerSP(Attacker) > 0 Then
            Call SetPlayerSP(Attacker, GetPlayerSP(Attacker) - 1)
            Call SendSP(Attacker)
        Else
            Call PlayerMsg(Attacker, "You feel exhausted from fighting.", BLUE)
            Exit Sub
        End If
    End If

    ' If damage is below one, exit this sub routine.
    If Damage < 1 Then
        Exit Sub
    End If

    ' Check for weapon
    If GetPlayerWeaponSlot(Attacker) > 0 Then
        n = GetPlayerInvItemNum(Attacker, GetPlayerWeaponSlot(Attacker))
    End If

    ' Send this packet so they can see the person attacking
    Call SendDataToMapBut(Attacker, GetPlayerMap(Attacker), "ATTACK" & SEP_CHAR & Attacker & END_CHAR)

    If Map(GetPlayerMap(Attacker)).Tile(GetPlayerX(Attacker), GetPlayerY(Attacker)).Type <> TILE_TYPE_ARENA And Map(GetPlayerMap(Victim)).Tile(GetPlayerX(Victim), GetPlayerY(Victim)).Type <> TILE_TYPE_ARENA Then
        If Damage >= GetPlayerHP(Victim) Then
            Call SetPlayerHP(Victim, 0)

            If SCRIPTING = 1 Then
                MyScript.ExecuteStatement "Scripts\main.ess", "OnPVPDeath " & Attacker & "," & Victim
            Else
                Call GlobalMsg(GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker), BRIGHTRED)
            End If

            If Map(GetPlayerMap(Victim)).Moral <> MAP_MORAL_NO_PENALTY Then
                If SCRIPTING = 1 Then
                    MyScript.ExecuteStatement "Scripts\main.ess", "DropItems " & Victim
                Else
                    If GetPlayerWeaponSlot(Victim) > 0 Then
                        Call PlayerMapDropItem(Victim, GetPlayerWeaponSlot(Victim), 0)
                    End If

                    If GetPlayerArmorSlot(Victim) > 0 Then
                        Call PlayerMapDropItem(Victim, GetPlayerArmorSlot(Victim), 0)
                    End If

                    If GetPlayerHelmetSlot(Victim) > 0 Then
                        Call PlayerMapDropItem(Victim, GetPlayerHelmetSlot(Victim), 0)
                    End If

                    If GetPlayerShieldSlot(Victim) > 0 Then
                        Call PlayerMapDropItem(Victim, GetPlayerShieldSlot(Victim), 0)
                    End If

                    If GetPlayerLegsSlot(Victim) > 0 Then
                        Call PlayerMapDropItem(Victim, GetPlayerLegsSlot(Victim), 0)
                    End If

                    If GetPlayerRingSlot(Victim) > 0 Then
                        Call PlayerMapDropItem(Victim, GetPlayerRingSlot(Victim), 0)
                    End If

                    If GetPlayerNecklaceSlot(Victim) > 0 Then
                        Call PlayerMapDropItem(Victim, GetPlayerNecklaceSlot(Victim), 0)
                    End If
                End If

                ' Calculate exp to give attacker
                Exp = Int(GetPlayerExp(Victim) / 10)

                ' Make sure we dont get less then 0
                If Exp < 0 Then
                    Exp = 0
                End If

                If GetPlayerLevel(Victim) = MAX_LEVEL Then
                    Call BattleMsg(Victim, "You cant lose any experience!", BRIGHTRED, 1)
                    Call BattleMsg(Attacker, GetPlayerName(Victim) & " is the max level!", BRIGHTBLUE, 0)
                Else
                    If Exp = 0 Then
                        Call SetPlayerExp(Victim, 0)
                        Call BattleMsg(Victim, "You didn't lose any experience.", BRIGHTRED, 1)
                        Call BattleMsg(Attacker, "You didn't received any experience.", BRIGHTBLUE, 0)
                    Else
                        Call SetPlayerExp(Victim, GetPlayerExp(Victim) - Exp)
                        Call BattleMsg(Victim, "You lost " & Exp & " experience.", BRIGHTRED, 1)
                        Call SetPlayerExp(Attacker, GetPlayerExp(Attacker) + Exp)
                        Call BattleMsg(Attacker, "You got " & Exp & " experience for killing " & GetPlayerName(Victim) & ".", BRIGHTBLUE, 0)
                    End If

                    Call SendEXP(Victim)
                    Call SendEXP(Attacker)
                End If
            End If

            ' Warp player away
            If SCRIPTING = 1 Then
                MyScript.ExecuteStatement "Scripts\main.ess", "OnDeath " & Victim
            Else
                If Map(GetPlayerMap(Victim)).BootMap > 0 Then
                    Call PlayerWarp(Victim, Map(GetPlayerMap(Victim)).BootMap, Map(GetPlayerMap(Victim)).BootX, Map(GetPlayerMap(Victim)).BootY)
                Else
                    Call PlayerWarp(Victim, START_MAP, START_X, START_Y)
                End If
            End If

            ' Restore vitals
            Call SetPlayerHP(Victim, GetPlayerMaxHP(Victim))
            Call SetPlayerMP(Victim, GetPlayerMaxMP(Victim))
            Call SetPlayerSP(Victim, GetPlayerMaxSP(Victim))
            Call SendHP(Victim)
            Call SendMP(Victim)
            Call SendSP(Victim)

            ' Check for a level up
            Call CheckPlayerLevelUp(Attacker)

            ' Check if target is player who died and if so set target to 0
            If Player(Attacker).TargetType = TARGET_TYPE_PLAYER And Player(Attacker).Target = Victim Then
                Player(Attacker).Target = 0
                Player(Attacker).TargetType = 0
            End If

            If GetPlayerPK(Victim) = NO Then
                If GetPlayerPK(Attacker) = NO Then
                    Call SetPlayerPK(Attacker, YES)
                    Call SendPlayerData(Attacker)
                    Call GlobalMsg(GetPlayerName(Attacker) & " has been deemed a player killer!", BRIGHTRED)
                End If
            Else
                Call SetPlayerPK(Victim, NO)
                Call SendPlayerData(Victim)
                Call GlobalMsg(GetPlayerName(Victim) & " has paid the price for being a player killer!", BRIGHTRED)
            End If
        Else
            Call SetPlayerHP(Victim, GetPlayerHP(Victim) - Damage)
            Call SendHP(Victim)
        End If
    ElseIf Map(GetPlayerMap(Attacker)).Tile(GetPlayerX(Attacker), GetPlayerY(Attacker)).Type = TILE_TYPE_ARENA And Map(GetPlayerMap(Victim)).Tile(GetPlayerX(Victim), GetPlayerY(Victim)).Type = TILE_TYPE_ARENA Then
        If Damage >= GetPlayerHP(Victim) Then
            Call SetPlayerHP(Victim, 0)

            ' Check if target is player who died and if so set target to 0
            If Player(Attacker).TargetType = TARGET_TYPE_PLAYER And Player(Attacker).Target = Victim Then
                Player(Attacker).Target = 0
                Player(Attacker).TargetType = 0
            End If

            If SCRIPTING = 1 Then
                MyScript.ExecuteStatement "Scripts\main.ess", "OnArenaDeath " & Attacker & "," & Victim
            End If
        Else
            Call SetPlayerHP(Victim, GetPlayerHP(Victim) - Damage)
            Call SendHP(Victim)
        End If
    End If

    Player(Attacker).AttackTimer = GetTickCount

    Call SendDataToMap(GetPlayerMap(Victim), "sound" & SEP_CHAR & "pain" & SEP_CHAR & Player(Victim).Char(Player(Victim).CharNum).Sex & END_CHAR)
End Sub
```
I'm not 100% sure(because I'm new to this) but if I script the OnPVPDeath and OnArena death to recover HP and MP then I should have each part of that sub check if the OnPVPDeath or OnArenaDeath recovered the player right?
Link to comment
Share on other sites

Okay I have a script to generate a random number.

```
Sub RandomNumber = Rand(1,5)

  Call Rand(1,5)

  If RandomNumber = 1 Then
  Call GetPlayerHP(Index)

      If PlayerHP(Index) = 0 Then
      Call SetPlayerHP(Index, GetPlayerMaxHP(Index) /2)
      Call SetPlayerHP(Index, GetPlayerMaxMP(Index) /5)
      Call GetPlayerClass(Index)

          If PlayerClass = 0 Then
          Call GetPlayerGender(Index)

              If PlayerGender = Male Then
              Call MapMsg(GetPlayerMap(Index)"GetPlayerName(Index) has gained his second wind!", 15)
              End If

              If PlayerGender = Female Then
              Call MapMsg(GetPlayerMap(Index)"GetPlayerName(Index) has gained her second wind!", 15)
              End If
          End If

          If PlayerClass = 1 Then
          Call MapMsg(GetPlayerMap(Index)"GetPlayerName(Index) has gained his second wind!", 15)
          End If
      End If
  End If
End Sub
```
Does anyone see a mistake there?

If it doesn't have errors, how do I put it in my Attack Player sub so the server will do this before presuming a player dead?
Link to comment
Share on other sites

```
Sub CheckSecondWInd
dim RandomNumber

  RandomNumber = Rand(1,5)

  If RandomNumber = 1 Then
  Call GetPlayerHP(Index)

      If PlayerHP(Index) = 0 Then
      Call SetPlayerHP(Index, GetPlayerMaxHP(Index) /2)
      Call SetPlayerHP(Index, GetPlayerMaxMP(Index) /5)
      Call GetPlayerClass(Index)

          If PlayerClass = 0 Then
          Call GetPlayerGender(Index)

              If PlayerGender = Male Then
              Call MapMsg(GetPlayerMap(Index)"GetPlayerName(Index) has gained his second wind!", 15)
              End If

              If PlayerGender = Female Then
              Call MapMsg(GetPlayerMap(Index)"GetPlayerName(Index) has gained her second wind!", 15)
              End If
          End If

          If PlayerClass = 1 Then
          Call MapMsg(GetPlayerMap(Index)"GetPlayerName(Index) has gained his second wind!", 15)
          End If
      End If
  End If
End Sub
```
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...