Author Topic: Spawn at death location (Tag = Score +1)  (Read 1537 times)

Ah man, I suck at this scripting thing.

Lol, what do I do? I also tryed to return the parents on both functions. It keeps sayin: Backtrace: onimpact or CMDSelf Delete or damage.


I fixed, literally copy and paste it should work.

I fixed, literally copy and paste it should work.

It didnt work. It say: "unable to find object: '0' attempting to function 'get position'

When I die from falling it say: "Backtrace: onimpact......."
Die from bullets:                     "Backtrace: damage....."
Die from Self Delete:                     "Backtrace: cmdSelf Delete
Die from explosion:                 "Backtrace: onexplode"
« Last Edit: February 22, 2013, 10:44:38 PM by ZLMods »


It's good advice to never copy and paste what Brian Smith writes (for obvious reasons). Anyways, when you set the player's position to a variable in the gameConnection::onDeath function, you need to do it before calling the parent.

It's good advice to never copy and paste what Brian Smith writes (for obvious reasons). Anyways, when you set the player's position to a variable in the gameConnection::onDeath function, you need to do it before calling the parent.
Whats the difference between ::onDisable and ::onDeath?

  • OnDisable is when the player object no longer is controlled.
  • OnDeath is when the player dies.

I'm also pretty sure, when calling OnDeath, it triggers for the player object to be disabled.
« Last Edit: February 26, 2013, 12:22:50 AM by Honorabl3 »

    • OnDisable is when the player object no longer is controlled.
    • OnDeath is when the player dies.

    I'm also pretty sure, when calling OnDeath, it triggers for the player object to be disabled.
Oh, alright.

Anyone get this to work successfuly?

Ah, has anyone thought of a way to make this work? I appreciate your help

Quote
package spawnAtDeath
{
   function GameConnection::OnDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc)
   {
      %client.deathpos = %client.player.getPosition();
      %r = parent::OnDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc);
                 return %r;

   }
   function GameConnection::CreatePlayer(%client,%spawnPoint)
   {
      if(%client.deathpos !$= "")
      {
         %spawnPoint = %client.deathpos;
         %client.deathPos = "";
      }
      return parent::CreatePlayer(%client,%spawnPoint);

   }
};activatepackage(SpawnAtDeath);
« Last Edit: February 27, 2013, 03:21:46 PM by ZLMods »

Is there a way to prevent onDisable to happend? like, you die, the killer gains score, but you are still able to control your player without having to respawn again. kinda like a fakedeath that counts as a point toward the attacker.

Try to parent onDisabled, and returning it. This might glitch up some things, (nothing permanent) so be aware of the outcome.

Try to parent onDisabled, and returning it. This might glitch up some things, (nothing permanent) so be aware of the outcome.
I tryed doing that, but you still cant control your player.

Why kill them just to spawn them in the same location again? That sounds really silly. Just get rid of the 'killing them' part, I don't see why it's neccesary.

Make the weapon do 0 damage, and in the onDamage (I think it's still called if it does 0 damage, if not use onCollision)  do everything needed, such as giving the attacker a point, telling the person they need to walk back to the spawn, setting some sort of immunity and inability to attack until they reach the spawn, etc. If you need them to be hit multiple times, increment and check a timeHit variable.
« Last Edit: March 01, 2013, 02:07:56 PM by Headcrab Zombie »

Why kill them just to spawn them in the same location again? That sounds really silly. Just get rid of the 'killing them' part, I don't see why it's neccesary.

Make the weapon do 0 damage, and in the onDamage (I think it's still called if it does 0 damage, if not use onCollision)  do everything needed, such as giving the attacker a point, telling the person they need to walk back to the spawn, setting some sort of immunity and inability to attack until they reach the spawn, etc. If you need them to be hit multiple times, increment and check a timeHit variable.
lol, i dont know how to do all that, script wise