Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: whippytrout on February 03, 2014, 01:20:44 am
Title: I need help spawning different zombie variants
Post by: whippytrout on February 03, 2014, 01:20:44 am
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.
Title: Re: I need help spawning different zombie variants
Post by: YaPh1l on February 03, 2014, 10:02:57 am
Well, instead of checking for a random number, check for a level variable that you set according to which trigger the player used.
- Phil.
Title: Re: I need help spawning different zombie variants
Post by: whippytrout on February 04, 2014, 12:37:56 am
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:
Title: Re: I need help spawning different zombie variants
Post by: YaPh1l on February 04, 2014, 12:55:17 am
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 And in your character file, just check for that variable set by the trigger.
- Phil.
Title: Re: I need help spawning different zombie variants
Post by: whippytrout on February 04, 2014, 01:51:27 am
I'm not sure if this is correct but I made my triggers with KVP's of: and then in my character gsc I have
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:
Title: Re: I need help spawning different zombie variants
Post by: daedra descent on February 04, 2014, 02:44:25 am
Don't know if it works or not, worth a try i suppose.
Title: Re: I need help spawning different zombie variants
Post by: YaPh1l on February 04, 2014, 09:19:10 am
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(), and notify it when one of your character triggers is hit.
- Phil.
Title: Re: I need help spawning different zombie variants
Post by: whippytrout on February 05, 2014, 12:16:19 am
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:
Title: Re: I need help spawning different zombie variants
Post by: jjbradman on February 05, 2014, 04:33:51 am
maybe because theres any statemente refering to trig2 except for the delete part lol
Title: Re: I need help spawning different zombie variants
Post by: YaPh1l on February 05, 2014, 09:23:52 am
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.
Title: Re: I need help spawning different zombie variants
Post by: whippytrout on February 05, 2014, 03:45:37 pm
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.