Home   Help Search Login Register  

Author Topic: Cancelling playmove/switchmove  (Read 3314 times)

0 Members and 1 Guest are viewing this topic.

Offline Arctic

  • Members
  • *
  • In Utero
Cancelling playmove/switchmove
« on: 10 Feb 2003, 01:10:28 »
In the beginning of a script, I tell some units to sit down. But when the player is close to them, they will stand up and attack the player. The problem is, I can't get the units to stand up!

Code: [Select]
_unit = _this select 0
_marker = _this select 1

#Sit
[_unit] exec "distance.sqs"
?(distamount <= 5): goto "posPlayer"

_unit playmove "EffectStandSitDown"
goto "Sit"

#posPlayer
_marker setpos [getpos player select 0,getpos player select 1,1]
#alert
?((_unit distance _marker) <= 5): goto "Patrol"
?(!alive player): exit
?(!alive _unit): exit
_unit switchmove "SitDowntoStand"

_unit setcombatmode "RED"
_unit setbehaviour "Combat"

_unit commandmove getpos _marker

~4
goto "alert"

#Patrol
?(!alive player): exit
?(!alive _unit): exit
?(!_unit knowsabout player): exit
_unit doTarget player
_unit commandMove getpos player

~7
_aa = random 20
_ab = random 20
_unit setvelocity [_aa,0,_ab]

~7
goto "patrol"

Side note: Some of that code is a little bad b/c I couldn't think of what to do with it.

What command do I issue to get these guys to attack me.

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:Cancelling playmove/switchmove
« Reply #1 on: 10 Feb 2003, 01:17:02 »
From what I gather about your script, is that you tell them to target and attack but they remain sitting still?  As you ask, you need to tell them to stop switchmoving.

UnitName SwitchMove ""

Will do it nicely.  Alternatively you can use Playmove if you want a  smother animation.

Offline Arctic

  • Members
  • *
  • In Utero
Re:Cancelling playmove/switchmove
« Reply #2 on: 10 Feb 2003, 01:22:04 »
sweet

thx

Offline Arctic

  • Members
  • *
  • In Utero
Re:Cancelling playmove/switchmove
« Reply #3 on: 10 Feb 2003, 01:38:42 »
Didn't work....  >:(

Code: [Select]
_unit = _this select 0
_marker = _this select 1

#Sit
[_unit] exec "distance.sqs"
?(_unit knowsabout player): goto "posPlayer"

_unit playmove "EffectStandSitDown"
goto "Sit"

#posPlayer
_marker setpos [getpos player select 0,getpos player select 1,1]
#alert
?(!alive player): exit
?(!alive _unit): exit

_unit switchmove ""
_unit setcombatmode "RED"
_unit setbehaviour "Combat"

_unit commandmove getpos _marker

~4
?((_unit distance _marker) <= 1.5): goto "Patrol"
goto "alert"

thats just the portion of it that concerns the switchmove/playmove of the unit.

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:Cancelling playmove/switchmove
« Reply #4 on: 10 Feb 2003, 01:49:59 »
So whats happening?  The _unit  isnt standing up?

Offline Arctic

  • Members
  • *
  • In Utero
Re:Cancelling playmove/switchmove
« Reply #5 on: 10 Feb 2003, 02:02:38 »
Yes, the unit just sits there. And when I issue the switchmove "" or playmove "" commands, the units just sits there... even when i am directly on top of them.

I can't get the unit to stand up and resume kicking my ass!

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:Cancelling playmove/switchmove
« Reply #6 on: 10 Feb 2003, 02:06:39 »
Hmmm, dont get it.

You sure the script is getting out of the #Sit loop?

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Cancelling playmove/switchmove
« Reply #7 on: 10 Feb 2003, 02:06:54 »
unitname switchmove "null"

will do ;) ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:Cancelling playmove/switchmove
« Reply #8 on: 10 Feb 2003, 02:07:32 »
"null" is the same as "", which is the same as many other commands that effectively remove the switchmove animation.  Unless of course they changed that for any very recent update to the game.  In which case,  I'll eat my wings.
« Last Edit: 10 Feb 2003, 02:10:30 by [icarus_uk] »

