Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing hitbox's position / model damage?
#1
Hi guys

I'm wondering if it's possible to change hitbox's position to point where self.origin is.

On my mod, I can move self.origin on x and y plane +/- 10 units but hitbox's won't move.


Also, is there possibility to transfer damage from model to player?
I mean, if you are big transformer and you shoot anywhere to that transformer, you would take damage.
Reply

#2
To transfer model damage to player you need "attacker". You can write damage event: ( pseudocode ). Call this one from model, i.e "model thread damageEvent();" also add "model setcandamage(1);"
Code:
for(;;) ...
self waittill("damage", attacker);
// do something
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#3
Does that damageEvent() already exist or do I have to create it and which part on that code transfers that damage? :O

Sorry, I'm pretty new on this .gsc Smile
Reply

#4
(08-02-2014, 08:11)Cation Wrote: Does that damageEvent() already exist or do I have to create it and which part on that code transfers that damage? :O

Sorry, I'm pretty new on this .gsc Smile

There may be errors so
Code:
....
// your model spawning code
model setmodel etcc...
model setcandamage(1); // model can accept damage
model thread modelDoDamange();

.....


modelDoDamage() {
      //self endon("destroy"); // In case if you want your model to be destroyed
      // you need to make healthEvent
      for(;;) {  // loop
              self waittill("damage", attacker); // "self" is not player, it's model.
              // Now manipulate with the attacker. You can do "attacker.health-=10;"
              // or whatever.
             wait .01;
      }
}
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#5
Yes, you can do it. This code is directly copied from my zombie mod (self.vida is the model I use as hitbox)

Code:
    while(1)
    {
        // Make it damageable and give damage feedback
        self.vida waittill ( "damage", eInflictor, attacker, victim, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime );
        attacker thread maps\mp\gametypes\_damagefeedback::updateDamageFeedback( sHitLoc );
        // Decrease zombie health
        self.vida.health -= iDamage;

Also, the hitbox needs something like:

Code:
hitbox setcandamage( true );
hitbox.health = 100;
Reply

#6
Since it's possible to transfer damage from model to player, I don't have to move hitbox.. but if I move that hitbox, I can get hitmarks, right?

Is it possible to resize that hitbox or use model's texture as hitbox? Big Grin That latter would be so awesome.

Edit 1: if I understood correctly, you do use your model as hitbox, that texture? It could be gas tank too, right?
Edit 2: model gives hitmarks properly but won't damage model's owner when enemy shoots model
Reply

#7
I have managed to get damage from model to player but player won't die even if he's health is negative...
And oddly, blast shield appears to be on when I add those codes.

@Yamato, I don't know how that your mod works but eInflictor gives damage, not that iDamage...
eInflictor: damage amount
attacker: attacker
victim: vDir
iDamage: vPoint
iDFlags: damage type which might be correct
vPoint: model's name where you hit
sHitloc: weapon which is used when hit


Ps. Is it possible to block some console commands with mod?
Reply

#8
(08-03-2014, 12:54)Cation Wrote: I have managed to get damage from model to player but player won't die even if he's health is negative...
And oddly, blast shield appears to be on when I add those codes.

@Yamato, I don't know how that your mod works but eInflictor gives damage, not that iDamage...
eInflictor: damage amount
attacker: attacker
victim: vDir
iDamage: vPoint
iDFlags: damage type which might be correct
vPoint: model's name where you hit
sHitloc: weapon which is used when hit


Ps. Is it possible to block some console commands with mod?

Weird, I always got damage done with that iDamage and was working well. Blast shield used to appear when I shot them with weapons with the ones I create "RadiusDamages". The hitmarkers will appear if you hit the model/hitbox. And yes, in theory you could be able to make bigger the hitbox (I always used the carepackage collision as hitbox for zombies since it fits well in size). Maybe the Demolition bomb collision is the best (it works on all maps), you might need to obtain it by seeing a d3dbsp.ents file. This is how the game makes solid the carepackage and it can applies to other collisions as well.

Code:
level.airDropCrates = getEntArray( "care_package", "targetname" );
level.airDropCrateCollision = getEnt( level.airDropCrates[0].target, "targetname" );
dropCrate CloneBrushmodelToScriptmodel( level.airDropCrateCollision );

I think you could get the bomb one like this, it could be "exploder" the collisions targetname.

Code:
level.BiggerCollision = getEnt( "exploder", "targetname" );

Make a function that solves the negative hp (this is a bad one):

Code:
if( self.health <= 0 )
self suicide(); //put proper death log here

d3dbsp.ents file extracting tutorial:
http://www.itsmods.com/forum/Thread-Tuto...-file.html

_________________________________

EDIT: I am getting confused as shit lol, this is carepackage info
"target" "pf394_auto1"
"targetname" "care_package"

Bomb one is this one:
"target" "pf43_auto2"
"targetname" "pf43_auto1"

So by copying the carepackage code and replacing:
Code:
level.newcrates = getEntArray( "pf43_auto1", "targetname" );
level.newcollision = getEnt( level.newcrates[0].target, "targetname" );
dropCrate CloneBrushmodelToScriptmodel( level.newcollision );

Cant test if this works because I dont have the game.
Reply

#9
Does that collision thing works on other objects as well?

If yes, we (I with my friend) could make new zombie maps with other objects as well, so we don't have to use those crates all the time since we have used airdropcrates since alterIW.

I'm trying to find proper death log so players can get those kills too Tongue

Btw Yamato, you have helped me so much. Smile
Reply

#10
(08-04-2014, 12:40)Cation Wrote: Does that collision thing works on other objects as well?

If yes, we (I with my friend) could make new zombie maps with other objects as well, so we don't have to use those crates all the time since we have used airdropcrates since alterIW.

I'm trying to find proper death log so players can get those kills too Tongue

Btw Yamato, you have helped me so much. Smile

Yes, I think it works, I remember seeing sometime ago something about that on another site, cant remember where.

Just see that tutorial about extracting d3dbsp.ents (I have put link in previous reply), if you search in it words like targetname or script_model you can find the collisions of some particular objects. Its a bit messy but you can get some good info from there.
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Weapon changing sound? rvyASVP 23 11,686 06-09-2015, 14:31
Last Post: rvyASVP
Question Help Gradually move player to a position zurasaur 7 4,371 07-03-2014, 23:34
Last Post: zurasaur
  draw damage 26hz 12 6,064 06-22-2014, 14:48
Last Post: 26hz

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.