Home   Help Search Login Register  

Author Topic: capture and hold script  (Read 1609 times)

0 Members and 1 Guest are viewing this topic.

CopyrightPhilly

  • Guest
capture and hold script
« on: 08 Feb 2005, 05:11:27 »
ok chaps,

Heres my new capture and hold script, its currently made only for one flag but i will be changing that so it can be used for as many flags as i want...

I basicly want to know what improvments/bug fixes you can find...
I do want this script to work in 1.46 so any changes that will need anything higher please make sure you tell me...

flag1.sqs
Code: [Select]
?(local server):totalflags=totalflags+1,publicVariable "totalflags"
flag1 setflagside resistance
flag1 setflagtexture "\Flags\Pirates.jpg"
flag1 setflagowner objnull

#loop
?(local server) && !isnull flagowner Flag1 && side (flagowner Flag1)==west:take1=1,publicVariable "take1"
?(local server) && !isnull flagowner Flag1 && side (flagowner Flag1)==east:take1=2,publicVariable "take1"
?(local server) && !isnull flagowner Flag1 && !alive (flagowner Flag1):take1=3,publicVariable "take1"
?(local server) && !isnull flagowner Flag1 && side (flagowner Flag1) !=WEST && side (flagowner Flag1) !=EAST:take1=4,publicVariable "take1"
~0.1
?take1==1:goto "west"
?take1==2:goto "east"
?take1==3:goto "dead"
?take1==4:goto "sort"
~0.1
goto "loop"

#west
Flag1ownername=name (flagowner Flag1)
?(local server):Flag1Control=1,publicVariable "Flag1Control"
?(local server):westflagcount=westflagcount+1,eastflagcount=eastflagcount-1,publicVariable "westflagcount",publicVariable "eastflagcount"
~0.1
?westflagcount==totalflags:goto "westall"
hint format["%1 has taking Flag 1 for west",Flag1ownername]
titletext[format["%1 has taking Flag 1 for west",Flag1ownername],"plain down"]
playsound "capture"
~1
Flag1 setflagtexture "\flags\nato.jpg"
Flag1 setflagside west
Flag1 setflagowner objnull
?(local server):take1=0,publicVariable "take1"
goto "loop"

#east
Flag1ownername=name (flagowner Flag1)
?(local server):Flag1Control=2,publicVariable "Flag1Control"
?(local server):eastflagcount=eastflagcount+1,westflagcount=westflagcount-1,publicVariable "eastflagcount",publicVariable "westflagcount"
~0.1
?westflagcount==totalflags:goto "eastall"
hint format["%1 has taking Flag 1 for east",Flag1ownername]
titletext[format["%1 has taking Flag 1 for east",Flag1ownername],"plain down"]
playsound "capture"
~1
Flag1 setflagtexture "\flags\russia.jpg"
Flag1 setflagside east
Flag1 setflagowner objnull
?(local server):take1=0,publicVariable "take1"
goto "loop"

#westall
hint format["%1 has taking Flag 1 for west",Flag1ownername]
titletext[format["West have taken all the flags\n10 Bonus points for west"],"plain down"]
playsound "capture"
~1
Flag1 setflagtexture "\flags\nato.jpg"
Flag1 setflagside west
Flag1 setflagowner objnull
?(local server):take1=0,publicVariable "take1"
goto "loop"

#Eastall
hint format["%1 has taking Flag 1 for East",Flag1ownername]
titletext[format["East have taken all the flags\n10 Bonus points for East"],"plain down"]
playsound "capture"
~1
Flag1 setflagtexture "\flags\russia.jpg"
Flag1 setflagside East
Flag1 setflagowner objnull
?(local server):take1=0,publicVariable "take1"
goto "loop"

#dead
?(local server):Flag1Control=0,publicVariable "Flag1Control"
~0.1
Flag1ownername=name (flagowner Flag1)
hint format["%1 got shot when taking Flag 1",Flag1ownername]
~1
Flag1 setflagside resistance
Flag1 setflagtexture "\Flags\Pirates.jpg"
Flag1 setflagowner objnull
?(local server):take1=0,publicVariable "take1"
goto "loop"

#sort
(flagowner Flag1) addRating 10000
?side (flagowner Flag1)==west:goto "west"
?side (flagowner Flag1)==east:goto "east"
~0.1
goto "sort"

init.sqs
Code: [Select]
take1=0
publicVariable "take1"

Flag1Control=0
publicVariable "Flag1Control"

westflagcount=0
eastflagcount=0

publicVariable "westflagcount"
publicVariable "eastflagcount"

totalflags=0
publicVariable "totalflags"

[] exec "flags\flag1.sqs"
exit

cheers

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:capture and hold script
« Reply #1 on: 08 Feb 2005, 10:40:09 »
Instead of, for example,
(flagowner Flag1) !=EAST:take1=4,publicVariable "take1"
you must put
(flagowner Flag1) !=EAST:take1=4;publicVariable "take1"
separating statements with a semicolon.

CopyrightPhilly

  • Guest
Re:capture and hold script
« Reply #2 on: 08 Feb 2005, 17:22:02 »
noted and changed, thanks
« Last Edit: 08 Feb 2005, 17:22:09 by CopyrightPhilly »