Scripts / Need Help for a Script which loops Repeated Motions for NPC Characters

Author
Message
Dweller
17
Years of Service
User Offline
Joined: 10th May 2006
Playing:
Posted: 7th Nov 2016 03:12
I have been modifying scripts provided by Old Larry and Smallg, posted in 2005. These have been very useful. What I also need is a master loop.lua script that will allow background characters to do various repeated single motions. The idea is to plug in different animation coordinates as needed to create a variety of single purpose scripts. So far I have created a script where I am standing next to a character - they gesture (waiving hands around) for a very short time and I then walk backwards and the character gestures for a very short time again. I would like to see both situations looped. or set it up so the actions last longer. If I can get a script for this established I should be able to plug-in other actions. What I would really like is a simple continuous loop . I have worked on this for a while and I am stuck. The whole looping scipt thing has me baffled.

Need your typical market place type stuff:
idle conversation between two characters
characters just wandering around
someone chopping wood or lifting items

Any help would be great. I have a feeling there is something like this out there but I just can't find it. If I am able to create it, I will post it.

This is my first post - so please be easy on me.

PM
3com
9
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 7th Nov 2016 19:44
Quote: "idle conversation between two characters"

I'm sure smallg has something about, in their sticky thread.

Quote: "characters just wandering around"

Here waypoints might help. plus some sort of neutral.lua script.

Quote: "someone chopping wood or lifting items"

Here you need the animated character previously, to carry out such action, in your case cutting wood. With this would suffice, you would only have to configure the fpe file; "playanimineditor = 1"

Quote: "I have been modifying scripts provided by Old Larry and Smallg"

Here, clarify what script are you referring to, might help.

3com






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

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

PM
Dweller
17
Years of Service
User Offline
Joined: 10th May 2006
Playing:
Posted: 8th Nov 2016 01:15
I realized after reading 3com's post that I need to refine my goals. I want to fulfill two main conditions, of which do not require waypoints.

Condition #1: NPC does a repetitive task until terminated by the player.
Condition #2: NPC does a repetitive task until approached by player, where the NPC either runs away (wildlife script) or attacks (charge script, or similar).

Let me dissect the script I'm using so far. I have been attempting to do a continuous "GEN_idle_conversation" that is why that code is repeated. So I get a short conversation near and away from NPC.

https://forum.game-guru.com/thread/213322 ------ Where I got it.
-- The AI Talking -------------------------------------------- New Description.
local PlayerDist_near = 100; --------- Condition location.
local PlayerDist_far = 150; --------- Condition location.
local sat = {} --------- Current player position?
local talk_duration = 4000 ---------- I have changed this and it does not seem to do anything.

function ai_talk_init(e)
sat[e] = 1 ----------------------- (sat) here, seams to reference the first line of active code.
SetCharacterSoundSet(e)
end

function ai_talk_main(e)
PlayerDist = GetPlayerDistance(e) -------------- Tells the program where player is in relation to NPC.
if sat[e] == 1 and g_Entity[e]['animating'] == 0 then
StartTimer(e)
SetAnimationFrames(3110,3420) ------------- Animation code which is imbedded in the character .fpe file.
PlayAnimation(e) ------------ Plays animation listed above, of course.
-------------------------- If I add: "loopanimation" or "playanimineditor =1", here or after the animation below - it does nothing.
sat[e] = 2
elseif sat[e] == 2 then
if GetTimer(e) > talk_duration then
SetAnimationFrames(3110,3420)
PlayAnimation(e)
g_Entity[e]['animating'] = 1
sat[e] = 2

end
end

if PlayerDist < PlayerDist_near and sat[e] == 2 then ----- This condition happens when player walks away.
LookAtPlayer(e);
PlaySound(e,8000,500);
SetAnimationFrames(3110,3420)
PlayAnimation(e)
g_Entity[e]['animating'] = 1
sat[e] = 3
elseif PlayerDist > PlayerDist_far and sat[e] == 3 then ---- Does this reference players current location?
SetAnimationFrames(3110,3420)
PlayAnimation(e)
g_Entity[e]['animating'] = 1
sat[e] = 1

end
end

I understand that there is a connection between the script .lua and the .fpe file. I know "playanimineditor =1" is crucial to the process, but I don't really know how to set it up in the .fpe file.
PM

Login to post a reply

Server time is: 2024-04-30 19:47:40
Your offset time is: 2024-04-30 19:47:40