Shouting mechanics - dialogue variations. How do they work?
1 1

4 posts in this topic

Recommended Posts

Hello everyone. I'm new around here! I started fiddling around with LUA recently. While I don't know much of specific programming languages, I do know how they work... somewhat.


So my question here is this, I was hoping you'd point me out in the right direction.

Take for example the Your first PZ LUA script mod guide function:

function sayGoodbye()    getPlayer():Say("Hasta la vista zombie!");end

What I wanted to do here basically was to add more than one option of dialogue for everytime the function would execute, so I made an array with the different options, and told the function to call a random number from the array.


Some experimenting led me to this:

function sayGoodbye ()	local arraySpeech = {"aaa", "bbb", "ccc"}	getPlayer () :Say (arraySpeech[math.random(#arraySpeech )]);

It didn't worked.

I'm not -entirely- familiar with LUA yet so maybe I'm missing something here, so that's why I wanted to ask about the shouting mechanics.

How is it exactly that the event gets more than one dialogue variation when it's triggered? And if I wanted to change what they say, where exactly is that located? I would have learned it from the shouting code itself but I can't seem to find it. I don't really know where to look though.

Oh well, I hope I wasn't being too confusing with this, sometimes it can get tricky to explain this kind of stuff when english is not your first language :P so yeah, thanks in advance.



Share this post

Link to post
Share on other sites

Shouting is hardcoded in Java atm (can't remember the class though).


You can take a look at the code of my player taunts mod:


Just a random guess, but try:

function sayGoodbye ()    local arraySpeech = {"aaa", "bbb", "ccc"}    getPlayer () :Say (arraySpeech[ZombRand(#arraySpeech )]);end

Share this post

Link to post
Share on other sites

Yes, that did the trick. Thanks a lot!

I'll definitely check your mod out, lots of useful stuff I can learn from that for sure. :geek:



Edit: I'm not entirely sure, but apparently it only displays 2 of the 3 alternatives... might be an extremely random case, but perhaps it is something else?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1 1