UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: alaurenc9 on December 17, 2015, 12:01:25 am

Title: Can You Spawn A Grenade And Blow It Up With Spare Weapon Files And MagicBullet?
Post by: alaurenc9 on December 17, 2015, 12:01:25 am
So I am making the crossbow and scavenger, and so far all I have come up with on the explosion part is some scripted crap that might not be accurate. Then I thought, can I do this?

Code Snippet
Plaintext
	explosive_grenade = MagicBullet( explosion_weapon, model.origin, model.origin, self );
explosive_grenade Detonate( self );

model is the entity that is the crossbow dart, so model.origin is the explosion origin.
explosion_weapon would be a weapon file that is mostly blank and would only spawn a grenade when fired that blows up with all the right stats, etc. and would only be used for this.
self is the player.
If set up correctly, can I use this to simply trigger and explosion at that point?
Title: Re: Can You Spawn A Grenade And Blow It Up With Spare Weapon Files And MagicBullet?
Post by: lilrifa on December 17, 2015, 12:05:07 am
MagicGrenade() or MagicGrenadeManual()?
Title: Re: Can You Spawn A Grenade And Blow It Up With Spare Weapon Files And MagicBullet?
Post by: alaurenc9 on December 17, 2015, 02:34:43 am
Both of those functions require being called on AI and are basically for making an AI throw a grenade and the grenade is somehow determined with the AI or something.... so those cannot help here. MagicBullet seems best here. The only thing is.... can you define the grenade or projectile like I do in this little chunk of code if the weapon file is set to shoot projectiles or grenades? I found this method used in Black Ops 2 but does it work in World at War? And if so, can you call Detonate(); on it? That's all I really want to know.
Title: Re: Can You Spawn A Grenade And Blow It Up With Spare Weapon Files And MagicBullet?
Post by: Harry Bo21 on December 17, 2015, 02:43:48 am
Both of those functions require being called on AI and are basically for making an AI throw a grenade and the grenade is somehow determined with the AI or something.... so those cannot help here. MagicBullet seems best here. The only thing is.... can you define the grenade or projectile like I do in this little chunk of code if the weapon file is set to shoot projectiles or grenades? I found this method used in Black Ops 2 but does it work in World at War? And if so, can you call Detonate(); on it? That's all I really want to know.
actually they require a "entity"

player or ai, or anything infact. This is how i did the grenades for my dig sites

and firing projectiles "does" reference "the object it fired"

self waittill( "weapon_fired", grenade );

grenade = the grenade

and detonate works on that... Its down to how you set up the weaponfile its using

something along those lines
Title: Re: Can You Spawn A Grenade And Blow It Up With Spare Weapon Files And MagicBullet?
Post by: alaurenc9 on December 17, 2015, 02:45:46 am
actually they require a "entity"

player or ai, or anything infact. This is how i did the grenades for my dig sites

and firing projectiles "does" reference "the object it fired"

self waittill( "weapon_fired", grenade );

grenade = the grenade

and detonate works on that... Its down to how you set up the weaponfile its using

something along those lines

o wow rly u can define that stuff in "weapon_fired" waittill? I thought thats wut "grenade_fired" and "missile_fired" was for.

Anyways does this mean i can do

grenade = MagicBullet( whatever );

and if so, i can call Detonate(); on this?
Title: Re: Can You Spawn A Grenade And Blow It Up With Spare Weapon Files And MagicBullet?
Post by: Harry Bo21 on December 17, 2015, 02:49:49 am
no its "already" being passed, your just deciding what you wanna call it to refer to it, could call that anything, doesnt need to be grenade

look at the WW scripts from BO1 and 2

the staffs even use magic bullet, although i still havent got that working and lost interest

Code Snippet
Plaintext
self waittill( "grenade_fired", grenade );
wait .1;
grenade detonate();

cant remember which notify it is, but depends on the weapon file. So grenade_fired wont work on a bullet weapon or whatever. Make it a grenade type and this should work, and it should still be treated as primary and work otherwise as normal

Cant remember it exactly, but if you look through some of treyarchs weapons youll find it, used this for my TG and shield scripts

betties do something similar too, as they use a "fake" model, rather than the one in the weaponfile

i used this to have them place straight on to the floor instead of watching it drop to the floor, which seemed silly to me
Title: Re: Can You Spawn A Grenade And Blow It Up With Spare Weapon Files And MagicBullet?
Post by: alaurenc9 on December 17, 2015, 02:57:54 am
no its "already" being passed, your just deciding what you wanna call it to refer to it, could call that anything, doesnt need to be grenade

look at the WW scripts from BO1 and 2

the staffs even use magic bullet, although i still havent got that working and lost interest

Code Snippet
Plaintext
self waittill( "grenade_fired", grenade );
wait .1;
grenade detonate();

