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

I need help spawning different zombie variants

broken avatar :(
Created 10 years ago
by whippytrout
0 Members and 1 Guest are viewing this topic.
3,277 views
broken avatar :(
×
broken avatar :(
Location: usgeorgia
Date Registered: 24 April 2013
Last active: 8 months ago
Posts
560
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Mapper
×
whippytrout's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
whippytrout's Contact & Social LinksWhippyTroutWhippyTrout
Hey guys I need a little help with something. I have two zombie models from black ops that work great but I want the player to be able to choose in-game which zombie model will spawn. I created two triggers in my map, each one activates the zombie rounds start, but  I also want it to select the zombies model itself. For example if i choose trigger_1 then round 1 will start and moon zombies will spawn and start attacking. On the other hand if I choose trigger_2 then the round will start but hazmat zombies will spawn. It will be up to the player which kind of zombies will spawn. As of now the zombie models are being randomly set in my char_ger_honorguard_zombies.gsc. Any help would be appreciated.
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
Well, instead of checking for a random number, check for a level variable that you set according to which trigger the player used.

- Phil.
broken avatar :(
×
broken avatar :(
Location: usgeorgia
Date Registered: 24 April 2013
Last active: 8 months ago
Posts
560
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
×
whippytrout's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
whippytrout's Contact & Social LinksWhippyTroutWhippyTrout
I know that's the part I'm having trouble figuring out. I have a trig in place but I dont know how to setup the script. Right now I have a simple line that chooses a random int and spawns random zombies but I want to be able to choose what zombie model is going to be used by using a trigger in game. How would I set up a loop or statement to achieve this goal? Here is a look at what I have:
       
Code Snippet
Plaintext
 self.num_bodies = 10;
self.bodie = randomint(self.num_bodies);   // I was thinking I can change this to something but IDK
if(self.bodie == 0)
{
self setModel("bo2_c_zom_dlc0_zom_sol_body1");
self.headModel = "bo2_c_zom_dlc0_zom_head3";
self attach("bo2_c_zom_dlc0_zom_head3", "", true);
         }
if(self.bodie == 1)
{
self setModel("bo2_c_zom_dlc0_zom_solciv_body1");
self.headModel = "bo2_c_zom_dlc0_zom_head4";
self attach("bo2_c_zom_dlc0_zom_head4", "", true);
}
..... so on and so on
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
As I've already said
check for a level variable that you set according to which trigger the player used
That's all you need to do.
In your trigger, set something like
Code Snippet
Plaintext
// Obviously a different number for every trigger
level.zombie_variant = 4;
And in your character file, just check for that variable set by the trigger.

- Phil.
broken avatar :(
×
broken avatar :(
Location: usgeorgia
Date Registered: 24 April 2013
Last active: 8 months ago
Posts
560
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
×
whippytrout's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
whippytrout's Contact & Social LinksWhippyTroutWhippyTrout
I'm not sure if this is correct but I made my triggers with KVP's of:
Code Snippet
Plaintext
targetname: hazmat_trig
zombie_variant: 1
and
Code Snippet
Plaintext
targetname: prisoner_trig
zombie_variant: 2
then in my character gsc I have
Code Snippet
Plaintext
main()
{

trig = getEnt("hazmat_trig", "targetname");
trig2 = getEnt("prisoner_trig", "targetname");

trig UseTriggerRequireLookAt();
trig sethintstring("Press F to Pickup Orb");
trig waittill ("trigger");
trig delete();

                trig2 UseTriggerRequireLookAt();
trig2 sethintstring("Press F to activate block");
trig2 waittill ("trigger");
trig2 delete();

if(level.zombie_variant == 1)
{
self setModel("bo1_c_zom_cosmo_scientist_body");
self attach("bo1_c_zom_cosmo_scientist_head2", "", true);
}

if(level.zombie_variant == 2)
{
self setModel("bo2_c_zom_inmate_body2");
self attach("bo2_c_zom_zombie_hellcatraz_head", "", true);
}

self.voice = "german";

}

Now the weird thing is that when I activate the trigger the game starts lagging every 5 seconds like its running an infinte loop or something, zombies dont spawn and I get bones errors if I use the second trigger. But the zombie variants worked before. I also need to mention that I dont know have the start round trigger in the game get due to I dont know how to link the start rounds trigger to each of these triggers so that it selects the zombie model then starts the round. If I can do that then it might fix it if I'm even doing this right. But that trigger is in _zombiemode and looks like this:
Code Snippet
Plaintext
round_start()
{
activate_trig = getent ("start_rounds", "targetname");
activate_trig waittill ("trigger");
.....ect
}
Last Edit: February 04, 2014, 01:58:22 am by whippytrout
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Code Snippet
Plaintext
main()
{
   
    trig = getEnt("hazmat_trig", "targetname");
    trig2 = getEnt("prisoner_trig", "targetname");

        trig UseTriggerRequireLookAt();
        trig sethintstring("Press F to Pickup Orb");
        trig waittill ("trigger");
        trig delete();

                trig2 UseTriggerRequireLookAt();
        trig2 sethintstring("Press F to activate block");
        trig2 waittill ("trigger");
        trig2 delete();

// the following are the spawners - each one needs to be seperate for this to work, or apart of an array if there are alot of them
// also, i think it would be better to specify each variant with a switch/case statement than an if statement for the same reasons

level.zombie_variant_1 = getEntarray("zombie_variant_1", "targetname");
level.zombie_variant_2 = getEntarray("zombie_variant_2", "targetname");
       
        if(isdefined(level.zombie_variant_1) )
        {
            self setModel("bo1_c_zom_cosmo_scientist_body");
            self attach("bo1_c_zom_cosmo_scientist_head2", "", true);
        }
       
        if(isdefined(level.zombie_variant_2) )
        {
            self setModel("bo2_c_zom_inmate_body2");
            self attach("bo2_c_zom_zombie_hellcatraz_head", "", true);
        }
   
    // self.voice = "german"; an actors voice is declared by their spawner type(Aly/Axis)
   
}

Don't know if it works or not, worth a try i suppose.
Last Edit: February 04, 2014, 02:49:00 am by daedra descent
Marked as best answer by whippytrout 10 years ago
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
I'm not sure if this is correct but I made my triggers with KVP's of:
No, I haven't said you should put a KVP anywhere. Do not, I repeat, NOT do any trigger code in your character file.
Why? Because this is what you just did: Your code waits until both triggers are hit. Then deletes them. This runs everytime a zombie tries to spawn. You see the problem?
In your character code, you only check for the level variable.
In your trigger code, you set it. That's it.
If you want your trigger to start the round too, just wait on a level notify in round_start(),
Code Snippet
Plaintext
level waittill("start_rounds");
and notify it when one of your character triggers is hit.
Code Snippet
Plaintext
level notify("start_rounds");

- Phil.
broken avatar :(
×
broken avatar :(
Location: usgeorgia
Date Registered: 24 April 2013
Last active: 8 months ago
Posts
560
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
×
whippytrout's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
whippytrout's Contact & Social LinksWhippyTroutWhippyTrout
Thanks that makes sense. I have been trial and error testing this for about an hour and one trigger works great, it starts the rounds and spawns the right zombie but the other one dont even work. It just displays a hand and nothing happens if you click it. Here is my code maybe you can see what I'm doing wrong:

Code Snippet
Plaintext
start_zombies()
{

trig = getEnt("hazmat_trig", "targetname");
trig2 = getEnt("cell_trig", "targetname");
level.zombie_variant = 0;

if(isdefined(trig))
  {
trig SetCursorHint("HINT_NOICON");
      trig SetHintString("Press & Hold &&1 to Pickup Orb");
      while(1)
      {
trig waittill("trigger", user);
        if( is_player_valid(user))
        {
user playsound( "cha_ching" );
    level.zombie_variant = 1;
level notify("start_rounds");
    trig delete();
trig2 delete();
}
  }
  }

 
if(isdefined(trig2))
  {
trig2 SetCursorHint("HINT_NOICON");
      trig2 SetHintString("Press & Hold &&1 to Read Book");
      while(1)
      {
trig2 waittill("trigger", user);
        if( is_player_valid(user))
        {
user playsound( "cha_ching" );
    level.zombie_variant = 2;
level notify("start_rounds");
    trig delete();
trig2 delete();
}
  }
  }
 
}
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
maybe because theres any statemente refering to trig2 except for the delete part lol
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
You have one function running. It checks and waits for the first trigger to be pressed. Then deletes both. Then it checks if the second trigger is still there... You see?
You need two threaded functions, one for every trigger.

- Phil.
broken avatar :(
×
broken avatar :(
Location: usgeorgia
Date Registered: 24 April 2013
Last active: 8 months ago
Posts
560
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
×
whippytrout's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
whippytrout's Contact & Social LinksWhippyTroutWhippyTrout
Thanks YaPh1l I got it working now. You sure know your stuff, you helped me out and I learned something at the same time. I appreciate your help.

 
Loading ...