Home   Help Search Login Register  

Author Topic: I need some great minds for my script, HELP!!!  (Read 774 times)

0 Members and 2 Guests are viewing this topic.

Cap

  • Guest
I need some great minds for my script, HELP!!!
« on: 26 Feb 2005, 07:02:07 »
ok i made this script for a 3 team CTF it works great, except for a slight hitch which i will be able to overcome but it means sacrificing part of the game, i will say more on this in a minute.

firstly here is the script...

Code: [Select]

westscore = 0
eastscore = 0
resiscore = 0

flagW setflagtexture "usa_vlajka.pac"
flagW setflagside west
flagE setflagtexture "rus_vlajka.pac"
flagE setflagside east
flagR setflagtexture "white.pac"
flagR setflagside resistance

westhaveeast = false
westhaveresi = false
easthavewest = false
easthaveresi = false
resihavewest = false
resihaveeast = false

ehw = false
rhw = false
whe = false
rhe = false
whr = false
ehr = false

westflagdeadcount = 0
eastflagdeadcount = 0
resiflagdeadcount = 0

timer = 0

#loop
~1
timer = timer + 1
westflagowner = flagowner flagW
eastflagowner = flagowner flagE
resiflagowner = flagowner flagR
?(alive westflagowner): westflagdeadcount = 0
?(alive eastflagowner): eastflagdeadcount = 0
?(alive resiflagowner): resiflagdeadcount = 0
?(side westflagowner == east) AND (!ehw) AND (alive westflagowner): goto "easthavewest"
?(side westflagowner == resi) AND (!rhw) AND (alive westflagowner): goto "resihavewest"
?(side eastflagowner == west) AND (!whe) AND (alive eastflagowner): goto "westhaveeast"
?(side eastflagowner == resi) AND (!rhe) AND (alive eastflagowner): goto "resihaveeast"
?(side resiflagowner == west) AND (!whr) AND (alive resiflagowner): goto "westhaveresi"
?(side resiflagowner == east) AND (!ehr) AND (alive resiflagowner): goto "easthaveresi"
?(side westflagowner == east) AND (westflagowner distance flagE < 5): goto "eastcapturewest"
?(side westflagowner == resi) AND (westflagowner distance flagR < 5): goto "resicapturewest"
?(side eastflagowner == west) AND (eastflagowner distance flagW < 5): goto "westcaptureeast"
?(side eastflagowner == resi) AND (eastflagowner distance flagR < 5): goto "resicaptureeast"
?(side resiflagowner == west) AND (resiflagowner distance flagW < 5): goto "westcaptureresi"
?(side resiflagowner == east) AND (resiflagowner distance flagE < 5): goto "eastcaptureresi"
?(side westflagowner == east) AND (westflagowner distance flagR < 5): flagW setflagowner flagW; flagW setflagside west; titleText [format["The West flag is back"], "PLAIN DOWN"]; easthavewest = false; resihavewest = false
?(side westflagowner == resi) AND (westflagowner distance flagE < 5): flagW setflagowner flagW; flagW setflagside west; titleText [format["The West flag is back"], "PLAIN DOWN"]; easthavewest = false; resihavewest = false
?(side eastflagowner == west) AND (eastflagowner distance flagR < 5): flagE setflagowner flagE; flagE setflagside east; titleText [format["The East flag is back"], "PLAIN DOWN"]; westhaveeast = false; resihaveeast = false
?(side eastflagowner == resi) AND (eastflagowner distance flagW < 5): flagE setflagowner flagE; flagE setflagside east; titleText [format["The East flag is back"], "PLAIN DOWN"]; westhaveeast = false; resihaveeast = false
?(side resiflagowner == west) AND (resiflagowner distance flagE < 5): flagR setflagowner flagR; flagR setflagside resistance; titleText [format["The Resistance flag is back"], "PLAIN DOWN"]; westhaveresi = false; easthaveresi = false
?(side resiflagowner == east) AND (resiflagowner distance flagW < 5): flagR setflagowner flagR; flagR setflagside resistance; titleText [format["The Resistance flag is back"], "PLAIN DOWN"]; westhaveresi = false; easthaveresi = false
?(!alive westflagowner AND easthavewest) OR (!alive westflagowner AND resihavewest) OR (!alive eastflagowner AND westhaveeast) OR (!alive eastflagowner AND resihaveeast) OR (!alive resiflagowner AND westhaveresi) OR (!alive resiflagowner AND easthaveresi): goto "ppldeadaroundhere"
goto "loop"

#easthavewest
titleText [format["%1 (East) takes the West flag", name westflagowner], "PLAIN DOWN"]
easthavewest = true
ehw = true
playsound "UCapture"
goto "loop"

