Jump to content

Need one or two .lua scripts


Michael Betke
 Share

Recommended Posts

I need a guy who is willing to help me out with some basic sripting stuff for my non-game releated projects.

Maybe it's not that difficult but I can do content only. :-7

Here's what I need:

 

I have an animated animal.

It has two animations: idle / walk

It is supposed to wander around in a level. Just along an AI spline. No interaction with the player needed.

 

My goal is to have several animals walking in a group along these splines.

 

So this is what I need:

 

Firstly a .lua script that makes my animal walking around.

Secondly a dialog in the properties menu for the animal which lets me check "Use walk anim" or "Use idle anim". Two checkboxes would be logically in my opinion.

 

That's it.

I will rename this script for using with other animals. They have the same setup.

 

 

I tried to adopt a crawler script but my animal walks through the terrain and does other strange stuff...I'm really untalented on such coding/scripting stuff. ;)

Pure3d Visualizations Germany - digital essences

AAA 3D Model Shop specialized on nature and environments

Link to comment
Share on other sites

You can add me on MSN messenger, jamesbond92393 [at] aol.com

 

I can help you out.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

My point was, that you can't create a script to have that cow follow waypoints, because the animation, over its 2500 frames, leads to cow to move around a 5 - 10 meter space. So no matter what, your cow will never be aligned to the movement of its character controller.

 

You obviously don't understand that I was saying that your animation cycle is way too complex. You need a simple animation for the cow that has its legs or whatever move, but doesn't lead the cow to actually move 2-5 meters AWAY from its origin after 15 seconds.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

In which case you wouldn't need any Lua setup other than looping the animation.

 

Following AI Nodes and a Spline path is different from running an animation to give the illusion of the animal wondering around.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

Well if you derive the movement from the animation then it ceases to be an illusion :) But it's a lot less flexible than making the motion in game. Were there no decent points in the animation that could have been used as a walk cycle?

Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX

ZBrush - Blender

Link to comment
Share on other sites

No, every single frame containing leg motion involved movement from the model's origin.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

That's fine, I'm using non-normalized animations now and driving the movement based on the movement off the origin of the animation. As long as the there is a frame sequence that matches up the relative positions of the legs/body/tail/etc then I can fix up my animation code and pass it to him. Most raw motion capture data is not normalized so I figured it would be easier to do it in code than to manually normalize the whole thing. Although w/ blender's IPO curves it would be pretty easy to zero out the root bone motion I suppose.

Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX

ZBrush - Blender

Link to comment
Share on other sites

You obviously don't understand that I was saying that your animation cycle is way too complex. You need a simple animation for the cow that has its legs or whatever move, but doesn't lead the cow to actually move 2-5 meters AWAY from its origin after 15 seconds.

 

Sorry missed the thread for some reasons...

 

I totally understand what you mean and it was a misunderstanding with the freelancer I hired.

However it's not a big problem because I can still use the models without walking along the spline.

 

Most of them will idle and stand still. A few can walk slowly in their cycle. I aggree it's not that nice as I intended in the first time but it won#t change the fact that I need a .lua containing the following stuff.

 

- ability to choose (1,2,3 or a checkbox, slider, whatever) the animation for the specific selected model in properties menu.

- choosing at which frame the animation start (or setting up a random start frame automatic). Otherwise all animals will start at frame "1" makeing them looking odd.

 

This is really important for me and has nothing to do with the splines. This woukd be needed for the next animals eventually.

Pure3d Visualizations Germany - digital essences

AAA 3D Model Shop specialized on nature and environments

Link to comment
Share on other sites

I can definitely do that for you then :)

 

Just chat with me on MSN again, and I can set up your script to have the properties grid and proper settings for the animation. :)

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

It doesn't really matter if the mesh translates during the animation, as you can translate it back to the mesh, and move the body instead. This can be done with a very simple function which calculates the bone movement and converts it into mesh counter-movement.

 

Actually an animation which translates the mesh is even more useful, as not all movements are linear in speed, so you have more information in them as with a animation which keeps the mesh in the same spot.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

I tried myself and rewrote a script I found using the famous try and error method.

 

I can rotate my animals now and set frames I want to play. Now I could use the rest of the stuff. :)

 

--Include the base script for all classes
dofile("Scripts/base.lua")



function Spawn(model)
local entity=base_Spawn(model)



function entity:Update()

	local frame=AppTime()*0.02
	frame=math.mod(frame,0-500)

	if EntityCulled(model,fw.main.camera)==0 then
		self.model:Animate(frame,1,0,1)
	end
end


end

--Update function, called during every UpdateWorld()
function Update(world)
if world==world_main then
	local model,entity
	for model,entity in pairs(entitytable) do
		if model.world==world then
			entity:Update()
		end
	end
 end
end


Pure3d Visualizations Germany - digital essences

AAA 3D Model Shop specialized on nature and environments

Link to comment
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.

 Share

×
×
  • Create New...