Home   Help Search Login Register  

Author Topic: Works Somtimes but not Others...  (Read 476 times)

0 Members and 1 Guest are viewing this topic.

CopyrightPhilly

  • Guest
Works Somtimes but not Others...
« on: 31 Aug 2004, 16:51:45 »
Hi

I'm making a capture the flag scipt, the problem i'm having is that it will not change/show if somone takes the flag 50% of the time (the other 50% of the time it works)

heres my scipt:

Code: [Select]
_flag=_this select 0
_flagname=_this select 1

_flag SetFlagSide RESISTANCE
_flag SetFlagTexture "\Flags\Pirates.jpg"
_flag SetFlagOwner objnull

#loop
?not isnull flagowner _flag and side (flagowner _flag)==west:goto "westflag"
?not isnull flagowner _flag and side (flagowner _flag)==east:goto "eastflag"
?not isnull flagowner _flag and not alive (flagowner _flag):goto "FlagDead"
?not isnull flagowner _flag and side (flagowner _flag) !=WEST and side (flagowner _flag) !=EAST:goto "Error"
~1
goto "loop"

#westflag
_flag SetFlagSide West
_flag SetFlagTexture "\Flags\NATO.jpg"
PlaySound "uCapture"
titletext[format["%1 Has Taken %2 For The West",name flagowner _flag,_flagname],"PLAIN DOWN"]
?flag1side==1 && flag2side==1 && flag3side==1 && flag4side==1 && flag5side==1:titletext[format["West Has Taken All The Flags\n10 Bonus Points For West"],"PLAIN DOWN"]
_flag SetFlagOwner objnull
?flag1side==1 && flag2side==1 && flag3side==1 && flag4side==1 && flag5side==1:goto "westall"
?(local Server):WestScore=WestScore+1
?EastScore==0:goto "loop"
?(local Server):EastScore=EastScore-1
goto "loop"

#eastflag
_flag SetFlagSide east
_flag SetFlagTexture "\Flags\Russia.jpg"
PlaySound "UCapture"
titletext[format["%1 Has Taken %2 For The East",name flagowner _flag,_flagnname],"PLAIN DOWN"]
?flag1side==2 && flag2side==2 && flag3side==2 && flag4side==2 && flag5side==2:titletext[format["East Has Taken All The Flags\n10 Bonus Points For East"],"PLAIN DOWN"]
_flag SetFlagOwner objnull
?flag1side==2 && flag2side==2 && flag3side==2 && flag4side==2 && flag5side==2:goto "eastall"
?(local Server):EastScore=EastScore+1
?WestScore<=0:goto "loop"
?(local Server):WestScore=WestScore-1
goto "loop"

#Westall
?(local Server):WestScore=WestScore+10
?EastScore==0:goto "loop"
?(local Server):EastScore=EastScore-1
goto "loop"

#Eastall
?(local Server):EastScore=EastScore+10
?WestScore==0:goto "loop"
?(local Server):WestScore=WestScore-1
goto "loop"

#FlagDead
titletext[format["Nobody Has %1",_flagnname],"PLAIN DOWN"]
_flag SetFlagSide RESISTANCE
_flag SetFlagOwner objnull
_flagside=0
goto "loop"

#error
_flag SetFlagSide RESISTANCE
_flag SetFlagOwner objnull
_flagside=0
goto "loop"

now to run that i use
[flag1,"Flag 1"] exec "loop.sqs"
[flag2,"Flag 2"] exec "loop.sqs"
and so on in my init.sqs file

anyone know why it dose not work on everyones computer 100% of the time?

cheers, Philly
« Last Edit: 31 Aug 2004, 16:53:59 by CopyrightPhilly »

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Works Somtimes but not Others...
« Reply #1 on: 31 Aug 2004, 18:28:44 »
Try adding a 1 sec delay on the first line of the script. Sometimes init launched scripts start funny in MP.  ???
Not all is lost.

CopyrightPhilly

  • Guest
Re:Works Somtimes but not Others...
« Reply #2 on: 08 Sep 2004, 03:39:31 »
ok i fixed it...

now i would like this topic to say here so if anyone else has this problem its easy fixed.

The porblem is if u look at this...

Code: [Select]
#loop
?not isnull flagowner _flag and side (flagowner _flag)==west:goto "westflag"
?not isnull flagowner _flag and side (flagowner _flag)==east:goto "eastflag"
?not isnull flagowner _flag and not alive (flagowner _flag):goto "FlagDead"
?not isnull flagowner _flag and side (flagowner _flag) !=WEST and side (flagowner _flag) !=EAST:goto "Error"
~1
goto "loop"

it has a 1 second delay at the end before it will loop, now lets say a players computer was running 0.5 seconds behind the other players it would still be checking if 0.5 seconds later, so if a player changes the flag within them 0.5 seconds it would goto were ever and then change the flag owner to objnull... so nxt time anyone elses loop starts it will not detect that the flag has been changed... so if ur sick of reading my shit that proberly means nothing to the rest of u then heres how to fix it.

before the code changes the flag owner to objnull put a ~1 delay above it...

example
Code: [Select]
_flag SetFlagOwner objnullto
Code: [Select]
~1
_flag SetFlagOwner objnull

cheers, Philly