Home   Help Search Login Register  

Author Topic: City check doesn't work  (Read 600 times)

0 Members and 1 Guest are viewing this topic.

Dubieman

  • Guest
City check doesn't work
« on: 24 Feb 2005, 03:57:42 »
Hello...

I've got my script here and I'm using it to work by city.

So when the convoy arrives in town the script activates like this:

[SanAlto] exec "epatrol_1checkcity.sqs"

Then the script should check that parameter "SanAlto" is being called and sends the script to the #SanAlto part. Then the script makes the infantry jump out and move to the appropriate game logic. That's the reason for the parameter system, so the guys go to the right game logic. :P

I can get the guys to jump out and all, but it fails to recognize the city name/parameter like when I put it  SanAlto. It just doesn't work. :(

So I don't know why it won't recognize what I put in. I got the idea from a script from CHOFPSE. Dunno if this is even gonna work. ::) :P

Code: [Select]
?(alive epatrol_1_3): "exit"
go_1 = false
_city = _this select 0
_patrol = sec1inf1
_lead = leader sec1inf1

hint "infantry jumping out!"

{unassignvehicle _x} foreach units _patrol
{_x action ["EJECT",epatrol_1_3]} foreach units _patrol
{_x setbehaviour "AWARE"} foreach units _patrol
~10
?(_city == "SanAlto"): Goto "SanAlto"
?(_city == "SaintR"): Goto "SaintR"
?(_city == "Meridan"): Goto "Meridan"
?(_city == "Lebrija"): Goto "Lebrija"

hint "invalid city"
exit

#Getin
_lead domove (getpos epatrol_1_3)
~20
?((_lead distance epatrol_1_3) < 7): Goto "getin2"
goto "Getin"
#getin2
{_x moveincargo epatrol_1_3} foreach units _patrol
go_1 = true
exit

#exit
exit


;game logics: gl_1_1 gl_1_2  San Alto: patrol
#SanAlto
_lead domove gl_1_1
~20
_dis_1_1 = (_lead distance gl_1_1)
?(_dis_1_1 < 10): Goto "sanalto2"
goto "SanAlto"

#sanalto2
_lead domove gl_1_2
~45
_dis_1_2 = (_lead distance gl_1_2)
?(_dis_1_2 < 10): Goto "Getin"
goto "sanalto2"


That's the script, not very tidy as its being made right now, but if anyone can fix it, it'll be much appreciated. ;D

Thanks
GRK
« Last Edit: 24 Feb 2005, 04:11:14 by GuiltyRoachKillar »

Dubieman

  • Guest
Re:City check doesn't work
« Reply #1 on: 24 Feb 2005, 04:00:39 »
Ever get the feeling you're a complete idiot and you forgot to add the "  " marks? :D

Well that's me right now...

So problem solved... ::) ;D

Me before: ooooo
Me now: ahhhhhh
 ;D ;D 8)


EDIT: I decided to keep this open, if you have any suggestions or want to point something out. No suggestions, then I'll just solve this baby. ;)

edit2: solved
« Last Edit: 27 Feb 2005, 22:28:52 by GuiltyRoachKillar »

Dubieman

  • Guest
Re:City check doesn't work
« Reply #2 on: 27 Feb 2005, 22:27:59 »
Ok not solved... ::) ;D

Anyways I can get the people out and go to their positions and come back and jump in the truck. Now then I want my convoy to start moving again.

The convoy comes to the waypoint that is synched to a trigger that's activated by   go_1   =  true  . Now in my script you'll see this will be a loop (convoy around and around) so I can't have go_1 = true forever, otherwise next time the convoy comes around, the cars will keep moving and leave my infantry behind. So if you could look at my script and tell me why the cars won't move/move to next waypoint that'd really help. BTW all waypoints are move waypoints.

And I'm calling the script by using ["SanAlto"] exec "epatrol_1checkcity.sqs"

Thanks for any help. ;)

Code: [Select]
;Sector1 convoy patrol
;only sector 1: San Alto, Saint Renoir, Meridan, Lebrija
;epatrol_1.sqs
;["SanAlto"] exec "epatrol_1checkcity.sqs"
;********************************
;truck alive?
?(alive epatrol_1_3): "exit"
go_1 = false

;specify everything
_city = _this select 0
_patrol = sec1inf1
_lead = leader sec1inf1


hint "infantry jumping out!"

;get out!
epatrol_1_3 setfuel 0
~4
{unassignvehicle _x} foreach units _patrol
{_x action ["EJECT",epatrol_1_3]} foreach units _patrol
{_x setbehaviour "AWARE"} foreach units _patrol
epatrol_1_3 setfuel 1

~10
;cities and the check
?(_city == "SanAlto"): Goto "SanAlto"
?(_city == "SaintR"): Goto "SaintR"
?(_city == "Meridan"): Goto "Meridan"
?(_city == "Lebrija"): Goto "Lebrija"

hint "invalid city"
exit