Offline Arctic

  • Members
  • *
  • In Utero
Re:Cancelling playmove/switchmove
« Reply #9 on: 10 Feb 2003, 02:13:12 »
Still doesnt....  >:(

Code: [Select]
_unit = _this select 0
_marker = _this select 1

#Sit
[_unit] exec "distance.sqs"
?(player knowsabout _unit): goto "posPlayer"

_unit playmove "EffectStandSitDown"
goto "Sit"

#posPlayer
_unit playmove "null"
_marker setpos [getpos player select 0,getpos player select 1,1]
#alert
?(!alive player): exit
?(!alive _unit): exit


_unit setcombatmode "RED"
_unit setbehaviour "Combat"

_unit commandmove getpos _marker

~4
?((_unit distance _marker) <= 1.5): goto "Patrol"
goto "alert"

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Cancelling playmove/switchmove
« Reply #10 on: 10 Feb 2003, 02:32:01 »
lol right Icarus is prooly right ;D

but da prob is in da script  ::)

?(player knowsabout _unit): goto "posPlayer"

is not condition

but

?(player knowsabout _unit > 1): goto "posPlayer"

will work ;D

lol

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:Cancelling playmove/switchmove
« Reply #11 on: 10 Feb 2003, 02:36:19 »
"prooly right"?  I know Im right :)

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Cancelling playmove/switchmove
« Reply #12 on: 10 Feb 2003, 02:37:38 »
but i dont  :P  ;D

LCD OUT

"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:Cancelling playmove/switchmove
« Reply #13 on: 10 Feb 2003, 02:38:37 »
Im pretty sure Ive had this exact same conversation with somone else on these forums. :D

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Cancelling playmove/switchmove
« Reply #14 on: 10 Feb 2003, 02:41:36 »
it wasnt me ;D

if i ever try it ill tel u ;D till den it wil b prooly right ;)

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Arctic

  • Members
  • *
  • In Utero
Re:Cancelling playmove/switchmove
« Reply #15 on: 10 Feb 2003, 02:59:31 »
Hey it worked! ... for a moment... then they sat back down. Grrr.....

I tried it again and nothing happend

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Cancelling playmove/switchmove
« Reply #16 on: 10 Feb 2003, 03:06:30 »
den goes oder prob wid OFP nd switchmove  ;D

- wen u give em lots of switchmove (i know its wid da sitin anim but can prooly b wid oders also)dey want 2 complete all deir anims (or at least da last 2-3 of em) - ull have 2 make da script smarter ordering em 2 switchmove only wen needed (every 8.2 secs i think)

if u wont figure dat out till zomoz ill give u som snipit ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Arctic

  • Members
  • *
  • In Utero
Re:Cancelling playmove/switchmove
« Reply #17 on: 10 Feb 2003, 03:14:46 »
Ahh, no free answer? ;)

I think i got it... do a loop until the condition is met?

So i think i'll need to use the if then else command... right?
I've never used this command b4...  :-\ so i'll giver 'er a go...

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Cancelling playmove/switchmove
« Reply #18 on: 10 Feb 2003, 03:17:25 »
u would have got free answer if it was eariler now  ;D

but its 4:12 AM nd i cant think right  :o

just dis grreent things r trin 2 eat me  ::)

so after i sleep (nd prooly get sober again) ill make som nice things 4 u :D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Arctic

  • Members
  • *
  • In Utero
Re:Cancelling playmove/switchmove
« Reply #19 on: 10 Feb 2003, 03:22:12 »
I'm given this a shot...

Code: [Select]
_unit = _this select 0
_marker = _this select 1
_standnow = false

#Sit
?(_standnow = true): goto "posPlayer"
[_unit] exec "distance.sqs"

if (_unit knowsabout player > 1) then ([_unit playmove "null") && (_standnow = true)] else (_unit playmove "EffectStandSitDown")
~8.2

goto "Sit"

