Jump to content

Form lists and animation questions.


Jojash

Recommended Posts

Sorry, I didn't want to omit too much! I probably should have left out a few lines... :biggrin:

 

I think I've been too vague on what I'm trying to accomplish. Unfortunately verbalization has never been a strong point of mine.

 

The overall goal is to allow the player to "possess" an NPC. So they can move them around, make them fight, etc, as if they were doing it all themselves, but instead the NPC takes the actions that the player wants them to take. I'm struggling to get this working correctly. I've gotten it to "kind of work" a few times, but it's never been as fluid or intuitive as I'd like. My first idea was to just let the player move around and disable the NPC's AI and then constantly move them to the player. That didn't work out very well, so now I'm trying to have the NPC move around via animations. This looks promising, but now I'm having difficulties with a delay that seems to happen whenever the player tells the NPC to perform an action. For example the player will try to move forwards and the NPC will react a second later. I know this isn't to do with how many times a second the script runs as it's set to run every 0.001 seconds. This is the main problem I'm facing. I'm also having difficulty getting the weapons to animate, but I'm reasonably certain that I'm just telling it to use the wrong animation group or something.

Edited by Jojash
Link to comment
Share on other sites

Much more clear now, thanks. I first must say your idea is very original and totally awesome. I imagine a prototype, forgotten in some big MT laboratory, that enables its user to manipulate the neural oscillation of any biological creature with a central nervous system, controlling its thoughts and actions. A Voodoo doll would be cool, too. :cool:

I sure hope you manage to get it to work as you plan. Not at all a simple undertaking, as you've probably noticed by now.

 

I've never done any scripting/AI for NPCs. I did some animation scripting for my last mod, though nothing nearly as complex as what you're attempting to do here. I'm not sure the animation path would be the best/easiest/only approach. There may be another way.

 

Making attacks work properly would probably be the most difficult part. I'm not at all sure playing an attack animation actually counts as an attack, per se (you "swing" a melee weapon, but don't hit anything; you "shoot" a gun, but no bullets are fired). That's the first thing you must verify, before going any further on this direction.

 

As for playing the right attack animation, you can first check which animation the NPC's weapon uses and, accordingly, select an animation:

 

set rUsedWeapon to NPCREF.GetEquippedObject 5

set iAnimType to GetWeaponAttackAnimation rUsedWeapon

 

Then, whenever you need to play the animation:

 

if iAnimType == 1

NPCREF.PlayGroup Attack3 1

elseif iAnimType == 2

NPCREF.PlayGroup Attack4 1

etc.

 

(You can find the animation codes here)

 

There's a big BUT here. Each attack animation has several variations, depending on the actor's pose: looking forward, looking up, looking down, and each of the three when aiming. This would make things much more complicated, as you would have to also check the pose when picking the animation to play. That is why I would advise you to seek another approach, if only just for the attack sequence. The answer may be in dynamically modifying the NPC's AI package, but I don't know if such thing is practical, or even possible.

 

The most important thing, though, is not giving up! You really have something going here, which also happens to be super cool.

Link to comment
Share on other sites

Wow, that's really encouraging to hear! Thank you very much! :D I feel I ought to disillusion you though, the idea behind it is robots, hopefully when it's done, the player will be able to hack into and control, among other things, robots which is definitely less interesting than what you're thinking of, but ah well... I guess there's nothing stopping from making a second mod that expands on the idea, or including upgrades for the device that lets you hack into the robots, to allow you to control other creatures... *Considers possibilities.*

 

I've already verified whether or not the animations will make an NPC attack or not, which they will not, but I've actually gotten them to fire. The problem is having them fire in the direction I want. I've been mainly testing on securitrons, and, for whatever reason, they seem to fire backwards without an animation in place to get the gun pointing in the right direction. this is proving to be a little troublesome, but I think it's just a matter of playing around with it a bit. I didn't know about "GetWeaponAttackAnimation" and I must say, that sounds incredibly helpful!

 

As for getting the right animation for the direction of the gun, since the player is in control of where the NPC is looking, I assume I can just find out where they're looking and then, depending on the direction, decide whether or not the NPC fires up or down.

 

My biggest concern is the delay I was talking about. I feel like it really detracts from the experience, but I can't for the life of me figure out what's causing it. You wouldn't happen to have any ideas about that, would you?

 

As for another approach, the only thing I can think of doing, which I've tried, is to disable the NPC's AI and then constantly move them to the player, whilst allowing the player to move around. This didn't work out perfectly, as there was a lot of clipping issues and there, unfortunately, seems to be no way of disabling collisions on the NPC.

Edited by Jojash
Link to comment
Share on other sites

Ah, if it's limited to robots (which is no less awesome) then it would make everything much simpler.

Each robot type has ony 1-3 attack types (for instance, Sentry Bots: Minigun, Gatling Laser and Missile Launcher). Each attack type uses an embeded weapon (which is still a weapon in every respect, with stats and everything). You can check which weapons each robot uses, then check those weapons, see what type of animation each of them use (At this point I should probably mention I'm on my laptop, with no game nor GECK installed, therefore can't verify how accurate the information I give you).

As for the delay issue, I can't say what may be causing it - could be several things. You should break down the script and test each procedure separately. First, try using this code (for fast forward movement) on a robot and see if there's still a delay:

short	bFastForward

(...)

if bFastForward != IsControlPressed 0
	set bFastForward to (bFastForward == 0)
	if bFastForward
		RobotREF.PlayGroup FastForward 1
	else
		RobotREF.PlayGroup Idle 0
	endif
endif
Link to comment
Share on other sites

That does seem to have fixed the issue! But I must confess, I'm not sure how it works. Would you mind explaining it to me or pointing me in the direction of an explanation? Shouldn't that just constantly play the FastForward animation after control 4 is pressed? I feel that it's better to understand why something works rather than just copy-pasting, otherwise I learn nothing. :) Edited by Jojash
Link to comment
Share on other sites

First of all, I'm glad to hear it helped. Now, let me try to explain.

A looping animation, such as 'FastForward', will play indefinitely until made to stop (by playing 'Idle'), therefore not only that you don't need to make it re-play every time the script is processed (100+ times every second), doing so may cause all kinds of glitches (the delay being one of them).

The method demonstrated above ensures that PlayGroup will only be executed ONCE, every time (and only when) the state of Control 0 (pressed/not pressed) changes.

This block is built a little different, but does exacly the same thing. Also, it's probably more intuitive and easier to understand:

if IsControlPressed 0
	if bFastForward == 0
		set bFastForward to 1
		RobotREF.PlayGroup FastForward 1
	endif
elseif bFastForward
	set bFastForward to 0
	RobotREF.PlayGroup Idle 0
endif
Link to comment
Share on other sites

Ahhhhh, okay! Thank you very much for explaining that's much clearer now! Also, thank you very much for all of your help with this, I'm most grateful! I'm confident that I'll be able to get my script working the way I'd envisioned now! :D

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...