Scripts / Animation script error and some comments on DOC :D

Author
Message
Razeta
8
Years of Service
User Offline
Joined: 4th Jun 2015
Location:
Posted: 6th Jun 2015 05:50
Hello,

I just bought GameGuru.

I am excited by the fact that is easy to create games, but scripting is kinda a headache.

So I been looking at the DOC and the functions description are good, +1 yeay, but the core documentation and examples are nowhere to be found. I belive that the most important thing for this is to have a good API documentation, like UNITY or CONSTRUCT 2.

So I been trying to animate a PACK character, mainly the DEATH VALLEY DESSERT GUNNER (DEFENDER).

I added the script and I have literaly tryed every combination possible and I dont get it yet how animation system works in GameGuru. In examples from posts and other sources, its pretty straight foward, minus the several changes trough out the years. But for me it works and then it dosnt works.

I have already invested 8 hours trying to animate just one character and no luck yet.

So, my idea is for example, execute the animation onces and then stop it. There is no dead or ragdoll function yet, so I read on a post that the best way to start map with dead bodys all over the place is animating them to the dead animation. So thats what I am trying to do.

here is what I got so far. Sorry for comments, but I been looking everywhere for an answer. What I am missing? Thanks.

By the way, sorry for my bad english.


PM
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 6th Jun 2015 06:14 Edited at: 6th Jun 2015 06:15
Did you try any of the several included scripts in GameGuru?

eg: ai_soldier, ai_soldier_rpg_guard

I forgot to mention, last I heard a lot of new work is being done on the AI scripts so now is a good time to tinker with a lot of the other stuff.
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
Northern
13
Years of Service
User Offline
Joined: 5th Nov 2010
Location: Brazil
Posted: 6th Jun 2015 07:07
@Razeta:

Hi,

If you are new with Lua Scripts programming in GameGuru, sorry to say, you are going to have a lot of headache if you try to make any customized animation.

Why?

Because the coding for animations using Lua Script in GameGuru is very confusing and hard still, I mean, it's not an easy stuff and besides the lack of good documentation explaining with details, what all that functions are for, and how to use them properly, become even more difficult the learning process.

It's all by the trial-and-error method.

At this time, until people who are comfortable with Lua programming might have several difficulties trying animate customer characters correctly.

I advise you to utilize the stock characters available, until you are more used to Lua Scripts, after that try to do small changes or modifications in the existing script of the stock characters, and check out the results. All stock characters already have included ragdoll animation by default as well.

Remember that, before make any changes in script files, you should, firstly, back up the original files a save them in a safety place. You should always work with backed-up copies, and never with the primary files.

I hope this might help.

Cheers,
Northern


PM
Razeta
8
Years of Service
User Offline
Joined: 4th Jun 2015
Location:
Posted: 6th Jun 2015 07:49
Hello,

thanks for the reply.

I am using a stock character, I think, well I download it from the store. I belive if I am not wrong that those can be animated by script just like in the code I post?

Thats is what I am going for.

Thaks for the quick replay btw.

xD


PM
Razeta
8
Years of Service
User Offline
Joined: 4th Jun 2015
Location:
Posted: 6th Jun 2015 07:52
Hello,

Can some one put a scrip for a simple animation, so I can see what I am missing?

Thanks.

PM
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 6th Jun 2015 08:43
Razeta

As I stated earlier, you have several AI scripts to look at in the default folder, any of which can be applied.

As Northern states, (apart from any stuff that is being further developed and polished), you also need to be familiar with LUA.

It's almost impossible to simply look at as script and determine what is wrong without you explaining in detail what you want to do. Custom script requires custom skills. That's the reality of it.

That is why there are multiple scripts available. Try them, make minor changes from backups and watch what happens to learn the process. One step at a time.

I trust this explains things a little.
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
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Jun 2015 14:44 Edited at: 6th Jun 2015 15:24
edit, ok sorry i see him, you can use this for an example of how to control stock characters

and for the dead bodies you can simply use
SetEntityHealth(e,0)
inside the main script you give them
oh and set them always active so they wont get cleaned up by the engine for being dead

if you want to be extra specific about animations you would need to use this (i see you already had the basics there in your code - maybe just not quite in the correct order)

just replace the #'s with the frame numbers
life\'s one big game

windows vista ultimate

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

Attachments

Login to view attachments
Razeta
8
Years of Service
User Offline
Joined: 4th Jun 2015
Location:
Posted: 6th Jun 2015 17:50
Thanks guy!

I SEEEEE THE LIGHT NOW!


When I use the SetEntityHealth(e,0) on the stock character it gets deformed LOL..... it gets messed up bad

What can it be?

Attachments

Login to view attachments
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Jun 2015 18:19 Edited at: 6th Jun 2015 18:37
that's a ragdoll issue, strangely i didnt seem to get it when i tested, you'll have to use the specific death animation yourself i guess

mine just look like they're praying when i use SetEntityHealth(e,0)

