UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: vinnyz500 on March 29, 2015, 12:34:32 am

Title: Adding delay to scavenger script
Post by: vinnyz500 on March 29, 2015, 12:34:32 am
Hey UGX, i got a script from rorkes weapon pack with the scavenger script in it and the FX plays immediatly rather than waiting 2.5s. How would i fix this? i see a code for it to wait but it doesnt seem to want to... Here is the code (i know its sloppy thats how it came  :(
Code Snippet
Plaintext
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#using_animtree( "generic_human" );
init()
{
precacheModel("bo1_scavenger_non_upgraded_projectile");
precacheModel("tag_origin");
level thread sniper_explosive_on_player_connect();
level._effect["zombie_obliterate"] = loadfx( "scvgr/none" );
level._effect["scvgr_explode"] = loadfx( "scvgr/fx_scavenger_explode" );
level._effect["scvgr_explode_upgraded"] = loadfx( "scvgr/fx_scavenger_up_explode" );
}

sniper_explosive_on_player_connect()
{
for( ;; )
{
level waittill( "connecting", player );
player thread watch_for_sniper_bolt();
}
}

creath_hud_elems()
{
self endon( "death" );
self endon( "disconnect" );
player = self;
for (;;)
{
wait(1);
zombies = getaiarray("axis");
for(i = 0; i < zombies.size; i++)
zombies[i] thread create_zombie_hud_elems(player);
}
}

create_zombie_hud_elems(player)
{
if(player.scoped_in == true)
{
iconOrg = self.origin;icon = NewClientHudElem(player);
icon.x = iconOrg[0];
icon.y = iconOrg[1];
icon.z = iconOrg[2] + 54;
icon.alpha = 1;
icon.archived = true;
icon setShader("zombie_kill", 120, 120);
wait 1;icon destroy();
}
}

watch_for_sniper_bolt()
{
self endon( "death" );
self endon( "disconnect" );
for (;;)
{
point = undefined;
self waittill("projectile_impact", weapon, point);
if(isdefined(point))if(weapon == "scavenger")
{
self thread scvgr_explode(point);
}
if(weapon == "scavenger_upgraded")
{
self thread scvgr_explode_upgraded(point);
}
}
}

scvgr_explode(point)
{
target = undefined;
ai = getaiarray("axis");
target = get_closest_living(point, ai, 400 );
angles = self getplayerangles();
dist = distance2d(target.origin, point);
grenade = spawn("script_origin", point);
model = spawn("script_model", grenade.origin);
model.angles = angles;
model setmodel("bo1_scavenger_non_upgraded_projectile");
soundemitter = spawn("script_model", grenade.origin);
soundemitter setmodel("tag_origin");
soundemitter thread scvgr_fired_sound(grenade);
if(dist < 30)
{
grenade linkto(target, "J_MainRoot");
model linkto(target, "J_MainRoot");
}
wait 2.5;
playfx( level._effect["scvgr_explode"], grenade.origin );
model delete();
excluders = undefined;
zombies = undefined;
ai = getaiarray("axis");
zombies = get_array_of_closest( grenade.origin, ai, excluders, 666, 400 );
self thread damage_self(grenade, 60);
player = self;
for(i = 0; i < zombies.size; i++)
{
zombies[i] thread kill_or_damage(grenade, player);
}
wait 3;
grenade delete();
}

scvgr_explode_upgraded(point)
{
target = undefined;
ai = getaiarray("axis");
target = get_closest_living(point, ai, 800 );
angles = self getplayerangles();
dist = distance2d(target.origin, point);
grenade = spawn("script_origin", point);
model = spawn("script_model", grenade.origin);
model.angles = angles;
model setmodel("bo1_scavenger_non_upgraded_projectile");
soundemitter = spawn("script_model", grenade.origin);
soundemitter setmodel("tag_origin");
soundemitter thread scvgr_fired_sound_upgraded(grenade);
if(dist < 30)
{
grenade linkto(target, "J_MainRoot");
model linkto(target, "J_MainRoot");
}
wait 3.5;
playfx( level._effect["scvgr_explode_upgraded"], grenade.origin );
model delete();
excluders = undefined;
zombies = undefined;
ai = getaiarray("axis");
zombies = get_array_of_closest( grenade.origin, ai, excluders, 666, 800 );
self thread damage_self(grenade, 120);
player = self;
for(i = 0; i < zombies.size; i++)
{
zombies[i] thread kill_or_damage_upgraded(grenade, player);
}
wait 3;
grenade delete();
}

scvgr_fired_sound(grenade)
{
self playsound("scavenger_build_up");
self linkto(grenade);
wait 2.5;
self unlink();
self playsound("scavenger_explode");
wait 0.1;
self delete();
}

scvgr_fired_sound_upgraded(grenade)
{
self playsound("scavenger_build_up");
self linkto(grenade);
wait 3.5;self unlink();
self playsound("scavenger_explode");
}

kill_or_damage(grenade, player)
{
if(self.health < 10000)
{
playfxontag(level._effect["zombie_obliterate"],self,"tag_origin");
player maps\_zombiemode_score::add_to_player_score(50);
}
player maps\_zombiemode_score::add_to_player_score(10);
self dodamage(10000, grenade.origin);
}

kill_or_damage_upgraded(grenade, player)
{
if(self.health < 20000 && self.brutus == false)
{
playfxontag(level._effect["zombie_obliterate"],self,"tag_origin");
player maps\_zombiemode_score::add_to_player_score(50);
}
player maps\_zombiemode_score::add_to_player_score(10);
self dodamage(20000, grenade.origin);
}

damage_self(grenade, damage)
{
dist = distance(grenade.origin, self.origin);
if(dist < 400)
{
RadiusDamage(self.origin, 50, damage, damage);
}
}
but it doesnt work...

EDIT: shit so sorry i put in wrong section, if you could move it to scripting i would appreciate it :)
Title: Re: Adding delay to scavenger script
Post by: Harry Bo21 on March 29, 2015, 01:01:25 am
moved and fixed your code box

From what i see, theres no reason it shouldnt wait. Should be working fine
Title: Re: Adding delay to scavenger script
Post by: HitmanVere on March 29, 2015, 01:05:44 am
FX is played through weapon file. Remove it from there and then add FX in mod.csv
Title: Re: Adding delay to scavenger script
Post by: vinnyz500 on March 29, 2015, 03:23:13 am
FX is played through weapon file. Remove it from there and then add FX in mod.csv
I tried that, it still played the FX upon impact. I mean, it doesnt look all that bad, the FX plays and as it is closing out it kills them.

(https://www.ugx-mods.com/forum/proxy.php?request=http%3A%2F%2Fgyazo.com%2Fda563bf7436d6c98794b72e23b42ca61.png&hash=eb517450a7658594216178b865508a720ebad8e3)
Title: Re: Adding delay to scavenger script
Post by: jjbradman on March 29, 2015, 05:40:16 am
what he meant was to remove the fx from the weaponfile and then in watch for sniper bolt function add the desired wait like "3 secs" then check in the "scvgr_explode(point)" function the line where fx is played and add that fx to your mod.csv.

ps.nevermind i was lazy to read the code, it seems to be fine so just do the weaponfile thing and ignore my post :P
Title: Re: Adding delay to scavenger script
Post by: Rorke on March 29, 2015, 10:01:20 am
what exactly are you having issues with? if its the fx being played at wrong time then smasher said he tried to fix it but he cdnt see anything wrong so it went un-fixed as for the weapon file well do what you want........
Title: Re: Adding delay to scavenger script
Post by: HitmanVere on March 29, 2015, 10:04:58 am
I tried that, it still played the FX upon impact. I mean, it doesnt look all that bad, the FX plays and as it is closing out it kills them.

(http://gyazo.com/da563bf7436d6c98794b72e23b42ca61.png)

Untick ProjImpactExplode, then remove scavenger_explode sound. You sure FX is like this in mod.csv: fx,scvgr/fx_scavenger_explode
Title: Re: Adding delay to scavenger script
Post by: vinnyz500 on March 30, 2015, 02:28:14 am
Untick ProjImpactExplode, then remove scavenger_explode sound. You sure FX is like this in mod.csv: fx,scvgr/fx_scavenger_explode
if I un tick that the weapon does no damage
Title: Re: Adding delay to scavenger script
Post by: Rorke on March 31, 2015, 01:31:20 pm
have you tried changeing the time till the prj explodes?
Title: Re: Adding delay to scavenger script
Post by: HitmanVere on March 31, 2015, 01:35:14 pm
if I un tick that the weapon does no damage

Wait, checking mine

Oh yeah, keep it ticked. But remove the FX stuff in weapon file
Title: Re: Adding delay to scavenger script
Post by: vinnyz500 on April 01, 2015, 02:02:45 am
To simplify it, just remove the sound and FX called in the projectile section and call it in your mod. Works perfect for me. Thanks HitmanVere
Title: Re: Adding delay to scavenger script
Post by: HitmanVere on April 01, 2015, 09:41:05 am
To simplify it, just remove the sound and FX called in the projectile section and call it in your mod. Works perfect for me. Thanks HitmanVere

Which is what I said and you didnt mark my answer? :P