Did you know? All of these messages will likely be replaced before release.

Healing Gun

For questions and discussion about UnrealEd, UnrealScript, and other aspects of Unreal Engine design.

Moderators: Semfry, ividyon

caliberc
Pupae Pupae
Posts: 2
Joined: 29 Jul 2008, 17:20

Subject: Healing Gun

Post Posted: 29 Jul 2008, 17:23

its been a while since i was on here. anyhow. i am trying to mod the pulse guns Pulse atack to heal pawns. i tried creating a negative damage effect but didnt work.. any help?

User avatar ividyon
Administrator Administrator
Posts: 2354
Joined: 12 Nov 2007, 14:43
Location: Germany
Contact:

Subject:

Post Posted: 29 Jul 2008, 17:28

Try modifying the projectile so instead of damaging the pawn on touch, it modifies his Health.

Other.Health = Other.Health+HealAmount;
UnrealSP.org webmaster & administrator

caliberc
Pupae Pupae
Posts: 2
Joined: 29 Jul 2008, 17:20

Subject:

Post Posted: 29 Jul 2008, 18:25

hmm i tied wat i think u meant but doest work.. can u be a bit more specific.

User avatar Feralidragon
Skaarj Lord Skaarj Lord
Posts: 223
Joined: 15 Jul 2008, 22:41
Location: Liandri

Subject:

Post Posted: 29 Jul 2008, 21:05

caliberc wrote:hmm i tied wat i think u meant but doest work.. can u be a bit more specific.


It works, but you have to search in the projectile script, the code that gives damage, and replace it by the code that sana said.

I am doing an weapon/item called Dark Master Stone, and one of its spells is giving health to you or to your teammates.

User avatar ividyon
Administrator Administrator
Posts: 2354
Joined: 12 Nov 2007, 14:43
Location: Germany
Contact:

Subject:

Post Posted: 29 Jul 2008, 23:43

Let's assume you want a PulseGun whose primary fire balls heal the pawns you hit with it.

After taking a look at the PulseGun code we find out that the primary-fire projectile is determined by the variable ProjClass. This means that we can easily create a subclass of the PulseGun and just replace ProjClass with the custom plasma sphere projectile we are going to create now - and this will finish our gun.

The standard primary-fire projectile of the PulseGun is the PlasmaSphere. Make a subclass and then take a look at the sphere's code.

You will find the simulated function 'ProcessTouch'..

Code: Select all

simulated function ProcessTouch (Actor Other, vector HitLocation)
{
   If ( Other!=Instigator  && PlasmaSphere(Other)==None )
   {
      if ( Other.bIsPawn )
      {
         bHitPawn = true;
         bExploded = !Level.bHighDetailMode || Level.bDropDetail;
      }
      if ( Role == ROLE_Authority )
         Other.TakeDamage( Damage, instigator, HitLocation, MomentumTransfer*Vector(Rotation), MyDamageType);
      Explode(HitLocation, vect(0,0,1));
   }
}

ProcessTouch is called whenever a projectile touches an actor (contrary to HitWall which is called when the projectile hits the world). Copy the entire function over to your new subclass.

Now, after taking a closer look at the function, we find out that

Other.TakeDamage( Damage, instigator, HitLocation, MomentumTransfer*Vector(Rotation), MyDamageType);
is the important line. This is the function responsible for hurting the pawn on contact.

In-depth explanation:
    - Other is the pawn the projectile hits when it calls the ProcessTouch function.
    - TakeDamage is a Pawn function which is called to calculate the consequences of taking damage.
    - Damage is the amount of damage received by Other. 'Damage' is a Projectile class variable you can adjust in Default properties.
    - instigator is the player who shot the projectile (i.g. you).
    - HitLocation is the spot where your projectile hit the pawn exactly.
    - MomentumTransfer*Vector(Rotation) determines how much the pawn is kicked back by the projectile and in which direction. 'MomentumTransfer' is a Projectile class variable you can adjust in Default properties.
    - MyDamageType is the type of damage that has been caused (explosion, fire etc.) - not very important.


We will now replace this with a simple mathematic formula to heal the target instead!

Code: Select all

Other.Health = ( Other.Health + Damage );

This will add the value specified in the projectile's 'Damage' variable to Other's health instead of taking it away. There is no need to call Other's 'TakeDamage' function, because he did not take damage through the shot!

Don't forget to compile the changed script, adjust the 'Damage' value of your new subclass to your desired healing amount and set the 'ProjectileClass' of your PulseGun subclass to your own PlasmaSphere subclass. Save and try it!
UnrealSP.org webmaster & administrator

User avatar Taz
Skaarj Berserker Skaarj Berserker
Posts: 252
Joined: 21 Jul 2008, 17:46
Location: Singapore

Subject:

Post Posted: 30 Jul 2008, 03:48

Would be nice to have a gun that recognizes who/what it's aiming at and acts accordingly. Nali/Nali rabbit/Nali cow? Heal. Skaarj or other nasties? Blast. :D

Tried a bit of scripting before but without much success. Will have to experiment a bit more in future.

User avatar TheIronKnuckle
Gilded Claw Gilded Claw
Posts: 1967
Joined: 12 Nov 2007, 07:21
Location: Riding my bicycle from the highest hill in Sydney to these forums

Subject:

Post Posted: 30 Jul 2008, 08:03

ONP had something like that. It was where the crosshair changed colour based on what you aimed at. red for enemy, green for ally, yellow for hazardess stuff, blue for harmless things like nali rabbits, and white for neutral.

User avatar Feralidragon
Skaarj Lord Skaarj Lord
Posts: 223
Joined: 15 Jul 2008, 22:41
Location: Liandri

Subject:

Post Posted: 30 Jul 2008, 10:39

TheIronKnuckle wrote:ONP had something like that. It was where the crosshair changed colour based on what you aimed at. red for enemy, green for ally, yellow for hazardess stuff, blue for harmless things like nali rabbits, and white for neutral.


Yeah, I never checked the code, but I know that it is not that hard to code.
I think it only changes the default crosshair, then aplly different colors (R,G,B) depending on your rotation or by tracing (I believe tracing more).

Then it checks if the actor IsA('Nali') for example and change the rgb of the crosshair.

As I never saw really the code, I guess that I have to do it to be sure of what I am talking about.


Who is online

Users browsing this forum: No registered users and 54 guests

Copyright © 2001-2024 UnrealSP.org

Powered by phpBB® Forum Software © phpBB Limited