ANIMATION_PLACEABLE_STOP! For crying out loud.
#1
Posté 16 juillet 2012 - 03:31
Thank you
#2
Posté 16 juillet 2012 - 03:43
just add an int_check to the HB code that runs the animation:
if (bRunAnim)
{
// run the anim
}
else
{
// stop the anim.
}and set the int via the lever ... or convo ... put the int on the Area or the lever itself, i suggest [or right on the placeable]
Modifié par kevL, 16 juillet 2012 - 09:52 .
#3
Posté 16 juillet 2012 - 03:48
if (bStopAnim) return;
Modifié par kevL, 16 juillet 2012 - 09:53 .
#4
Posté 16 juillet 2012 - 03:32
#5
Posté 17 juillet 2012 - 11:01
Here’s the script that I have placed right on the animated placeable/heartbeat.
void main()
{
object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN);
if (IsInConversation(OBJECT_SELF) || GetIsInCombat()) return;
PlayAnimation(ANIMATION_PLACEABLE_OPEN);
}
I tried having the animation play from another source (lever) but that didn’t seem to work either.
And another thing, I have no idea what I’m doing.
#6
Posté 17 juillet 2012 - 11:53
#7
Posté 18 juillet 2012 - 12:10
but that looks like a one-shot animation that should be fired from a trigger's onEnter event:
//pseudo-code:
void main()
{
if (GetIsPC(GetEnteringObject()))
{
PlayAnimation(ANIMATION_PLACEABLE_OPEN);
}
}
- just open the chest/box/door when the PC walks into view, right?
[ edit ]
zzzzzzzzz coffeeeeAlupinu wrote...
... I have an animated trap ...
Modifié par kevL, 18 juillet 2012 - 12:21 .
#8
Posté 18 juillet 2012 - 12:13
or, make it play its Idle_Animationkamal_ wrote...
ClearAllActions() ?
( Edit, half a coffee later )
going with the notion that the trap-placeable uses ANIMATION_PLACEABLE_OPEN to run a 6 second animation that gets looped on the heartbeat:
// heartbeat script on trap
void main()
{
int bStopAnim = GetLocalInt(OBJECT_SELF, "bStopAnim");
if (!bStopAnim)
{
PlayAnimation(ANIMATION_PLACEABLE_OPEN)
}
//else, by not looping the animation it should stop.
}// and, lever onUsed or in convo script
SetLocalInt(GetObjectByTag("trap1"), "bStopAnim", TRUE);That's the basics of what I was getting at earlier ...
Modifié par kevL, 18 juillet 2012 - 01:04 .
#9
Posté 18 juillet 2012 - 02:01
Can anybody see what is wrong with the script below and why it won’t work.
//Put this script OnEnter
//Set damage: d2, d3, d4, d6, d8, d10, d12, d20, d100
void main()
{
object oPC = GetEnteringObject();
//if (!GetIsPC(oPC)) return;
string sInt = GetLocalString(OBJECT_SELF, "Intel");
string sTrap = GetLocalString(OBJECT_SELF, "Trap");
string sSound = GetLocalString(OBJECT_SELF, "Sound");
if (GetLocalInt(oPC, sInt)!= 1)
return;
int nRandomNumber = d12();
effect eEffect;
SetLocalInt(oPC, GetTag(OBJECT_SELF), TRUE);
if (ReflexSave(oPC, 16, SAVING_THROW_TYPE_TRAP ))
{
}
else
{
eEffect = EffectDamage(d12(), DAMAGE_TYPE_SLASHING, DAMAGE_POWER_NORMAL);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);
}
{
object oTarget;
oTarget = GetObjectByTag(sTrap);
PlayAnimation(ANIMATION_PLACEABLE_OPEN);
oTarget = GetObjectByTag(sSound);
SoundObjectPlay(oTarget);
}
}Thank you.
Modifié par Alupinu, 18 juillet 2012 - 02:11 .
#10
Posté 18 juillet 2012 - 02:09
kevL wrote...
or, make it play its Idle_Animationkamal_ wrote...
ClearAllActions() ?
( Edit, half a coffee later )
going with the notion that the trap-placeable uses ANIMATION_PLACEABLE_OPEN to run a 6 second animation that gets looped on the heartbeat:// heartbeat script on trap void main() { int bStopAnim = GetLocalInt(OBJECT_SELF, "bStopAnim"); if (!bStopAnim) { PlayAnimation(ANIMATION_PLACEABLE_OPEN) } //else, by not looping the animation it should stop. }// and, lever onUsed or in convo script SetLocalInt(GetObjectByTag("trap1"), "bStopAnim", TRUE);
That's the basics of what I was getting at earlier ...
Wow kevL this looks like it might work. Certainly a lot cleaner then my bunch of Mickey-mouse and it works on HB!
Let me play around with this and hopefully it will solve my problem.
Thanks!
Modifié par Alupinu, 18 juillet 2012 - 02:15 .
#11
Posté 18 juillet 2012 - 02:00
if _PLACEABLE_OPEN gets it goin' try _PLACEABLE_CLOSE to stop it
#12
Posté 18 juillet 2012 - 03:26
kevL wrote...
i bet it depends on what ANIMATION_Constants are available to the model ( or whatever it is )
if _PLACEABLE_OPEN gets it goin' try _PLACEABLE_CLOSE to stop it
Well that does make sense.
#13
Posté 18 juillet 2012 - 11:42
#14
Posté 19 juillet 2012 - 12:37
coolAlupinu wrote...
Good new kevL, got your script to work. Took me most of the day to get all the variables set up, sound, damage, ect. But using your script as a model, I got it to all work perfectly. Now my players can turn on and off the animated traps at will.
whatver,Thank you again kevL, I’ll make sure you get a place in my credits.
.
#15
Posté 15 août 2012 - 04:27
I would like to have characters wandering around way points and then sitting down everyonce in a while to take a rest. I thought it would add ambience. I am also wondering if I can get animals to sit.
#16
Posté 15 août 2012 - 09:43
but I bet that - if this is using scripted waypoints - there is a 'pause' function that those scripts/the HB will respect. Other than that, the onHeartBeat probaly has to be customized; and an if/then condition inserted that shorts the HB for a set duration ... similar to what Alupinu was looking at
now you want the sit animation to loop. If you look at 'nw_c2_default1' the NPC HB script, you may see sections for AMBIENT_ANIMATIONS just beneath a section for WalkWayPoints (personally i reversed those two sections, and added some conditions such that if POSTed do immobile_ambients). It's possible to add a CalmHB hook that runs a custom script above those sections, still in the NoEnemiesPerceived section tho -- that's where a looped sit anim can be added w/ timer.
- will post my default NPC HB script, note the CalmHB scope (and reversal of Ambients & WalkWayPoints). The Pia at the bottom is for micromanagers like myself ( see .sig ),
Modifié par kevL, 15 août 2012 - 09:43 .
#17
Posté 15 août 2012 - 09:53
#18
Posté 16 août 2012 - 12:50
#19
Posté 16 août 2012 - 01:27
In the following: PlayCustomAnimation(oNpc, "sittalk01", 0, 1.0);Spectre- wrote...
I am confused about how to get a character to sit down and stay sitting down. After the animation fires it seems they always jump straight back up again. Has someone already posted how to pause the animation at a specific time, so that I could keep an NPC sitting?
I would like to have characters wandering around way points and then sitting down everyonce in a while to take a rest. I thought it would add ambience. I am also wondering if I can get animals to sit.
The 0 tells the npc not to loop the animation. You would set it to 1 to loop the animation. What's likely happening is your npc has it set to 0, so once the animation completes it ends the animation and continues it's business (walking waypoints). If you want an npc to sit for some period of time, you need to tell the npc how many times to play that animation. Since the npc is getting it's commands from the heartbeat, this is where you determine that.
If I wanted the npc to sit for 10 heartbeats (60 seconds), I would set an int on the npc (nSitTimeLength or something) when your npc determines it's time to sit. Then in the heartbeat, use GetLocalInt(OBJECT_SELF, "nSitTimeLength"). Something like the following
if (your condition for sitting)
{
if (GetLocalInt(OBJECT_SELF, "nSitTimeLength") > 0) //not first heartbeat of sitting
{
//sit command such as
PlayCustomAnimation(oNpc, "sittalk01", 0, 1.0);
int nLength =( GetLocalInt(OBJECT_SELF, "nSitTimeLength")-1);
SetLocalInt(OBJECT_SELF, "nSitTimeLength", nLength);
}
else //first heartbeat of sitting
{SetLocalInt(OBJECT_SELF, "nSitTimeLength", 10)
//sit command such as
PlayCustomAnimation(oNpc, "sittalk01", 0, 1.0);
}
}
//standard disclaimer about my code possibly being broken. I just typed stuff in.
Modifié par kamal_, 16 août 2012 - 01:32 .
#20
Posté 16 août 2012 - 11:38





Retour en haut







