Jump to content
Aprch

Shouting mechanics - dialogue variations. How do they work?

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.

 

Cheers!

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:

http://theindiestone.com/forums/index.php/topic/39-player-taunts/

 

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...