Posts: 12
Threads: 2
Joined: Jul 2014
Reputation:
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.
Posts: 3,704
Threads: 147
Joined: Jan 2011
Reputation:
119
08-01-2014, 20:48
(This post was last modified: 08-02-2014, 00:59 by Nekochan.)
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
Posts: 12
Threads: 2
Joined: Jul 2014
Reputation:
1
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
Posts: 3,704
Threads: 147
Joined: Jan 2011
Reputation:
119
08-02-2014, 13:10
(This post was last modified: 08-02-2014, 13:12 by Nekochan.)
(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
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
Posts: 3,535
Threads: 420
Joined: Dec 2010
Reputation:
106
08-02-2014, 15:21
(This post was last modified: 08-02-2014, 15:23 by Yamato.)
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;
Posts: 12
Threads: 2
Joined: Jul 2014
Reputation:
1
08-02-2014, 17:07
(This post was last modified: 08-02-2014, 18:47 by Cation.)
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? 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
Posts: 12
Threads: 2
Joined: Jul 2014
Reputation:
1
08-03-2014, 12:54
(This post was last modified: 08-03-2014, 19:45 by Cation.)
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?
Posts: 3,535
Threads: 420
Joined: Dec 2010
Reputation:
106
08-04-2014, 11:51
(This post was last modified: 08-04-2014, 11:59 by Yamato.)
(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.
Posts: 12
Threads: 2
Joined: Jul 2014
Reputation:
1
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
Btw Yamato, you have helped me so much.
Posts: 3,535
Threads: 420
Joined: Dec 2010
Reputation:
106
08-04-2014, 13:17
(This post was last modified: 08-04-2014, 13:17 by Yamato.)
(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
Btw Yamato, you have helped me so much.
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.
|