#posPlayer
_marker setpos [getpos player select 0,getpos player select 1,1]
#alert
?(!alive player): exit
?(!alive _unit): exit

_unit setcombatmode "RED"
_unit setbehaviour "Combat"

~0.05
_unit commandmove getpos _marker

~4
?((_unit distance _marker) <= 1.5): goto "Patrol"
goto "alert"

Offline Arctic

  • Members
  • *
  • In Utero
Re:Cancelling playmove/switchmove
« Reply #20 on: 10 Feb 2003, 03:23:27 »
oops... ok. lol

i'll give this if then else stuff a shot... but i can wait.

EDIT:
LoL, it came out funky. And made the standnow cariable with '==' signs. So, i'll wait till tomorrow.
« Last Edit: 10 Feb 2003, 03:29:18 by Arctic »

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Cancelling playmove/switchmove
« Reply #21 on: 10 Feb 2003, 03:31:16 »
i dont think wat u did is good ;D

u know wat ? i think ull have 2 use somthin like dat ;D

Code: [Select]
_unit = _this select 0
_marker = _this select 1
_standnow = false
_count = 0

#Sit
?(_standnow = true): goto "posPlayer"
[_unit] exec "distance.sqs"

if (_unit knowsabout player > 1) then
{
_unit playmove "null"
_standnow = true
}
else
{
if (_count == 82) then
{
_unit playmove "EffectStandSitDown"
_count = 0
}
}

_count = _count+1
~0.1

goto "Sit"

#posPlayer
_marker setpos [getpos player select 0,getpos player select 1,1]
#alert
?(!alive player): exit
?(!alive _unit): exit

_unit setcombatmode "RED"
_unit setbehaviour "Combat"

~0.05
_unit commandmove getpos _marker

~4
?((_unit distance _marker) <= 1.5): goto "Patrol"
goto "alert"

will prooly work ;D

now i realy gotta sleep

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline alimag

  • Contributing Member
  • **
  • I'm a llama!
Re:Cancelling playmove/switchmove
« Reply #22 on: 10 Feb 2003, 14:35:17 »
Hi,

This is the script I use in a mission I've made a while ago called 'Hill 107'.
I call the script to make 3 civilians sit and when I want them to do something else I just set the variable 'vCivSit' to false (vCivSit = true before calling the script)

; civsit.sqs
; Keeping the civilians quiet
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

#Loop
   civil1 playMove "EffectStandSitDownVer1"
   civil2 playMove "EffectStandSitDownVer1"
   civil3 playMove "EffectStandSitDownVer1"
   ~2
? vCivSit : goto "Loop"
exit

It works fine for me
Hope it helps
AliMag

Offline Arctic

  • Members
  • *
  • In Utero
Re:Cancelling playmove/switchmove
« Reply #23 on: 10 Feb 2003, 22:40:44 »
@LCD

Looks good, but I get an error message that says:

'|#|}' Error invalid Number

Or something along those lines... Not sure about the bracket...

Offline Arctic

  • Members
  • *
  • In Utero
Re:Cancelling playmove/switchmove
« Reply #24 on: 11 Feb 2003, 00:18:05 »
Doesnt work, although the soldiers look at me and spontaneously 'bunp' themselves away from the fire...

That error is: '|#|}' Error invalid Number in expression

I dunno what caused it... I might try making that if then else thing on one line...

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Cancelling playmove/switchmove
« Reply #25 on: 11 Feb 2003, 00:41:21 »
u can try makin it 1 line ;D and it prooly work :D - just remember 2 put ; between da cmmands ;)

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Arctic

  • Members
  • *
  • In Utero
Re:Cancelling playmove/switchmove
« Reply #26 on: 11 Feb 2003, 01:04:42 »
The people stood! LoL, I just have to solve this error:  '(_standnow #= true)' error unknown operator

___

I changed the statement to
Code: [Select]
?standnow and the error goes away, but when i go to the right side of the house, the guys are already  standing up and sit down when they see me. If I go to the left side, everything goes as planned.