UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: DeletedUser on April 20, 2018, 12:06:45 am

Title: Animated Barkin Doggos (Prefab help!)
Post by: DeletedUser on April 20, 2018, 12:06:45 am
So i need help with this Prefab! Im using these dogs for scenery in my map.

I do everthing it says but i end up with a bad syntax error...and i removed everything that i did to make sure it was this prefab and surely enough the map worked fine when i removed all the barkin dog stuff...

GSC Code in the prefab:
Code Snippet
Plaintext
#include common_scripts\utility;
#include maps\_utility;
#include maps\_music;
#include maps\_anim;
#include animscripts\shared;
#include animscripts\utility;
#using_animtree( "dog" );
//////////////////
//in mapname.gsc
//maps\_zombiemode::main();
//thread maps\animated_dogs::setup_animated_barking_dogs();
///////////////////
//add to mod.csv
/*
xanim,german_shepherd_sleeping
xanim,german_shepherd_eating_loop
xanim,german_shepherd_attackidle_bark
xanim,german_shepherd_idle
*/
//

setup_animated_barking_dogs()
{
animated_barking_dogs = GetEntarray( "animated_barking_dogs", "targetname" );
array_thread( animated_barking_dogs, ::set_anim_playback_rate_dogs );
}
set_anim_playback_rate_dogs()
{
self useAnimTree( #animtree );
self endon("killanimscript");
self.animplaybackrate = 0.9 + randomfloat( 0.2 );
self.moveplaybackrate = 1;
self clearanim(%german_shepherd_attackidle_knob, 0.1);
while (1)
{
self attackidle_bark();
self animscripts\shared::DoNoteTracks("done");
}
}
attackidle_bark()
{
if( isdefined( self.script_noteworthy ) && self.script_noteworthy == "german_shepherd_idle" )
{
self setflaggedanimrestart( "dog_idle", %german_shepherd_idle, 1, 0.2, self.animplaybackrate );
}
if( isdefined( self.script_noteworthy ) && self.script_noteworthy == "german_shepherd_sleeping" )
{
self setflaggedanimrestart( "dog_idle", %german_shepherd_sleeping, 1, 0.2, self.animplaybackrate );
}
if( isdefined( self.script_noteworthy ) && self.script_noteworthy == "german_shepherd_eating_loop" )
{
self setflaggedanimrestart( "dog_idle", %german_shepherd_eating_loop, 1, 0.2, self.animplaybackrate );
}
if( isdefined( self.script_noteworthy ) && self.script_noteworthy == "german_shepherd_attackidle_bark" )
{
self setflaggedanimrestart( "dog_idle", %german_shepherd_attackidle_bark, 1, 0.2, self.animplaybackrate );
}
}

So i added #Include and the #Using anim tree to my Utilities tab in mymapname.gsc and when i added all this stuff i got a bad syntax error. I am not sure what the problem is. The code at the bottom is not the issue either! It's only the #Include and #Using_animtree stuff that is causing issues...it's required in order for this to work! But for some reason it gives me a bad syntax!
Title: Re: Animated Barkin Doggos (Prefab help!)
Post by: gympie6 on April 20, 2018, 07:31:02 am
So i need help with this Prefab! Im using these dogs for scenery in my map.

I do everthing it says but i end up with a bad syntax error...and i removed everything that i did to make sure it was this prefab and surely enough the map worked fine when i removed all the barkin dog stuff...

GSC Code in the prefab:
Code Snippet
Plaintext
#include common_scripts\utility;
#include maps\_utility;
#include maps\_music;
#include maps\_anim;
#include animscripts\shared;
#include animscripts\utility;
#using_animtree( "dog" );
//////////////////
//in mapname.gsc
//maps\_zombiemode::main();
//thread maps\animated_dogs::setup_animated_barking_dogs();
///////////////////
//add to mod.csv
/*
xanim,german_shepherd_sleeping
xanim,german_shepherd_eating_loop
xanim,german_shepherd_attackidle_bark
xanim,german_shepherd_idle
*/
//

setup_animated_barking_dogs()
{
animated_barking_dogs = GetEntarray( "animated_barking_dogs", "targetname" );
array_thread( animated_barking_dogs, ::set_anim_playback_rate_dogs );
}
set_anim_playback_rate_dogs()
{
self useAnimTree( #animtree );
self endon("killanimscript");
self.animplaybackrate = 0.9 + randomfloat( 0.2 );
self.moveplaybackrate = 1;
self clearanim(%german_shepherd_attackidle_knob, 0.1);
while (1)
{
self attackidle_bark();
self animscripts\shared::DoNoteTracks("done");
}
}
attackidle_bark()
{
if( isdefined( self.script_noteworthy ) && self.script_noteworthy == "german_shepherd_idle" )
{
self setflaggedanimrestart( "dog_idle", %german_shepherd_idle, 1, 0.2, self.animplaybackrate );
}
if( isdefined( self.script_noteworthy ) && self.script_noteworthy == "german_shepherd_sleeping" )
{
self setflaggedanimrestart( "dog_idle", %german_shepherd_sleeping, 1, 0.2, self.animplaybackrate );
}
if( isdefined( self.script_noteworthy ) && self.script_noteworthy == "german_shepherd_eating_loop" )
{
self setflaggedanimrestart( "dog_idle", %german_shepherd_eating_loop, 1, 0.2, self.animplaybackrate );
}
if( isdefined( self.script_noteworthy ) && self.script_noteworthy == "german_shepherd_attackidle_bark" )
{
self setflaggedanimrestart( "dog_idle", %german_shepherd_attackidle_bark, 1, 0.2, self.animplaybackrate );
}
}

So i added #Include and the #Using anim tree to my Utilities tab in mymapname.gsc and when i added all this stuff i got a bad syntax error. I am not sure what the problem is. The code at the bottom is not the issue either! It's only the #Include and #Using_animtree stuff that is causing issues...it's required in order for this to work! But for some reason it gives me a bad syntax!

Have you tried running the map with developer 1?
Most of the time it tells you what is wrong.
If that is not going to help you plz send me the link to the tutorial and I will take a look for you. :)
Title: Re: Animated Barkin Doggos (Prefab help!)
Post by: BluntStuffy on April 20, 2018, 08:03:25 am
Quote
So i added #Include and the #Using anim tree to my Utilities tab in mymapname.gsc

Not sure what you mean with that, but the instuctions say all you should add in your mapname.gsc is this line:
Code Snippet
Plaintext
thread maps\animated_dogs::setup_animated_barking_dogs();

And add that right under the existing line:
Code Snippet
Plaintext
maps\_zombiemode::main();


That's all you should do for 'scripting'
Title: Re: Animated Barkin Doggos (Prefab help!)
Post by: Haaagaibmsirirla on April 20, 2018, 11:43:26 am
barking doggos lol
Title: Re: Animated Barkin Doggos (Prefab help!)
Post by: DeletedUser on April 20, 2018, 06:56:50 pm
Not sure what you mean with that, but the instuctions say all you should add in your mapname.gsc is this line:
Code Snippet
Plaintext
thread maps\animated_dogs::setup_animated_barking_dogs();

And add that right under the existing line:
Code Snippet
Plaintext
maps\_zombiemode::main();


That's all you should do for 'scripting'

OK SO I FOUND THE PROBLEM :D So apparently there was a typo...i apologize for wasting anyone's time on this.