Looking for Fall Damage Code

Discussions about Coding and Scripting
User avatar
Gadavre
Skilled
Posts: 169
Joined: Sun Jan 18, 2015 7:55 am

Re: Looking for Fall Damage Code

Post by Gadavre »

JackGriffin wrote:Lines like "If something != None" are sanity checks and are needed to prevent scriptlog errors. If a function is called within UScript then there will always be some sort of return. If there is not then it will error.
I wrote:

Code: Select all

function PostBeginPlay()
{
        Level.Game.RegisterDamageMutator( Self );
}

function MutatorTakeDamage (out int ActualDamage,Pawn Victim,Pawn InstigatedBy,out Vector HitLocation,out Vector Momentum,name DamageType)
{
        if(DamageType == 'Fell')
        {
        ActualDamage = 100;
         //ActualDamage *= 1;
        }
   

        if ( NextDamageMutator != None )
        NextDamageMutator.MutatorTakeDamage(ActualDamage, Victim, InstigatedBy, HitLocation, Momentum, DamageType);
}
What errors You mean? I tested this feature on map Deck16. I was climbing the ramps to the top and jumping down repeatedly. The player always died. I havent Errors.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Looking for Fall Damage Code

Post by JackGriffin »

Just because it all works now Gad, don't give up on understanding why you did what you did and what it does so that everything works now. I meant it when I said you have real potential.

<thinks hard....-ping-!..bright idea forms>

How about adding rewards for long/super long shots to the mod? You might consider keeping going with this.

EDIT: Just saw your reply. Sanity checks are really, really important. Just because you can't tease one out in a testing game doesn't mean they won't happen online with multiple players and ping/packet loss, etc. Trust me, you need to use them liberally. There's almost no down side to overusing them since they don't cost any server stress and each none you squash is one less error the server generates.
So long, and thanks for all the fish
User avatar
Gadavre
Skilled
Posts: 169
Joined: Sun Jan 18, 2015 7:55 am

Re: Looking for Fall Damage Code

Post by Gadavre »

JackGriffin wrote:.
I understood you, these checks are necessary for game in online. you have seen the code of my mutator. It will work in online? Please take a look!
JackGriffin wrote:How about adding rewards?
Rewards? The player gets more points if he kills another player at a great distance, right?
And is there a way to make bots smarter than standard bots? I personally hurt when people say that ut2004 bots are smarter bots of ut99. May have the opportunity to increase the range of vision of the Bot(Sight Radius)? In this case, bots will quickly find and kill each other. And the player will be difficult to win. I'd like to make Godlike Bots with max settings invincible. Is it real?
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil
Contact:

Re: Looking for Fall Damage Code

Post by Gustavo6046 »

Gadavre wrote:May have the opportunity to increase the range of vision of the Bot(Sight Radius)? I'd like to make Godlike Bots with max settings invincible. Is it real?
Balancement is a long way. Gadavre. But you surely will master it some day. :)
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
User avatar
Gadavre
Skilled
Posts: 169
Joined: Sun Jan 18, 2015 7:55 am

Re: Looking for Fall Damage Code

Post by Gadavre »

Somebody could tell me where i can find the original code of the fall of the player? I saw in code of the game, but i couldnt find...
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Looking for Fall Damage Code

Post by JackGriffin »

It's in Pawn

Code: Select all

function TakeFallingDamage()
{
    if (Velocity.Z < -1.4 * JumpZ)
    {
        MakeNoise(-0.5 * Velocity.Z/(FMax(JumpZ, 150.0)));
        if (Velocity.Z <= -750 - JumpZ)
        {
            if ( (Velocity.Z < -1650 - JumpZ) && (ReducedDamageType != 'All') )
                TakeDamage(1000, None, Location, vect(0,0,0), 'Fell');
            else if ( Role == ROLE_Authority )
                TakeDamage(-0.15 * (Velocity.Z + 700 + JumpZ), None, Location, vect(0,0,0), 'Fell');
            ShakeView(0.175 - 0.00007 * Velocity.Z, -0.85 * Velocity.Z, -0.002 * Velocity.Z);
        }
    }
    else if ( Velocity.Z > 0.5 * Default.JumpZ )
        MakeNoise(0.35);                
}
So long, and thanks for all the fish
User avatar
sektor2111
Godlike
Posts: 6412
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Looking for Fall Damage Code

Post by sektor2111 »

Actually above "takedamage" code which calls only ActualDamage seems to not need sanity checks as long as is not called "victim", neither "Instigatedby" or whatever "other" actor. However I'm curious to see console's behavior. I would make ActualDamage *= 1000, for perfect gibing. But I think is an interesting code for some ReduceDamage function from a controller, if won't affect 100 maps having down-ways to goals.
Gustavo6046 wrote: Balancement is a long way. Gadavre. But you surely will master it some day. :)
Some day was already years ago. For your knowledge there are already done mutators almost called something like "SighRadius" or such, also I have some tweaking done in my custom DM and that's why I don't need a bunch of tools.
Thread refers to FallDamage problem.
As a different form, I might think to call a Victim with certain velocity on z and then increase damage for such case...

Edit: And a main modification, using a different player which is sensitive at damage + a modified Bot. This way will break compatibility with some mods attacking player class.
Last edited by sektor2111 on Wed Jan 27, 2016 5:32 pm, edited 3 times in total.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Looking for Fall Damage Code

Post by JackGriffin »

That's the difference between internal and external code. Internal is the pawn doing something to itself. It doesn't need to check as it won't happen if the pawn doesn't exist anyway. Externally you'll need those checks because you don't know the exact state of the actors involved.
So long, and thanks for all the fish
User avatar
Gadavre
Skilled
Posts: 169
Joined: Sun Jan 18, 2015 7:55 am

Re: Looking for Fall Damage Code

Post by Gadavre »

sektor2111 wrote: I would make ActualDamage *= 1000, for perfect gibing.
I don't understand what this code does (with*).We can assign any damage using actual damage without *
Or am I wrong?
Anyway in these lines I don't see the difference. Player, falling down, for instance, from the highest point of the Map Deck 16, always gets the same amount of damage to health and armor.

Code: Select all

ActualDamage *= 100
or
ActualDamage *= 200
ActualDamage = 1000 give perfect gibbing. why you use ActualDamage *= It's a mystery to me.
User avatar
sektor2111
Godlike
Posts: 6412
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Looking for Fall Damage Code

Post by sektor2111 »

If you still cannot understand well UScript then let's write the same thing different

Code: Select all

ActualDamage = ActualDamage * 1000 //Equal let's say 10 ActualDamage × 1000 = 10000 Damage Taken
//or 1 ActualDamage * 1000 = 1000 Damage Taken
//or 20 ActualDamage * 1000 = 20000 Damage Taken
There are operators:
-= Something
+= Something
...
ect. Never seen this coding type ?
Biography:
Some UTJ amplification of ImpactHammer to match monster extra health over normal 100 default player health.
Last edited by sektor2111 on Wed Jan 27, 2016 10:45 pm, edited 1 time in total.
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil
Contact:

Re: Looking for Fall Damage Code

Post by Gustavo6046 »

*= means multiply the value by. It multiplies the value by the second value and stores the result in the same variable.
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
Post Reply