SeekingMissleData OnCollision

This is the development community to discuss tribes mod coding or to ask questions.

Moderator: Moderators

1 Mon Nov 25, 2013 4:14 pm

So i have a projectile that seeks targets and flys to them. I'm trying to make it so when the projectile hits a teammate, regardless if team damage is on or not, it heals them. Projectile works fine, but it is not detecting a collision. Any help would be appreciated.

Code: Select all
SeekingMissileData Seeker
{   
        bulletShapeName = "paint.dts";
   explosionTag = FunExp;
   collisionRadius = 0.1;
   mass = 0.0001;
   damageClass = 0;
   damageValue = 0;
   damageType = $RepairType;
   explosionRadius = 0.5;
   kickBackStrength = 0.001;
   muzzleVelocity = 65.0;
   terminalVelocity = 120.0;
   acceleration = 1.0;
   totalTime = 8.0;
   liveTime = 9.0;
   lightRange = 5.0;
   lightColor = { 1.0, 0.7, 0.5 };
   inheritedVelocityScale = 0.5;
   // rocket specific
      trailType   = 2;                // smoke trail
      trailString = "paint.dts";
      smokeDist   = 2.1;
   soundId = SoundJetHeavy;
   seekingTurningRadius = 10;

};

function Seeker::onCollision(%this,%object)
{   
   echo("test");
   GameBase::repairDamage(%object, 0.55);
}
User avatar
Ghost
2nd Lieutenant
2nd Lieutenant
 
Posts: 94

2 Mon Nov 25, 2013 5:12 pm

There is no ::onCollision callback for projectiles. They have onAdd, onRemove, onActivate and a few more that are all irrelevant to your needs.

The easy and working approach is going to player::onDamage (player.cs), and doing the healing from there.
Note that you don't know from within ::onDamage what kind of projectile hit you, but you DO know the damageType ($repairtype), so you use that and you use the %object variable that has the ID of the missile owner client, to create this special case of player damage.
User avatar
C--
Sorry....
 
Posts: 3299

3 Mon Nov 25, 2013 5:31 pm

Great, another thing us Angel enthusiasts have to worry about. As if OS missiles weren't enough...

8)
User avatar
EvanVolm
1st Lieutenant
1st Lieutenant
 
Posts: 288

4 Mon Nov 25, 2013 6:13 pm

This SeekingMissleData is annoying me.

Code: Select all
SeekingMissileData Seeker
{   
   bulletShapeName = "paint.dts";
   explosionTag = FunExp;
   collisionRadius = 0.1;
   mass = 0.0001;
   damageClass = 0;
   damageValue = 0;
   damageType = $RepairDamageType;
   explosionRadius = 0.5;
   kickBackStrength = 0.001;
   muzzleVelocity = 65.0;
   terminalVelocity = 120.0;
   acceleration = 1.0;
   totalTime = 8.0;
   liveTime = 9.0;
   lightRange = 5.0;
   lightColor = { 1.0, 0.7, 0.5 };
   inheritedVelocityScale = 0.5;
     // rocket specific
      trailType   = 2;                // smoke trail
      trailString = "paint.dts";
      smokeDist   = 2.1;
   soundId = SoundJetHeavy;
   seekingTurningRadius = 10;

};


And in Player.cs
Code: Select all
   if(%type == $RepairDamageType)
   {
      echo("hello");
      %damagedClient = Player::getClient(%this);
      %shooterClient = %object;
      if(Client::getTeam(%damagedClient) == Client::getTeam(%shooterClient) )
      {
         Client::sendMessage(%shooterClient,1,"test");
         GameBase::repairDamage(%damagedClient, 0.55);
      }
   }


1st- The trail type remains the same. I have it set as paint.dts but its rsmoke for some reason. If I change the trailType from 2 to 0 or 1 it doesn't change anything either.

2nd- It will not detect the RepairType damage type, I assume whatever is causing the trailType to remain unfazed is what is also causing the damagetype to remain unfazed as well.
Last edited by Ghost on Mon Nov 25, 2013 7:29 pm, edited 1 time in total.
User avatar
Ghost
2nd Lieutenant
2nd Lieutenant
 
Posts: 94

5 Mon Nov 25, 2013 7:07 pm

1. The seeking missile can not have a different trail

2. Is $RepairType defined anywhere?
bawb
Commander
Commander
 
Posts: 1203

6 Mon Nov 25, 2013 7:24 pm

Well other than having it in the projectile and the player.cs ondamage function, I added it into game.cs with the other DamageTypes:

Code: Select all
$RocketDamageType = 28;
$JettingDamage = 29;
$NullDamageType = 30;
$RepairDamageType = 31;


and in ServerItemUsage.cs with the other PopulateDamageScale's just in case that was the issue.

Code: Select all
PopulateDamageScale($RocketDamageType,         1.0, 1.0, 1.2, 1.2, 1.0, 1.0, 0.8, 0.8, 1.0, 1.0, 1.0, 1.0, 1.0, 0.8, 0.8, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0);
PopulateDamageScale($RepairDamageType,         1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.8, 0.8, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0);
PopulateDamageScale($JettingDamage,            1.0, 1.0, 0.5, 0.5, 1.0, 1.0, 0.5, 0.5, 1.0, 1.0, 0.7, 0.7, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0);


As far as I am aware It doesn't need to be defined anywhere else? Not sure.
I can't get this damn thing to work.
User avatar
Ghost
2nd Lieutenant
2nd Lieutenant
 
Posts: 94

7 Tue Nov 26, 2013 12:55 am

It needs to be defined in armordata.cs also if not already, This is a really gray area of tribes damagetypes. Anytime anyone has wanted something like this in a mod it becomes scrapped. Things like the healing mortar/sniper have always caused more problems then what they are worth. Many mods have tried this (Renegades/Shifter etc) but there is always an unseen problem with it, i've tried a few time a few different ways but always it seems never to work as intended(Healing enemies/enemy items).
Plas had a healing turret in Veng that seemed to work pretty well, never saw a full server test it but that might be one place to look.
I'm having the same problem right now and what i've done is used ondamge for the certain damagetype to add a healing effect that cancels out any damage, the game thinks the player takes damage but the healing is overpowered. The damage is merely a "trigger" for the effect. Not perfect but for now it works.
User avatar
Armageddonv2
Ensign
Ensign
 
Posts: 51

8 Tue Nov 26, 2013 2:09 pm

It can all be debugged you know... For example, at the beginning of the body of player::onDamage()
you can add echo("DAMAGE: " @ %damagetype); to find out the damage type...

It gives me the impression that your code is not being executed properly or has a syntax error somewhere...

Also: You do realize you need to restart Tribes after any change in the scripts, right?
User avatar
C--
Sorry....
 
Posts: 3299

9 Tue Nov 26, 2013 3:38 pm

C-- wrote:Also: You do realize you need to restart Tribes after any change in the scripts, right?


Of Course :stab:
User avatar
Ghost
2nd Lieutenant
2nd Lieutenant
 
Posts: 94


Return to Coder's Hangout

Who is online

Users browsing this forum: No registered users and 2 guests

cron