Jump to content
Sign in to follow this  
Azz

Check my script

Recommended Posts

I wrote this script's for a sector control game but im not sure about the public variable relationship through all the clients connected and am not sure if this will work can someone take a look for me ?

Init.SQS

[] exec "display.sqs"

WJ1 = "Jeep" createVehicle getPos WJ1R

WJ2 = "Jeep" createVehicle getPos WJ2R

WJ3 = "Jeep" createVehicle getPos WJ3R

EJ1 = "UAZ" createVehicle getPos EJ1R

EJ2 = "UAZ" createVehicle getPos EJ2R

EJ3 = "UAZ" createVehicle getPos EJ3R

ActionAdded=0

HasSector=0

WestScore=0

EastScore=0

Str=""

PublicVariable "Str"

PublicVariable "HasSector"

PublicVariable "WestScore"

PublicVariable "EastScore"

#Loop

?(player Distance theFlag < 5) : goto "ActionA"

?(player Distance theFlag > 5) : goto "ActionB"

goto "Loop"

#ActionA

?(ActionAdded == 0) : goto "AddAction"

goto "Loop"

#ActionB

?(ActionAdded == 0) : goto "loop"

goto "RemoveAction"

#AddAction

?(side player == west && HasSector == 0) : goto "AddActionW"

?(side player == west && HasSector == 1) : goto "Loop"

?(side player == west && HasSector == 2) : goto "AddActionW"

?(side player == east && HasSector == 0) : goto "AddActionE"

?(side player == east && HasSector == 1) : goto "AddActionE"

?(side player == east && HasSector == 2) : goto "Loop"

goto "Loop"

#AddActionW

takeSector=player addAction ["Take Sector Control","sectorW.sqs"]

ActionAdded=1

~1

goto "Loop"

#AddActionE

takeSector=player addAction ["Take Sector Control","sectorE.sqs"]

ActionAdded=1

~1

goto "Loop"

#RemoveAction

ActionAdded=0

player removeAction takeSector

goto "Loop"

sectorW.sqs

[] exec "display.sqs"

HasSector=1

ActionAdded=0

player removeAction takeSector

theFlag setFlagTexture "USA_vlajka.pac"

_Count = 0

#Timer

?(HasSector != 1) : goto "End"

~1

?(HasSector != 1) : goto "End"

_Count = _Count + 1

goto "Update"

#Update

?(_Count == 60) : WestScore = WestScore + 1

?(_Count == 60) : [] exec "display.sqs"

?(_Count == 90) : EastScore = EastScore - 1

?(_Count == 90) : _Count = 0

?(_Count == 90) : [] exec "display.sqs"

goto "Timer"

#End

exit

sectorE.sqs

[] exec "display.sqs"

HasSector=2

ActionAdded=0

player removeAction takeSector

theFlag setFlagTexture "RUS_vlajka.pac"

_Count = 0

#Timer

?(HasSector != 2) : goto "End"

~1

?(HasSector != 2) : goto "End"

_Count = _Count + 1

goto "Update"

#Update

?(_Count == 60) : EastScore = EastScore + 1

?(_Count == 60) : [] exec "display.sqs"

?(_Count == 90) : WestScore = WestScore - 1

?(_Count == 90) : _Count = 0

?(_Count == 90) : [] exec "display.sqs"

goto "Timer"

#End

exit

should that work ?

Share this post


Link to post
Share on other sites

No idea if that'll work (doesn't mean it won't). But I guess it's a lot easier than you think. I've got a simple capture & hold tutorial with mission example and scripts that I could have sent you - if your email-address wasn't hidden.

wink.gif

Dunno where I got that thing from so I can't post a link...

Email me if you want it. From what you wrote I'd say it's  exactly what you need. Greetz!

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Azz @ June 20 2002,00:22)</td></tr><tr><td id="QUOTE">I wrote this script's for a sector control game but im not sure about the public variable relationship through all the clients connected and am not sure if this will work can someone take a look for me ?

Init.SQS

ActionAdded=0

HasSector=0

WestScore=0

EastScore=0

Str=""

PublicVariable "Str"

PublicVariable "HasSector"

PublicVariable "WestScore"

PublicVariable "EastScore"

...

#Loop

....

HasSector=1

....

goto "Loop"

should that work ?<span id='postcolor'>

