UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Launching script models using PhysicsLaunch()

broken avatar :(
Created 10 years ago
by whippytrout
0 Members and 1 Guest are viewing this topic.
2,495 views
broken avatar :(
×
broken avatar :(
Location: usgeorgia
Date Registered: 24 April 2013
Last active: 3 years ago
Posts
560
Respect
Forum Rank
Zombie Enslaver
Primary Group
Mapper
×
whippytrout's Groups
Mapper Has released one or more maps to the UGX-Mods community.
whippytrout's Contact & Social LinksWhippyTroutWhippyTrout
Hey guys!

I'm trying to write a script that spawns script_models at a location and then launches them randomly. The models are smoke bombs by the way so I'm trying to make it look like they are being thrown. I can't seem to make the model spawn and I also can't get PhysicsLaunch() to make the model move. (it just drops to the ground like no force is being applied to it  :-[ ).

Here is the test script:
Code Snippet
Plaintext
launch()
{
level.gas_grenade_spawner = GetEnt("gas_grenade_spawner", "targetname");
trig = getEnt("fling_grenade", "targetname");
trig UseTriggerRequireLookAt();
trig SetCursorHint( "HINT_NOICON" );
trig waittill ("trigger");
trig delete();


players = get_players();
for( i = 0; i < players.size; i++ )
thread fling_grenade();

}


fling_grenade()
{
precacheModel("weapon_us_smoke_grenade_green_burnt");
grenade_launch = spawn("script_model",level.gas_grenade_spawner.origin + (10,0,10));
grenade_launch setmodel("weapon_us_smoke_grenade_green_burnt");
wait(2);
grenade_launch PhysicsLaunch( self.grenade_launch.origin, (0,100,100) );
}

Any help would be appreciated.

Thanks,
WhippyTrout
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 5 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
Signature
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
In order to spawn models they need to be prechached before load::main() is called, which is why most people do prechache calls before zombiemode::main() call since that's where it's called for zombiemode. Move your prechache call and it should help.
 
Also I'm on my phone but I remember there being more parameters to physicslaunch? But maybe their optional idk?

As a final note how do you know the effects of your physicslaunch if you can't get the model to spawn?
Marked as best answer by whippytrout 10 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
For the not spawning part I would check that this is defined:

Code Snippet
Plaintext
level.gas_grenade_spawner.origin 
If it isn't then maybe thats why it isn't spawning. If it is, I would do two things to your physics, change the origin, and increase the shit out of it.

Code Snippet
Plaintext
grenade_launch PhysicsLaunch( grenade_launch.origin, (randomintrange(-5000,5000),randomintrange(-5000,5000),5000) );

Also, I don't know where you are getting:
Code Snippet
Plaintext
self.grenade_launch.origin
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 5 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
Also, I don't know where you are getting:
Code Snippet
Plaintext
self.grenade_launch.origin
Nice catch! I didn't even notice that he went from grenade_launch to self.grenade_launch
broken avatar :(
×
broken avatar :(
Location: usgeorgia
Date Registered: 24 April 2013
Last active: 3 years ago
Posts
560
Respect
Forum Rank
Zombie Enslaver
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
×
whippytrout's Groups
Mapper Has released one or more maps to the UGX-Mods community.
whippytrout's Contact & Social LinksWhippyTroutWhippyTrout
Thanks guys it works now I don't know why i put self.  lol all is good now.  :D

 
Loading ...