#resihavewest
titleText [format["%1 (Resistance) takes the West flag", name westflagowner], "PLAIN DOWN"]
resihavewest = true
rhw = true
playsound "UCapture"
goto "loop"

#westhaveeast
titleText [format["%1 (West) takes the East flag", name eastflagowner], "PLAIN DOWN"]
westhaveeast = true
whe = true
playsound "UCapture"
goto "loop"

#resihaveeast
titleText [format["%1 (Resistance) takes the East flag", name eastflagowner], "PLAIN DOWN"]
resihaveeast = true
rhe = true
playsound "UCapture"
goto "loop"

#westhaveresi
titleText [format["%1 (West) takes the Resistance flag", name resiflagowner], "PLAIN DOWN"]
westhaveresi = true
whr = true
playsound "UCapture"
goto "loop"

#easthaveresi
titleText [format["%1 (East) takes the Resistance flag", name resiflagowner], "PLAIN DOWN"]
easthaveresi = true
ehr = true
playsound "UCapture"
goto "loop"

#eastcapturewest
eastscore = eastscore + 1
flagW setflagowner flagW; flagW setflagside west
titleText [format["%1 (East) captures the West flag\nWest - %2\nEast - %3\nResistance - %4", name westflagowner, westscore, eastscore, resiscore], "PLAIN DOWN"]
easthavewest = false
resihavewest = false
ehw = false
rhw = false
playsound "UScore"
goto "loop"

#resicapturewest
resiscore = resiscore + 1
flagW setflagowner flagW; flagW setflagside west
titleText [format["%1 (Resistance) captures the West flag\nWest - %2\nEast - %3\nResistance - %4", name westflagowner, westscore, eastscore, resiscore], "PLAIN DOWN"]
easthavewest = false
resihavewest = false
ehw = false
rhw = false
playsound "UScore"
goto "loop"

#westcaptureeast
westscore = westscore + 1
flagE setflagowner flagE; flagE setflagside east
titleText [format["%1 (West) captures the East flag\nWest - %2\nEast - %3\nResistance - %4", name eastflagowner, westscore, eastscore, resiscore], "PLAIN DOWN"]
westhaveeast = false
resihaveeast = false
whe = false
rhe = false
playsound "UScore"
goto "loop"

#resicaptureeast
resiscore = resiscore + 1
flagE setflagowner flagE; flagE setflagside east
titleText [format["%1 (Resistance) captures the East flag\nWest - %2\nEast - %3\nResistance - %4", name eastflagowner, westscore, eastscore, resiscore], "PLAIN DOWN"]
westhaveeast = false
resihaveeast = false
whe = false
rhe = false
playsound "UScore"
goto "loop"

#westcaptureresi
westscore = westscore + 1
flagR setflagowner flagR; flagR setflagside resistance
titleText [format["%1 (West) captures the Resistance flag\nWest - %2\nEast - %3\nResistance - %4", name resiflagowner, westscore, eastscore, resiscore], "PLAIN DOWN"]
westhaveresi = false
easthaveresi = false
whr = false
ehr = false
playsound "UScore"
goto "loop"

#eastcaptureresi
eastscore = eastscore + 1
flagR setflagowner flagR; flagR setflagside resistance
titleText [format["%1 (East) captures the Resistance flag\nWest - %2\nEast - %3\nResistance - %4", name resiflagowner, westscore, eastscore, resiscore], "PLAIN DOWN"]
westhaveresi = false
easthaveresi = false
whr = false
ehr = false
playsound "UScore"
goto "loop"

#ppldeadaroundhere
?(!alive westflagowner AND easthavewest) OR (!alive westflagowner AND resihavewest): westflagdeadcount = westflagdeadcount + 1; ehw = false; rhw = false;
?(!alive eastflagowner AND westhaveeast) OR (!alive eastflagowner AND resihaveeast): eastflagdeadcount = eastflagdeadcount + 1; whe = false; rhe = false
?(!alive resiflagowner AND westhaveresi) OR (!alive resiflagowner AND easthaveresi): resiflagdeadcount = resiflagdeadcount + 1; whr = false; ehr = false
?(westflagdeadcount >= 15): flagW setflagowner flagW; flagW setflagside west; titleText [format["The West flag is back"], "PLAIN DOWN"]; easthavewest = false; resihavewest = false
?(eastflagdeadcount >= 15): flagE setflagowner flagE; flagE setflagside east; titleText [format["The East flag is back"], "PLAIN DOWN"]; westhaveeast = false; resihaveeast = false
?(resiflagdeadcount >= 15): flagR setflagowner flagR; flagR setflagside resistance; titleText [format["The Resistance flag is back"], "PLAIN DOWN"]; westhaveresi = false; easthaveresi = false
goto "loop"


Like i said this script works fine except for one small detail which is...

