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

Spawning weapons

broken avatar :(
Created 11 years ago
by Soy-Yo
0 Members and 1 Guest are viewing this topic.
2,243 views
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 5 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
Signature
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
I'm making a script that spawns random weapons in random rooms when the round finishes.
This is what I have:
Code Snippet
Plaintext
    for( i = 0; i < cubes.size; i++ ) {
       
        // here I get the origin (org); everything ok
       
        model = spawn( "script_model",org );
        model.angles = (0,0,0);
        model.targetname = "round_break_weapon_reward";
       
        model.weap = weapons[i];
        weaponname = getWeaponModel( weapons[i] );
        model setModel( "tag_origin" );
        model = playFxOnTag( level._effect[ "powerup_on" ], model, "tag_origin" );
        model setModel( weaponname );
        model thread rotateGun();
        model thread weaponGetWait( cubes[i] );
        iprintlnbold(weaponname);
    }
"cubes" is an array with the number of the cubes where weapons will spawn. "weapons" is an array with the same size as "cubes" with the name of the weapons I'm spawning.
The problem here is that it creates the model and puts the powerup fx but the weapon model doesn't appear. Also, "rotateGun()" and "weaponGetWait()" are never called and the print is called sometimes. I mean, if I print i, it is printed 7 times (the size of "cubes"). If I print weaponname (as now), it prints three weapons (maybe the other four are undefined). And if I print some text, it's printed only once.

I took part of it from ZMBS DON GOONY's weapon powerup, but I must be doing something wrong. :-\

Thanks for any idea.
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
use this tutorial it shows script that spawns in a weapon similar to manually placing one in radiant by right clicking and placing weapon, this method will automatically spawn in the trigger and the weapon model.

http://ugx-mods.com/forum/index.php/topic,4974.0.html
Marked as best answer by Soy-Yo 11 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 30 December 2012
Last active: 2 years ago
Posts
577
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
My preferred name is "xSanchez78".
Check me out here: www.steamcommunity.com/id/xSanchez78
×
alaurenc9's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
alaurenc9's Contact & Social LinksxSanchez78xSanchez78xSanchez78xSanchez78xSanchez78xSanchez78
 model = playFxOnTag( level._effect[ "powerup_on" ], model, "tag_origin" );

u re-defined 'model' as an fx id so nothing underneath that works on the model anymore.
take out 'model = ' and leave just 'playFxOnTag( level._effect[ "powerup_on" ], model, "tag_origin" );'
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 5 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
model = playFxOnTag( level._effect[ "powerup_on" ], model, "tag_origin" );

u re-defined 'model' as an fx id so nothing underneath that works on the model anymore.
take out 'model = ' and leave just 'playFxOnTag( level._effect[ "powerup_on" ], model, "tag_origin" );'
Ops. I've just realised that lol. :-[ I don't know why I made that. :derp:
I always make stupid mistakes and can't realise where they are.
Last Edit: October 31, 2015, 09:54:40 pm by Soy-Yo

 
Loading ...