It will certainly not work. You need to use publicVariable after each variable change to transmit changed value. Check scripting reference for more information.

Share this post


Link to post
Share on other sites

Thank's well i grabbed a freind and tested it and it all went drastically wrong hehe, so i have started from scratch

I will post the script once it's done if you would like to take another look.

I also like to thank you all it's not ofter that people who actually made the game help the people who play it and actually upgrade it and such.

so Thanks biggrin.gif

Share this post


Link to post
Share on other sites

I guess i could just download a script and use it but then i wouldnt be learning anything.

This way i know exactly what my script is doing and I learn more for the next script i create.

Here Goes then

init.sqs

titleCut [" ","BLACK IN", 3]

[] exec sector.sqs

[] exec timer.sqs

sector.sqs

HasSector = 0

ShowScore = 0

WestScore = 0

EastScore = 0

publicVariable "HasSector"

publicVariable "ShowScore"

publicVariable "WestScore"

publicVariable "EastScore"

?(side player == west) : goto "West"

?(side player == east) : goto "East"

#West

?(player Distance theFlag < 5) : goto "AddW"

?(player Distance theFlag > 5) : goto "RemoveW"

#East

?(player Distance theFlag < 5) : goto "AddE"

?(player Distance theFlag > 5) : goto "RemoveE"

#AddW

?(ActionAdded == 1) : goto "West"

?(HasSector == 1) goto "West"

takeSector=player addAction ["Take Sector Control","scoreW.sqs"]

ActionAdded=1

goto "West"

#AddE

?(ActionAdded == 1) : goto "East"

?(HasSector == 2) goto "East"

takeSector=player addAction ["Take Sector Control","scoreE.sqs"]

ActionAdded=1

goto "East"

#RemoveW

?(ActionAdded == 0) : goto "West"

ActionAdded=0

player removeAction takeSector

goto "West"

#RemoveE

?(ActionAdded == 0) : goto "East"

ActionAdded=0

player removeAction takeSector

goto "East"

timer.sqs

_Time = 0

#Timer

~1

_Time = _Time + 1

?(_Time >= Param1) : goto "EndGame"

?(ShowScore == 1) : ShowScores

?(WestScore >= Param2 || EastScore >= Param2) : goto "EndGame"

goto "Timer"

#ShowScores

titleText[format["West: %1 East: %2 ,WestScore,EastScore],"PLAINDOWN"]

ShowScore=0

PublicVariable "ShowScore"

goto "Timer"

#EndGame

GAMEOVER=true

exit

scoreW.sqs

HasSector = 1

publicVariable "HasSector"

player removeAction takeSector

ActionAdded=0

#Loop

~1

_Count = _Count + 1

? !(HasSector == 1) : goto "End"

?(_Count >= 60) : goto "Score"

goto "Loop"

#Score

_Count = 0

WestScore = WestScore + 1

PublicVariable "WestScore"

ShowScore = 1

PublicVariable "ShowScore"

goto "Loop"

#End

exit

scoreE.sqs

HasSector = 2

publicVariable "HasSector"

player removeAction takeSector

ActionAdded=0

#Loop

~1

_Count = _Count + 1

? !(HasSector == 2) : goto "End"

?(_Count >= 60) : goto "Score"

goto "Loop"

#Score

_Count = 0

EastScore = EastScore + 1

PublicVariable "EastScore"

ShowScore = 1

PublicVariable "ShowScore"

goto "Loop"

#End

exit

Although i have a worry or to with this now if 2 people on the same team were to take the sector at relitavely the same time then both of them would be scoring or evan if they were on different teams if a player was lagging they could take the sector before it has been updated by someone else taking it if you follow me.

What are your thoughts ?

Share this post


Link to post
Share on other sites

azz i dig your script, i also want to make a king of the hill type match, unfortunatley all the tutorials for these are less than clear and not working. Maybe we should try to ask suma for more help on these type of maps, because they are as hard as hell to get working right.

Share this post


Link to post
Share on other sites

Well if anyone wants to use my scripts they can i dont mind

I could of easily just done it with flags and flag side and i kno it would work but i dont want to have the take flag thing to happen The Idea of this is the sector is the fountain in La Riviere so you take control of it.

I think this script will work Will just wait to see what Suma or some other scripting genious says.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×