when a unit takes the flag and then dies, you are able to pick up the flag and score aslong as you pick it up before 15 seconds, it will say both of the players names who have the flag when they take it, and you are able to score and the game will carry on fine but...

when a player takes the flag and then dies, then another player takes the flag and then dies, the script seems to grind to a virtual hault but it still goes round the #loop 'loop' but it wont go anywhere else lol, you can pick the flag up from the 2nd deceased but it wont say that you have and you are unable to score.

this is my problem because in a game this sequence of events is not unlikely, and if the game stops there it will be quite bad!

i have only tested this with west as the players side all 3 and taking the resistance flag, i had 2 AIs to 'give' the flag to and subsequently kill for the purposes of my cyber experiment! *lol i just wanted to talk like that then for some reason lol*

if you could find the time to look at this i would be more than greatful as there seems to be a severe lack of game modes for ofp that support more than 2 teams, all you need is to make a map with 3 flags flagW, flagE and flagR start the script by whatever means and test away lol.

thankyou very much in advance you lovely lot of people.

also when this script is finished we can store it on this site for all to see, then soon there will be lots of 3 team CTFs YES!!! (its my dream, make it yours) *lol i just wanted to say that then aswell lol, silly me*

Also one thing i forgot to say was to overcome this i thought it would be possible to cut out the time delay of returning the flag when a flag carrier dies if when they died we just returned it straight away and reset all the variables i think that would do it cos it would be alot simpler. But this is not what we want cos the time delay is part of the game so i think people would like to see it there.

Aww c**p 2 more things i forgot to say lol 1st its not playing the sounds this is a very simple one probably a simple mistake cos i guessed at how to make em lol (and yes they are defined in the description.ext and i have them in a folder called "Sound", 2nd i have not tested what happens when a player returns their own flag by going up to a deceaced body, its meant to say ..... flag was returned but this is not proven lol.

ok thats it (i hope) a bit big i know lol, sorry

Cap

  • Guest
Re:I need some great minds for my script, HELP!!!
« Reply #1 on: 26 Feb 2005, 21:53:24 »
hmmm people seem not to want to help me tackle this one lol, i think its because the script looks long and complicated, dont worry its actually very simple, it works by going round the main 'loop' and waits for a change in state of any of the flags, when the state changes the script goes to the relevant place to change some variables and display messages depending on what has happened.  Ok i will describe a little of what each variable is used for so you dont have to figure it out for yourselves.

westscore, eastscore, resiscore ... used to keep track of the scores (obviosly lol ill start with the easy ones).

westhaveeast, easthavewest, resihavewest etc ... these are used for keeping track of who has what flag but will still be true when the flagcarrier is dead and will only be false when the flag is on the pole or being carried by an opposing team.

ehw, whe, rhe, rhw etc ... these are very similar to the easthavewest etc... variables except for one crutial difference that is that they will be false when the flag carrier is dead, which means we are able to destinguish if the flag carrier is not alive and ofcourse not the flagpole its self cos the flag pole (if it is the flagcarrier) returns that the flag carrier is dead, not good because we get messages every second telling us that the flags have been returned.

westdeadcount, eastdeadcount, resideadcount ... these are used to time how long the particular flag carrier has been dead for so we are able to delay the time period that a flag will remain with a dead body before it is returned.

;)  i really want to get this script done cos there are no 3 team CTF games (atleast that i have seen) and i think it will really spice things up i think, i really dont want to remove the delay for flag returnation  :-\ (is that a word lol) to solve the problem cmon guys this will benefit us all and we can all put our names to it :D i can share the glory lol. Just copy/paste the script to notepad so you can see it better and if it helps put 3 flags flagW, flagE and flagR in the editor and have a fiddle (with the script you dirty minded people  ;) )

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:I need some great minds for my script, HELP!!!
« Reply #2 on: 27 Feb 2005, 02:29:17 »
I had a long (~20 minutes) look over this last night, and the reason i didnt post was because I honestly couldn't find anything wrong with it. Now that may have just been because I was tired.

I think its a cool idea, but i would seriously recommend simplifying the script if possible. If you like I could try and see if we could do that.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:I need some great minds for my script, HELP!!!
« Reply #3 on: 27 Feb 2005, 02:49:27 »
Fragorl, I take my hat off to you.   It's people like you that make not only this forum, but the world go round.    It's not just the devoting 20 minutes to trying to help somebody, but that at the end you had nothing intelligent to post so you posted nothing.     I wish more people were like that.
« Last Edit: 27 Feb 2005, 02:50:34 by macguba »
Plenty of reviewed ArmA missions for you to play

Cap

  • Guest
Re:I need some great minds for my script, HELP!!!
« Reply #4 on: 27 Feb 2005, 03:21:15 »
haa haha lol, i can post lots of nothingness but im too busy doing pointlessness at the moment.  :D

