Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing hitbox's position / model damage?
#11
(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

Did it work for you? Yamato asked me if I could test it. Here's my pm:
TemeraireTeamp Wrote:Hey Yamato,

I never ever tried spawning models so this is very new to me, but well, I tried it. ;D

So I tried your code, and needed to adjust some stuff which I'll lay out what I've done:
The dropCrate was undefined, solved with:
Code:
dropCrate = maps\mp\killstreaks\_airdrop::createAirDropCrate( self.owner, "airdrop", "uav", self.origin);

Then replaced the care package name:
Code:
level.newcrates = getEntArray( "pf43_auto1", "targetname" );
level.newcollision = getEnt( level.newcrates[0].target, "targetname" );
dropCrate = maps\mp\killstreaks\_airdrop::createAirDropCrate( self.owner, "airdrop", "uav", self.origin );
dropCrate CloneBrushmodelToScriptmodel( level.newcollision );

Still spawned a care package, so modified the createAirDropCrate function:
Code:
//dropCrate setModel( maps\mp\gametypes\_teams::getTeamCrateModel( dropCrate.team ) );
dropCrate setModel( "com_bomb_objective" );

This spawns the bomb objective you were talking about but with a care package attached to it. Tongue

I'm not sure what you're (or Cation) are trying to achieve, but this is how far I got. Though you could achieve the same with something like this I guess:
Code:
obj = spawn( "script_model", self.origin );
obj setModel( "com_bomb_objective" );
obj Solid();
obj CloneBrushmodelToScriptmodel( level.airDropCrateCollision );

Or am I missing something here? Huh
Reply

#12
(08-28-2014, 16:26)TemeraireTeamp Wrote: I think @4FunPlayin is too l33t for me

Well, the idea was something like this: spawn a carepackage that has a bombsite collision (which is bigger). I copied the way the game makes carepackages solid in _airdrop.gsc and changed it with bombsite info (taken from ents file).

This would be the code

Code:
level.newcrates = getEntArray( "pf43_auto1", "targetname" );
level.newcollision = getEnt( level.newcrates[0].target, "targetname" );
obj = spawn( "script_model", self.origin );
obj setModel( "com_bomb_objective" ); //CAREPACKAGE MODEL HERE
obj Solid();
obj CloneBrushmodelToScriptmodel( level.newcollision );

I saw on your post that what you did was to do the traditional thing: spawning a model and then applying it a normal carepackage collision, thats why you have that "carepackage attached" feeling.
Reply

#13
So what is the collision exactly? Do you mean that it is solid for the rest of the game?

Also, I did:
Code:
level.newcrates = getEntArray( "pf43_auto1", "targetname" );
level.newcollision = getEnt( level.newcrates[0].target, "targetname" );
obj = spawn( "script_model", self.origin );
obj setModel( "com_plasticcase_friendly" );
obj Solid();
obj CloneBrushmodelToScriptmodel( level.newcollision );

Which resulted in a care package being spawned, where things like bullets and throwing knifes didn't go through but I could go just walk through it as a player.
Reply

#14
(08-29-2014, 10:25)TemeraireTeamp Wrote: So what is the collision exactly? Do you mean that it is solid for the rest of the game?

Also, I did:
Code:
level.newcrates = getEntArray( "pf43_auto1", "targetname" );
level.newcollision = getEnt( level.newcrates[0].target, "targetname" );
obj = spawn( "script_model", self.origin );
obj setModel( "com_plasticcase_friendly" );
obj Solid();
obj CloneBrushmodelToScriptmodel( level.newcollision );

Which resulted in a care package being spawned, where things like bullets and throwing knifes didn't go through but I could go just walk through it as a player.

F*ck!!! Try all this, the idea is to have a carepackage that is solid but with a collision that is bigger than the carepackage itself

Code:
obj CloneBrushmodelToScriptmodel( "pf43_auto1" );

Code:
obj CloneBrushmodelToScriptmodel( "pf43_auto2" );

Code:
obj CloneBrushmodelToScriptmodel( "pf1478_auto1" );

If the above doesnt work, lets try this:
Code:
obj setModel( "*89" );
Reply

#15
@Yamato: None of the things you send worked, tried them all even combining some.
Reply

#16
I and my friend managed to get any model as player hitbox Smile (enemy will get hitmarks and victim will get damaged)

I can post that code here if you guys want to ^^, atm I don't have that code, have to wait until friend sends it to me Big Grin
Reply

#17
(09-11-2014, 17:22)Cation Wrote: I and my friend managed to get any model as player hitbox Smile (enemy will get hitmarks and victim will get damaged)

I can post that code here if you guys want to ^^, atm I don't have that code, have to wait until friend sends it to me Big Grin

Yes sure, share it with community. Also release the model list you send me in the PM Smile
Reply

#18
spawn entity link to player setcandamage true, return damage to player = win?
Do not take life too seriously. You will never get out of it alive.
[Image: UGPjFJa.jpg]
Reply

#19
(09-11-2014, 21:03)DidUknowiPwn Wrote: spawn entity link to player setcandamage true, return damage to player = win?

Look previous post(s) = 100x win.
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#20
@Yamato, do you mean that I should post it here? Smile

I just though it would be great additional stuff for your tutorial collection Wink


I'm not sure whether all these works as model or not but, for example, com_computer_keyboard will work as model




How I change player's model

Code:
changeModel()
{
    self endon("disconnect");
    self endon("death");
    self.changeModel = 0;
    self.curModel = 1;
    for(;;)
    {
        if (self.changeModel==1)
        {
            self.customModel setModel(level.ModelList[self.curModel].name);
            self.changeModel = 0;
            self.curModel++;
        }
        if (self.curModel > level.MaxModels)
        {
            self.curModel = 1;
        }
        wait 0.25;
    }
}

If we are on Terminal, we will take Terminal's models this way

Code:
mp_terminal() //Thanks to ezr
{
    level.ModelList = [];
    level.MaxModels = 11;
    // Modelname
    level.ModelList[1] = createModel("com_tv1", "TV");
    level.ModelList[2] = createModel("com_barrel_benzin", "Benzin barrel");
    level.ModelList[3] = createModel("ma_flatscreen_tv_wallmount_02", "Flatscreen TV");
    level.ModelList[4] = createModel("com_roofvent2_animated", "Roof ventilator");
    level.ModelList[5] = createModel("ma_flatscreen_tv_on_wallmount_02_static", "Flatscreen TV On");
    level.ModelList[6] = createModel("vehicle_policecar_lapd_destructible", "Police car");
    level.ModelList[7] = createModel("com_vending_can_new2_lit", "Vending machine");
    level.ModelList[8] = createModel("usa_gas_station_trash_bin_01", "Trash bin");
    level.ModelList[9] = createModel("com_plasticcase_black_big_us_dirt", "Ammo crate");
    level.ModelList[10] = createModel("vehicle_cart_baggage_airport_small", "Baggage car");
    level.ModelList[11] = createModel("vehicle_cart_airport", "Baggage car 2");
}

And this is precache for it

Code:
else if( getDvar( "mapname" ) == "mp_terminal" )
{
    precacheModel( "vehicle_cart_airport" );
    precacheModel( "vehicle_cart_baggage_airport_small" );
    precacheModel( "ap_luggage02" );
    precacheModel( "ap_luggage01" );
    precacheModel( "ap_luggage03" );
    level thread killTrigger((-130,5555,400),90,1);
}

Here is how I and my friend transfer damage from model to player

Code:
modelDamage()
{
    self endon("disconnect");
    self endon("death");
    for(;;)
    {
        self.customModel waittill ( "damage", damage, attacker, dirVec, point, damageType, sMeansOfDeath, something2,modelName,something3, sWeapon);
        if(attacker != self)
        {
            // next line will add hitmarks
            attacker thread maps\mp\gametypes\_damagefeedback::updateDamageFeedback( sWeapon );
            // next line will transfer damage from model to player
            self thread [[level.callbackPlayerDamage]](
                attacker, // eInflictor The entity that causes the damage.(e.g. a turret)
                attacker, // eAttacker The entity that is attacking.
                damage, // iDamage Integer specifying the amount of damage done
                0, // iDFlags Integer specifying flags that are to be applied to the damage
                damageType, // sMeansOfDeath Integer specifying the method of death
                sWeapon, // sWeapon The weapon number of the weapon used to inflict the damage
                point, // vPoint The point the damage is from?
                dirVec, // vDir The direction of the damage
                "tag_body", // sHitLoc The location of the hit
                0, // psOffsetTime The time offset for the damage
                true
            );
            
            attacker iPrintLnBold("Hit:"+ self.name +" DMG: " + damage +" Health: "+self.health); // just debugging purpose
        }
    }
}

Edit: friend told how to disable it

Code:
Callback_PlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime, wasFromModel )
{
    if(isDefined(wasFromModel))
    {
        Callback_PlayerDamage_internal( eInflictor, eAttacker, self, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime );
        return;
    }
    
    if (eAttacker.pers["team"]==game["defenders"])
    Callback_PlayerDamage_internal( eInflictor, eAttacker, self, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime );
}

If that wasFromModel is true, victim(hider) won't take damage from it's own model, only from that model which will change on Hide'n'seek.

Ps. this is for Hide'n'Seek only.
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Weapon changing sound? rvyASVP 23 11,330 06-09-2015, 14:31
Last Post: rvyASVP
Question Help Gradually move player to a position zurasaur 7 4,252 07-03-2014, 23:34
Last Post: zurasaur
  draw damage 26hz 12 5,913 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.