;get the infantry back into the truck
#Getin
_patrol move (getpos epatrol_1_3)
~20
?((_lead distance epatrol_1_3) < 7): Goto "getin2"
goto "Getin"
#getin2
{_x moveincargo epatrol_1_3} foreach units _patrol
?(_city == "SanAlto"): Goto "go1"
?(_city == "SaintR"): Goto "go2"
?(_city == "Meridan"): Goto "go3"
?(_city == "Lebrija"): Goto "go4"
exit

#go1
go_1 = true
go_2 = false
go_3 = false
go_4 = false

#go2
go_2 = true
go_1 = false
go_3 = false
go_4 = false

#go3
go_3 = true
go_1 = false
go_2 = false
go_4 = false

#go4
go_4 = true
go_1 = false
go_2 = false
go_3 = false

#exit
exit


;game logics: gl_1_1 gl_1_2  San Alto: patrol
#SanAlto

_patrol move (getpos gl_1_1)
~20
_dis_1_1 = (_lead distance gl_1_1)
?(_dis_1_1 < 10): Goto "sanalto2"
goto "SanAlto"

#sanalto2
_patrol move (getpos gl_1_2)
~45
_dis_1_2 = (_lead distance gl_1_2)
?(_dis_1_2 < 10): Goto "Getin"
goto "sanalto2"

;Saint Renoir: game logics: gl_1_3, gl_1_4
#SaintR

_patrol move (getpos gl_1_3)
~20
_dis_1_1 = (_lead distance gl_1_3)
?(_dis_1_1 < 10): Goto "SaintR2"
goto "SaintR"

#SaintR2
_patrol move (getpos gl_1_4)
~45
_dis_1_2 = (_lead distance gl_1_4)
?(_dis_1_2 < 10): Goto "Getin"
goto "SaintR2"

Cheers
GRK

« Last Edit: 27 Feb 2005, 22:30:48 by GuiltyRoachKillar »

Offline Pilot

  • Contributing Member
  • **
Re:City check doesn't work
« Reply #3 on: 27 Feb 2005, 23:06:23 »
In this line you set the fuel to 0:
Code: [Select]
epatrol_1_3 setfuel 0Yet I don't see any place in the script where the fuel is set back to 1.

EDIT:
Nevermind, I can't read. ::)
« Last Edit: 27 Feb 2005, 23:08:05 by Student Pilot »

Dubieman

  • Guest
Re:City check doesn't work
« Reply #4 on: 27 Feb 2005, 23:16:21 »
Hmm,
I have another idea, though it wouldn't look as good. Using setfuel on the whole convoy... :P Maybe...I'll see if anyone knows the answer to this.

And another question.

If I have four WPs.

1: Move
2:Move
3:move
4:cycle

So the units will do the route cause of the cycle WP.
Now if I add a trigger that's synched to WP 2.
2:Move -- trigger = activated by  go    (go = true)

Now once the unit gets past WP 2 I set the variable/boolean "go" to go = false. Now does that affect the unit? ???

Offline Pilot

  • Contributing Member
  • **
Re:City check doesn't work
« Reply #5 on: 27 Feb 2005, 23:16:50 »
Ok, hopefully this time I can help some. ::)
This line:
Code: [Select]
?(_city == "SanAlto"): Goto "go1"Tells the script to go to "go1"

Here is go1:
Code: [Select]
#go1
go_1 = true
go_2 = false
go_3 = false
go_4 = false
There is no exit command on go1, so the script goes right to go2, which sets the same parameters differently.  Then the script goes to go3, which sets the same parameters differently from the first two, and finally the script goes to go4, which sets the parameters differently from the first three.  Now the script goes to #Exit, and the script finally exits.  I think you want an exit command after each "go".  Ex:
Code: [Select]
#go1
go_1 = true
go_2 = false
go_3 = false
go_4 = false
exit

#go2
go_2 = true
go_1 = false
go_3 = false
go_4 = false
exit

#go3
go_3 = true
go_1 = false
go_2 = false
go_4 = false
exit

#go4
go_4 = true
go_1 = false
go_2 = false
go_3 = false
exit

I hope that helps!

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:City check doesn't work
« Reply #6 on: 28 Feb 2005, 05:03:35 »
he's absolutely right

also, just a little tip:
;cities and the check
?(_city == "SanAlto"): Goto "SanAlto"
?(_city == "SaintR"): Goto "SaintR"
?(_city == "Meridan"): Goto "Meridan"
?(_city == "Lebrija"): Goto "Lebrija"

since the goto's use strings, they can bestored in variables, so you can just use:
goto _city

Dubieman

  • Guest
Re:City check doesn't work
« Reply #7 on: 28 Feb 2005, 05:18:15 »
Ahhhh....

Those were new bits of code and I wasn't thinking right. Makes sense now, it goes to that bit and then keeps reading down the list. :P

Thanks Student Pilot, I'll see if that works tomoz. ;)

@TriggerHappy, cool didn't think of that either, thanks. ;)



@ I found tha answer to my latest question that doesn't matter now, I need to make the trigger repeating to make the "go_x" part of my script work. And changing booleans after the unit passes the waypoint does nothing to its behaviour.
« Last Edit: 28 Feb 2005, 05:20:36 by GuiltyRoachKillar »