Wow thankyou fragorl, cool lol for a minute there i thought no one cared  :'( lol :D im so happy, ive spent a whole 2 days going over switching round this script and im near suicide  :-\ (not really incase you are worried), i cant find anything wrong with it either it just seems to giveup after a couple of flagcarriers die, seems odd cos im sure i reset all variables that should be reset and all of that but no matter how i split the script up i still get the same problem which leads me to the conclusion that maybe it is my machine  :-\ can you tell me if you get the same problems with the script on your comp? cos u said u cant find anything wrong with it im wondering if you just looked at it or you tried it.

ok ya simplifying this is something ive looked at but the only thing i can come up with is putting all the commands for (for example) #westcaptureeast in the loop where it says goto "westcaptureeast" this will keep everything inside the loop because at the moment the drawback is that if there is lots of changes in flag states in quick succession you have to wait ~1 untill the script will recognise each (as in there is a ~1 between each state change being recognised) if these happen quick enough the script could 'spaz out' because variables wouldnt of been changed in time, my thoughts about solving this was like i said to move all commands within the 'loop' or make the delay ~0.01 or something.

If you or anyone wants to play around with it i would be more than greatful as my aim is to just get the script made (with no bugs lol) and have loads of you guys and myself start making 3 team CTFs using the script, mainly because i really want to play 3 team CTFs online (lol very selfish!).

Oh yeah also i said that it wasnt playing the noises but they are playing now so i must not have had the speakers turned on or something! lol so that is not a problem, its just when flag carriers die that problems arise, the script copes fine with one flagcarrier dying but when a second dies it just gives up (not litterally cos the script still goes round the loop but it seems to stop recognising the westflagcarrier, eastflagcarrier and resiflagcarrier variables)

Once again thankyou for your help fragorl and feel free anyone to gut this script cos im baffled!

Cheeres

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:I need some great minds for my script, HELP!!!
« Reply #5 on: 27 Feb 2005, 04:44:31 »
Cheers, MacGuba :)

Cap: I only looked at it, however i'll try it now and see. I have an idea for simplifying it using a couple of functions, or, if thats not satisfactory, the beginnigs of another idea.

Cap

  • Guest
Re:I need some great minds for my script, HELP!!!
« Reply #6 on: 27 Feb 2005, 04:47:30 »
 ;D thanks for your help

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:I need some great minds for my script, HELP!!!
« Reply #7 on: 27 Feb 2005, 05:40:40 »
K, ive built myself a mini ctf but havent done any ai scripting. I was able to take the east or resistance flag ok, top myself, take the flag and repeat this process as many times as i liked and still be able to score/be notified that i'd taken the flag.

Once I took the res flag to the east just to see what would happen. The flag simply retuned back to the east. I picked it up again; no message that i'd picked it up this time, but i was still able to kill myself then score.

Was your prob happening all or just some of the time? can u give the details of your ai script as well?

Cap

  • Guest
Re:I need some great minds for my script, HELP!!!
« Reply #8 on: 27 Feb 2005, 05:52:39 »
i didnt use ai scripts just 2 triggers and 2 AIs (west1 and west2), triggers were activated by the radio alpha and bravo repeatedly and on activation flagR setflagowner west1 and flagR setflagowner west2, i was sure to kill the one of the AIs before activating other trigger.
« Last Edit: 27 Feb 2005, 05:53:51 by Cap »

Cap

  • Guest
Re:I need some great minds for my script, HELP!!!
« Reply #9 on: 27 Feb 2005, 06:01:15 »
when you took the resi flag to the east flag did a msg come up saying the resi flag was returned? cos your not meant to be able to do the leg work for other teams lol it just returns and displays a msg resi flag was returned.

Ya i only seemed to get the problem when 2 people had taken the flag (off each other) without it being returned it seemed you were unable to score or return it by going to the wrong flag, it not working after you return it by going to the wrong flag is new to me that always worked ok.

ok gotta sleep now lol ill be back after a few Zs
« Last Edit: 27 Feb 2005, 06:03:23 by Cap »

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:I need some great minds for my script, HELP!!!
« Reply #10 on: 27 Feb 2005, 06:26:47 »
yes it came up with a 'flag returned' message - no scoring change.

Cap

  • Guest
Re:I need some great minds for my script, HELP!!!
« Reply #11 on: 27 Feb 2005, 06:40:44 »
yes thats correct when you take the flag to the wrong pole (being the flagpole of the enemy that you dont have the flag of) it is returned with no score change thats whats meant to happen. ;D thats ok then *phew* lol

and one thing i forgot to do was make it so you can only return a flag to score when your flag is on its pole, this will be really simple to fix though but dont forget about it anyone cos im not gonna fix it yet cos i gotta get to sleep lol (still havent got there yet) *zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz*