Scripts / Silly LUA Questions

Author
Message
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 10th Jun 2015 07:08 Edited at: 10th Jun 2015 07:11
Hi everyone I'm quite new to LUA so I have decided to create a thread where I can commonly ask questions that I may be puzzled by with LUA scripting. So rather than filling up the forum with my basic questions, I've decided to lay them out here.

I have been able to successfully create a currency system, where the player can collect money and watch that money grow. Spend that money on things like information, health and access through gates and doors. I'm now curious how to do more complex things with more dynamic entities such as characters.

So to start off I have been referencing what scripts are already there in stock. Using the zombiewalk.lua script as it seems like the most basic. I can clearly see where the animations for attack are and things like that. But i can't seem to figure out where the zombie is told to load an animation cycle. Also why do the stock characters' FPE files have a list of "CSI" animations? What do those mean and how are they referenced?
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
HarryWever
3D Media Maker
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 10th Jun 2015 10:32
Quote: "Also why do the stock characters' FPE files have a list of "CSI" animations? What do those mean and how are they referenced?"

Yeah good question, i also saw that, and i really don't know what Csi stands for.

Harry
Harry
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Jun 2015 18:31
dont know what is stands for but those are the animations called with the AI/character specific commands (i guess it could stand for Character Specific Instructions?)
such as
SetCharacterToWalk(e)
SetCharacterToRun(e)
CharacterControlArmed(e)
CharacterControlUnarmed(e)
CharacterControlDucked(e)
CharacterControlStand(e)

there are seemingly more csi than commands right now but im sure eventually most (or all) will have a specific call

as for looking at a basic character script i really wouldnt recommend the zombie scripts, there is a lot of hardcoded stuff from the zombies (they attack without any prompt from a script for example) and the script itself isn't the best... much better to use a soldier AI script (they look more complicated but the basics are still there)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 10th Jun 2015 20:54 Edited at: 10th Jun 2015 21:42
Wow thank you smallg, I had some custom characters doing very odd behaviors when attempting to walk using "SetCharacterToWalk(e)". I now know that I should use the CSI walk field to include the animation frames for walking.

I'll take a look at the solider scripts instead as I'm having issues with stock zombies in general. There seems to be a bug preventing them attacking (inflicting damage). This has resulted in my custom characters not attacking when referencing the zombie script. (hoping this gets fixed in the next GG update).

I really like the set of the CSI animation calls in the FPE. I hope they become more standardized as its very straight forward to use a command like CharacterControlDucked(e) and then just use the CSI corresponding duck animation field to input the correct start and end frames. Its also interesting to see there are animation fields for swimming, climbing and sitting.



i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 13th Jun 2015 12:20 Edited at: 13th Jun 2015 12:24
So im wondering how do I get an entity to play from a variety of sounds?

PlaySound(e,0)
PlaySound(e,1)

Those seem to play soundset and soundset1 that are referenced in the FPE file but when I set PlaySound(e,2) it dosen't seem to play the soundset2 i have create in the FPE. How would I go about having a list of sounds to reference or should i be using a direct path to a sound file in the LUA? How would i go about that?

I like the concept of having my sound files listed in the FPE but if there is a better method, im all hears. I have read up a bit on LUA's handling of audio and got something like this:

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 13th Jun 2015 19:45
It look like there is not chance to use others than these set up via properties panel or fpe file.

You are right it should be handle in the way you said above, otherwise we are limited to use those 2 slots only.

It should be handled just via script and/or fpe listed.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 8.1 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 14th Jun 2015 02:00 Edited at: 14th Jun 2015 02:01
Teabone

Omega Core has a sound library that allows you to play sounds from a pre-defined list in script.

Here's an example I snipped from my sfx.lua. I pre-define and call my sfx by the index with a stop/start flag. Obviously you can't just plug this in either



And yes, something like this should be standard. Having to tie sound to entities might be OK for most scenarios but if you want it tied to an event... Ugghhhh....
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 14th Jun 2015 03:36 Edited at: 16th Jun 2015 22:56
Also if you have 20 different variants of the same character you want to have different sound effects tied to... you'd have to make 20 different LUA scripts for each rather than just ONE and 20 fpe scripts. So really it becomes 40 files (LUA/FPE)....

By the way months ago I was able to play an audio file via path in LUA but I completely forgot what the code was at the time. I'm almost positive there was once a way?

I guess i could make use the character soundset system with the "OnAlert" and etc... but i dont know thats a bit strange for objects that are not characters.
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 18th Jun 2015 05:43 Edited at: 18th Jun 2015 05:44
I noticed these two lines in a couple FPE files with some of the buildings. What do they do? Are they related to the LOD staging system?

forcesimpleobstacle = 3

and

disablebatch = 1
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 18th Jun 2015 10:48
Forcesimpleobstacle allows the AI to walk in the building (or on flat objects etc)

Not sure about the other 1
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 18th Jun 2015 12:21
disablebatch = 1, belong to lod system.

Quote: "I guess i could make use the character soundset system with the "OnAlert" and etc... but i dont know thats a bit strange for objects that are not characters."

Yes. I had tried it converting a house like a soldier just for try, and yes, it looks a bit strange, but it do the trick.
;identity details
ischaracter = 1

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 8.1 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 19th Jun 2015 04:23
I noticed Forcesimpleobstacle=3 is used a lot. What do other values do? I'm assuming by default its set to zero?
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 21st Jun 2015 02:07
When you use the Destroy command does it than attempt to open aidestroy script, if present in the FPE?
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 21st Jun 2015 18:12
no those arent used anymore, it will run then exit(e) part though (which is the new version of ai_destroy)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 23rd Jun 2015 00:42
Thanks , I'm going to clean up all my FPE files so they don't have a destory script written out. Is this the same case with ai appear?
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 23rd Jun 2015 11:05
Yes, init(e) is the replacement for aiappear
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11

Login to post a reply

Server time is: 2024-05-03 07:28:33
Your offset time is: 2024-05-03 07:28:33