cant remember which notify it is, but depends on the weapon file. So grenade_fired wont work on a bullet weapon or whatever. Make it a grenade type and this should work, and it should still be treated as primary and work otherwise as normal

Cant remember it exactly, but if you look through some of treyarchs weapons youll find it, used this for my TG and shield scripts

betties do something similar too, as they use a "fake" model, rather than the one in the weaponfile

i used this to have them place straight on to the floor instead of watching it drop to the floor, which seemed silly to me

i think your missing the point of wut i'm trying to do. here to make it easier, ill paste my script in. whoever steals it, good for u i dont care:

Code Snippet
Plaintext
wait_for_crossbow_fired()
{
self endon( "disconnect" );
while( true )
{
self waittill( "missile_fire", missile, weapon );
switch( weapon )
{
case "zombie_crossbow":
self thread crossbow_fired( missile, false );
break;

case "zombie_crossbow_upgraded":
self thread crossbow_fired( missile, true );
break;
}
}
}

crossbow_fired( missile, is_upgraded )
{
if( is_upgraded )
{
beep_sound = "crossbow_beep_upgraded";
blink_fx = level._effect[ "crossbow_explosive_blink_upgraded" ];
trail_fx = level._effect[ "crossbow_explosive_trail_upgraded" ];
timer = 2.1;
radius = 100;
explosion_weapon = "zombie_crossbow_explode_upgraded";
}
else
{
beep_sound = "crossbow_beep_normal";
blink_fx = level._effect[ "crossbow_explosive_blink_normal" ];
trail_fx = level._effect[ "crossbow_explosive_trail_normal" ];
timer = 4.2;
radius = 100;
explosion_weapon = "zombie_crossbow_explode";
}
missile Hide();
model = Spawn( "script_model", missile.origin );
model SetModel( "t5_weapon_crossbow_bolt" );
model.angles = missile.angles;
model.owner = self;
trail_model = Spawn( "script_model", model GetTagOrigin( "tag_fx" ) );
trail_model SetModel( "tag_origin" );
trail_model.angles = model GetTagAngles( "tag_fx" );
trail_model LinkTo( model, "tag_fx", ( 0, 0, 0 ), ( 0, 0, 0 ) );
PlayFXOnTag( trail_fx, trail_model, "tag_origin" );
while( IsDefined( missile ) )
{
model.last_origin = model.origin;
model.origin = missile.origin;
model.last_angles = model.angles;
model.angles = missile.angles;
wait 0.05;
}
trail_model Delete();
impact_direction = VectorNormalize( model.origin - model.last_origin );
infront = model.origin + ( impact_direction * 10000 );
trace = BulletTrace( model.origin, infront, true, model );
if( IsDefined( trace[ "entity" ] ) )
{
model_list = [];
model_list[ model_list.size ] = trace[ "entity" ].model;
size = trace[ "entity" ] GetAttachSize();
for( i = 0; i < size; i ++ )
{
model_name = trace[ "entity" ] GetAttachModelName( i );
model_list[ model_list.size ] = model_name;
}
tag_list = [];
for( i = 0; i < model_list.size; i ++ )
{
num = GetNumParts( model_list[i] );
for( m = 0; m < num; m ++ )
{
tag_name = GetPartName( model_list[i], m );
tag_list[ tag_list.size ] = tag_name;
}
}
closest = tag_list[0];
dist = DistanceSquared( model.origin, trace[ "entity" ] GetTagOrigin( closest ) );
for( i = 1; i < tag_list.size; i ++ )
{
new_dist = DistanceSquared( model.origin, trace[ "entity" ] GetTagOrigin( tag_list[i] ) );
if( new_dist < dist )
{
closest = tag_list[i];
dist = new_dist;
}
}
model EnableLinkTo();
model LinkTo( trace[ "entity" ], closest );
model thread unlink_event( trace[ "entity" ], closest );
}
if( is_upgraded )
{
if( IsDefined( trace[ "entity" ] ) )
{
if( IsPlayer( trace[ "entity" ] ) )
{
model create_zombie_point_of_interest( 1536, 96, 10000, true );
}
else if( IsAI( trace[ "entity" ] ) )
{
if( IsAlive( trace[ "entity" ] ) )
{
trace[ "entity" ] thread monkey_bolt_taunts( model );
}
model create_zombie_point_of_interest( 1536, 96, 10000, true );
valid_poi = check_point_in_active_zone( model.origin );
if( !valid_poi )
{
valid_poi = check_point_in_playable_area( model.origin );
}
if( valid_poi )
{
model thread create_zombie_point_of_interest_attractor_positions( 4, 45 );
}
}
}
else
{
valid_poi = check_point_in_active_zone( model.origin );
if( !valid_poi )
{
valid_poi = check_point_in_playable_area( model.origin );
}
if( valid_poi )
{
model create_zombie_point_of_interest( 1536, 96, 10000, true );
model thread create_zombie_point_of_interest_attractor_positions( 4, 45 );
}
}
}
model PlaySound( beep_sound );
PlayFXOnTag( blink_fx, model, "tag_fx" );
bolt_indicator = NewClientHudElem( self );
bolt_indicator SetTargetEnt( model );
bolt_indicator SetShader( "hud_indicator_crossbow_explosive", 64, 64 );
bolt_indicator SetWayPoint( true, "hud_indicator_crossbow_explosive" );
if( Distance( self GetEye(), model.origin ) < radius )
{
bolt_indicator.alpha = 0.8;
is_hidden = false;
}
else
{
bolt_indicator.alpha = 0;
is_hidden = true;
}
start_time = GetTime();
while( GetTime() - start_time < timer * 1000 )
{
wait 0.05;
if( Distance( self GetEye(), model.origin ) < radius )
{
if( is_hidden )
{
bolt_indicator FadeOverTime( 0.25 );
bolt_indicator.alpha = 0.8;
is_hidden = false;
}
}
else
{
if( !is_hidden )
{
bolt_indicator FadeOverTime( 0.25 );
bolt_indicator.alpha = 0;
is_hidden = true;
}
}
}
bolt_indicator Destroy();
explosive_grenade = MagicBullet( explosion_weapon, model.origin, model.origin, self );
explosive_grenade Detonate( self );
model Delete();
}

so i want to use this magicbullet thing for the explosion when the crossbow bolt hits the end of the timer. I'm not trying to make a weapon or something that explodes on detonation or anything.
Title: Re: Can You Spawn A Grenade And Blow It Up With Spare Weapon Files And MagicBullet?
Post by: Harry Bo21 on December 17, 2015, 03:09:46 am
i thnk its you not getting me, as what you just posted is practically the same...

i was under the impression "missile_fired" didnt work on COD 5, if it does, sounds like thats what you need, but it wont use the same functions as grenades, so detonate proba bly doesnt apply

i dunno anyway, havent touched cod 5 in months, and dont intend to. have fun
Title: Re: Can You Spawn A Grenade And Blow It Up With Spare Weapon Files And MagicBullet?
Post by: alaurenc9 on December 17, 2015, 03:15:23 am
i thnk its you not getting me, as what you just posted is practically the same...

i was under the impression "missile_fired" didnt work on COD 5, if it does, sounds like thats what you need, but it wont use the same functions as grenades, so detonate proba bly doesnt apply

i dunno anyway, havent touched cod 5 in months, and dont intend to. have fun

Hmm well idk. I don't think I have a clear enough answer, but asking around on the forums won't really help. I'll just wait until this weekend when I get my pc again and figure this out myself. thanks anyways. And how come everyone is done with World at War now it seems? A couple friends told me they were done and now you.... whats the deal? Are we even sure bo3 will have mod tools? and if so is this what you are waiting for?
Title: Re: Can You Spawn A Grenade And Blow It Up With Spare Weapon Files And MagicBullet?
Post by: Harry Bo21 on December 17, 2015, 03:16:57 am
i think the fact treyarch outright stated "you will get mod tools, including mapping and gametypes, closed alpha starts in march"

is pretty definitive lol

and that is why, not wasting time on cod 5 just so i have to do it all over again to move it to bo3. Seems pointless - plus like you said everyone else has been giving up, including people i was part way through helping so, taking a hiatus
Title: Re: Can You Spawn A Grenade And Blow It Up With Spare Weapon Files And MagicBullet?
Post by: alaurenc9 on December 17, 2015, 03:23:52 am
i think the fact treyarch outright stated "you will get mod tools, including mapping and gametypes, closed alpha starts in march"

is pretty definitive lol

and that is why, not wasting time on cod 5 just so i have to do it all over again to move it to bo3. Seems pointless - plus like you said everyone else has been giving up, including people i was part way through helping so, taking a hiatus

o they said that exactly? o ok well then yeah lol they are coming out. sorry i havent really been keeping up with that stuff. so yea makes sense why your quitting. I still got some mods to finish tho so im gonna stay here in good old WaW for a bit.
Title: Re: Can You Spawn A Grenade And Blow It Up With Spare Weapon Files And MagicBullet?
Post by: Harry Bo21 on December 17, 2015, 03:26:20 am
o they said that exactly? o ok well then yeah lol they are coming out. sorry i havent really been keeping up with that stuff. so yea makes sense why your quitting. I still got some mods to finish tho so im gonna stay here in good old WaW for a bit.
ages ago, theres a webpage for it. People were talking about it right away,

give it a while and im sure someone will find and link it

I havent "quit", just waiting until i know what is or isnt worth it, still cleaning up a few bugs with things people keep sending me messages about

* EDIT * might be this but i cant view it on this pc

http://ugx-mods.com/forum/index.php/topic,9055.0.html (http://ugx-mods.com/forum/index.php/topic,9055.0.html)