this is the script you want for the death valley characters
ai_dead_bodies.lua
life\'s one big game

windows vista ultimate

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

Attachments

Login to view attachments
Razeta
8
Years of Service
User Offline
Joined: 4th Jun 2015
Location:
Posted: 6th Jun 2015 19:19
WORKED GREAT! THANKS!
PM
HarryWever
3D Media Maker
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 6th Jun 2015 21:21
that is cool, thanks Smallg

Harry
Harry
PM
CRGSOS
11
Years of Service
User Offline
Joined: 27th Dec 2012
Location: Southend on Sea UK
Posted: 24th Jun 2015 19:18
STARTING LUA SCRIPTING FOR GAMEGURU
In GameGuru, Lua has been chosen as the entity-controlling script or language. This is an introduction for those who would like to try it. As a novice I find the official documentation fairly impenetrable and suggest a better approach is via experimentation with the scripts already provided in the GameGuru Files/Scriptbank and looking at the two documents in the GameGuru Documents and Files folders respectively: “Scripting With LUA.pdf” with rules and vocabulary for the Lua language and “global.lua” which gives a functions list for GameGuru use. (These are usefully identified by g_ . ) Both documents are being developed still.

First, Lua scripts can be written in a plain text program like Notepad although I prefer the free "LuaEdit 2010" (see the web).
Secondly, the scripts save in the GameGuru Files/Scriptbank folder. Take care not to save and overwrite existing scripts (by giving your scripts new names)!

1) To control a model or entity you need three basic things:
a) A model in .x format (along with any textures it needs) in the Entity folder.
b) A .fpe instruction file also in the Entity folder with same name as the model’s .x file.
This file includes, near the end, the frame numbers for the model’s animation as well as texture instructions, sound instructions and so on. Such files can be looked at and edited in Notepad. Take care not to save and overwrite existing files!
c) A Lua script (which is named in the .fpe instruction file.) This uses a combination of commands etc. from the basic language and functions found for example in the global.lua file specially set up for GameGuru.

2) The design of a script includes an introductory function and a main function, each rounded off with end:
e.g.
function NAME OF FUNCTION_init(e)
--This introductory function also includes the list of local variables etc.
end

PLUS

function NAME OF FUNCTION _main(e)
- -This is the active function
end
Here the letter (e) is used to indicate the entity or model being operated. Note that remarks or notes can be written after two hyphens or dashes as here (Remark blocks use --[[ and ]]--).

3) Essentially a script uses groups of
conditions (such as if … with each condition having an end to round it off) and
instructions (such as PlayAnimation(e,1) to animate the model,
e.g.
If g_InKey == “1” then
PlayAnimation(e,1)
End

Here g_InKey takes a keyboard input (as a string, hence the speech marks) and PlayAnimation(…) animates the relevant part of the model’s inbuilt actions, e indicating the model, and the number 1 gives the animation required, as listed in the model’s .fpe file (mentioned above). Note that the commands here have capital letters for each component word.

4) To test this set of model, .fpe file and script, place your model in GameGuru and run. It may come up with error messages (often quite helpful) or it may run successfully. If nothing happens, check that the model has got the Lua script correctly attributed to it by clicking on its properties in GameGuru and checking the lefthand panel details. You can correct that in the properties panel here (but the effect will only last until you shut GameGuru) or change it in the .fpe file.

5) Here is a simple script to open and close each door of a several section cupboard:

* * *

function cupboard_init(e) --records the Lua script below for this model or entity (e)
varnp = 0 --declare local variable to record keyboard input below
end

function cupboard_main(e)
PlayerDist = GetPlayerDistance(e) --(e) is the Entity
if PlayerDist < 200 and g_PlayerHealth > 0 then
GetEntityPlayerVisibility(e) -- when player comes close
if 1 then
PromptTextSize(3) --allows text size to be changed 1-5
Prompt("To open: use keys 1-6") --tell player what to do
varnp = g_InKey --varnp records the key chosen

if varnp > "0" then --take the key used to choose an animation
SetAnimation(varnp) -- the chosen animation equals the inkey
PlayAnimation(e) -- here this opens/shuts the relevant door
end -- closes the inkey variable subroutine

end --closes the prompt subroutine
end -- closes the player distance check subroutine

end --closes the whole MAIN routine
* * *
Note that this script could work with any model or entity with animations 1 to 9 that can be identified by the numbers on the keyboard. However be aware that numbers in this simple routine could clash with weapons set up etc. in a game so it is only a practice example really.

CRGSOS
PM
HarryWever
3D Media Maker
14
Years of Service
User Offline
Joined: 14th Jan 2010
Location: below Sea level
Posted: 25th Jun 2015 09:01
thanks CRGSOS,
Now i hopefully also can learn a bit of lua.


harry
Harry
PM

Login to post a reply

Server time is: 2024-05-08 09:47:06
Your offset time is: 2024-05-08 09:47:06