Posts: 59
Threads: 8
Joined: Nov 2013
Reputation:
3
(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.
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.
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?
Posts: 3,535
Threads: 420
Joined: Dec 2010
Reputation:
106
(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.
Posts: 59
Threads: 8
Joined: Nov 2013
Reputation:
3
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.
Posts: 3,535
Threads: 420
Joined: Dec 2010
Reputation:
106
(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" );
Posts: 59
Threads: 8
Joined: Nov 2013
Reputation:
3
@Yamato: None of the things you send worked, tried them all even combining some.
Posts: 12
Threads: 2
Joined: Jul 2014
Reputation:
1
I and my friend managed to get any model as player hitbox (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
Posts: 3,535
Threads: 420
Joined: Dec 2010
Reputation:
106
Posts: 1,741
Threads: 93
Joined: Mar 2012
Reputation:
26
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.
Posts: 3,704
Threads: 147
Joined: Jan 2011
Reputation:
119
(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
Posts: 12
Threads: 2
Joined: Jul 2014
Reputation:
1
09-12-2014, 13:43
(This post was last modified: 09-12-2014, 18:10 by Cation.)
@Yamato, do you mean that I should post it here?
I just though it would be great additional stuff for your tutorial collection
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.
|