Home   Help Search Login Register  

Author Topic: Script problems  (Read 709 times)

0 Members and 1 Guest are viewing this topic.

Jasper

  • Guest
Script problems
« on: 29 Jul 2004, 11:37:01 »
 have searched for an answer but I cant find the answer to this...  

I've got a simple script to simulate a simple conversation.  Its called chat.sqs.  I have two people (chat1 and chat2). There is a trigger covering them = East, Present, Once, [] exec "chat.sqs"

The script =

#repeat

? Alert1 : goto "Alert"
~1

chat1 playmove "EffectStandTalk"
? Alert1 : goto "Alert"
~1

chat2 playmove "FXCivilFoldOnesArms"
? Alert1 : goto "Alert"
~1

chat2 playmove "EffectStandTalk"
? Alert1 : goto "Alert"
~1

chat1 playmove "FXCivilHandMouth"
? Alert1 : goto "Alert"
~1

goto "repeat"

#Alert
(chat1) setbehaviour "combat"
(chat1) setspeedmode "normal"
(chat1) setcombatmode "red"

(chat2) setbehaviour "combat"
(chat2) setspeedmode "normal"
(chat2) setcombatmode "red"

chat1 switchmove "null"
chat2 switchmove "null"

goto "end"

#end
exit

When the mission starts the people start chatting.  When the Alert1 is true they both stop chatting and go to combat mode.

But, then after a couple of seconds they just start chatting again. The 'enemy' westerner is still alive, so the Alert1 stays true and the script goes to the end and the trigger is set to once so why does it loop?

I have tried using switch move and that doesnt work.

All help appreciated and if there is an easier way to simulate them chatting please point me in the right direction. Cheers.

Jasper

  • Guest
Re:Script problems
« Reply #1 on: 29 Jul 2004, 13:12:43 »
After 'extensive'  ;)  testing, it seems the 2 people are indeed stuck in their animations.

If i assign them to a group when Alert1 = true, they do join the group but they dont follow any orders you give them until they stop doing the animations.

So, the problem is getting them to 'forget' the list of animations.  I assumed that switchmove "null" did that but it obviously doesn't.

Has nobody else used a script to simulate talking in their missions?  If so , how did you get them to do something else?

I cant use switchmove instead of playmove to act out the conversation unless i put in wait times. But this would stop them from reacting to Alert1 because they would be waiting to finish the animation.

Is this just another limitation to OFp or am I overlooking something?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Script problems
« Reply #2 on: 29 Jul 2004, 14:37:27 »
Try using both switchmove "null" and playmove "null".   Also put the command before the behaviour commands.
Plenty of reviewed ArmA missions for you to play

Jasper

  • Guest
Re:Script problems
« Reply #3 on: 29 Jul 2004, 16:22:30 »
Macguba, the playmove doesnt work at all, and what do you mean by

"put the command before the behaviour commands"

 ???

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Script problems
« Reply #4 on: 29 Jul 2004, 16:24:33 »
put this bit

chat1 switchmove "null"
chat2 switchmove "null"

before this bit

(chat1) setbehaviour "combat"
(chat1) setspeedmode "normal"
(chat1) setcombatmode "red"

(chat2) setbehaviour "combat"
(chat2) setspeedmode "normal"
(chat2) setcombatmode "red"


Get them out of the switchmoves before giving them other orders, that's all.     It might help, dunno, worth a try.
Plenty of reviewed ArmA missions for you to play

Jasper

  • Guest
Re:Script problems
« Reply #5 on: 29 Jul 2004, 16:28:05 »
Oh I see... ::)

Unfortunately I tried that and that doesnt work either... :(

This script is a mystery... ???

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Script problems
« Reply #6 on: 29 Jul 2004, 16:35:51 »
It is a mystery ... ok try longer gaps ~1 is not enough for a lot of animations.    They may be getting tied up in knots trying to do two at once.

Also try a "lite" version of your script with just one animation, see if you can get that to work.
« Last Edit: 29 Jul 2004, 16:36:30 by macguba »
Plenty of reviewed ArmA missions for you to play

Jasper

  • Guest
Re:Script problems
« Reply #7 on: 29 Jul 2004, 16:53:25 »
 :) Right we are getting somewhere...

This did work sort of, I just used the touch face animation.  1 out of the 3 times i ran it the man did as requested!! :cheers:

However the other 2 times he was still looping through the animation even though Alert1 was true  ???

If I was to increase the wait time from 1 second then they wouldnt react to Alert1 because they would have to wait for the set time before they checked it again.  Maybe there is no other way and I will have to decide between reaction time and conversation realism...

But surely not.. ;)

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Script problems
« Reply #8 on: 29 Jul 2004, 17:11:24 »
OK good it looks like we are getting somewhere.     Once you have ordered a loon to do an animation it is better to let him do it before telling him to do something else.    

By experiment you will be able to establish minimum times for each animation.    However I think you're just going to have to live with them finishing the animation before going to #alert.      
Plenty of reviewed ArmA missions for you to play

Jasper

  • Guest
Re:Script problems
« Reply #9 on: 29 Jul 2004, 17:15:14 »
Nooooooooooooooooooooooooooooooo

 ;) Ok then....... :'(

Unnamed

  • Guest
Re:Script problems
« Reply #10 on: 30 Jul 2004, 04:09:17 »
Have you tried switchmove or playmove to "combat"? Thats what I used to break out of some looped anims I made.

Jasper

  • Guest
Re:Script problems
« Reply #11 on: 30 Jul 2004, 11:19:55 »
That still doesnt work, The anims just cant seem to be 'forgotten'.

I have decided to just lose some realism in the conversation for the sake of quick reaction to the #Alert

Cheers anyway :D

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Re:Script problems
« Reply #12 on: 30 Jul 2004, 12:06:24 »
I suspect the reason is that 'PlayMove' works like 'PlaySound'. If you execute a number of consecutive PlaySounds (even without pauses) the engine plays each sound, all the way through, one after the other.

If my assumption's correct, your chat script is setting up a list of anims for each unit that will be played sequentially.  Executing a behaviour command seems to terminate the current anim but not the other unplayed moves in the unit's list.  Of course, when these play they override the behaviour command.

So much for the theory.  I have a vague recollection that a PlaySound "null" or similar clears the list so you could try a PlayMove "null" (or, I stress, something like that - I haven't checked) before the SetBehaviour.

Hope it helps.

Jasper

  • Guest
Re:Script problems
« Reply #13 on: 30 Jul 2004, 13:25:15 »
Thats the same suggestion as Macguba!  ;) :P

But, no, playmove null doesnt work either.  The #Alert flips true and the two guys stop chatting but after a couple of seconds they revert to the 'chat'.

It seems that the list of anims stays in 'memory' until completed.  Even when assigned to a group and #Alert is true, they join the group but wont obey commands until they have finished the 'chat'.

Cheers anyway  ;D