Home   Help Search Login Register  

Author Topic: Flag Carrier penalty  (Read 777 times)

0 Members and 1 Guest are viewing this topic.

monoloth69

  • Guest
Flag Carrier penalty
« on: 02 Jan 2004, 10:10:56 »
I am using a bombing range as a CTF area, and I want to have a timer attatched to the flag carrier for each side.
When a west/east player takes the opposing flag, lets say he has 3 mins to get the flag back to score.  If he goes over the alloted time, I want to camcreate an HE round to target him and blow him up.  Sort of a penalty for hiding with the flag, or just being slow.  Now I know that things can be cam-created, but i need the scripting help in order to make this all work.  Can anyone plz show me how to do this?  I would be very grateful.

monoloth69

  • Guest
Re:Flag Carrier penalty
« Reply #1 on: 02 Jan 2004, 19:35:47 »
I find it hard to believe that no one can help me with this???

Offline Burn

  • Members
  • *
Re:Flag Carrier penalty
« Reply #2 on: 02 Jan 2004, 20:57:29 »
ripped from Johan Gustafsson's Scripting Tutorial (v. 2.0)
=====================================================
Countdown.sqs
=====================================================
Code: [Select]
; Get the different passed data
_timeleft = _this select 0
_caption = _this select 1
_location = _this select 2
_script = _this select 3

#Update
; Wait 1 second
~1

; Decrease the timer
_timeleft = _timeleft - 1

; Check whether the time is 0
? (_timeleft == 0) : goto "Done"

; Show the time left
TitleText [format [_caption + " %1", _timeleft], _location]
goto "Update"

#Done
; Execute the script
[] exec _script
exit
=====================================================

syntax:
Code: [Select]
[10, "Time Left:", "plain", "hello.sqs"] exec "countdown.sqs"
...Where 10 is the time in seconds left, "Time Left:" is a text explanation shown in game, "plain" means that the text will be shown in the middle of the screen and "hello.sqs" is the script that is executed when the counter runs out of digits...


To camcreate:

LGB="laserguidedbomb" camcreate [(getpos loon select0),(getpos loon select 1),0]
or...
LGB="laserguidedbomb" camCreate getpos gameLogic_1
Quote
In multiplayer, camCreated objects are only visible locally (meaning they are client-side effects).  In 1.90+, createVehicle is a valid replacement (with special consideration to locality).
« Last Edit: 02 Jan 2004, 21:20:30 by Bizon »

monoloth69

  • Guest
Re:Flag Carrier penalty
« Reply #3 on: 03 Jan 2004, 02:08:24 »
ok, got the tut, i understand the timer sqs, however.............
how do i make it so that when a flag is taken, the timer starts, and when the timer reaches 0, an HE round is camcreated and targets the flag carrier and he is blown off the planet.
If the flag carrier scores before timer reaches 0, the timer resets waiting for the next flasg to be taken.  How can it be used to watch both flags since they can be taken within seconds of each other?

monoloth69

  • Guest
Re:Flag Carrier penalty
« Reply #4 on: 03 Jan 2004, 23:17:18 »
well well.....looks like i have stumped OPEC...............thanks for trying,

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Flag Carrier penalty
« Reply #5 on: 04 Jan 2004, 06:58:12 »
Make yourself a couple of triggers like so:

Carrying flag detection trigger

Radius: 0,0
Condition: none (repeatedly)
Condition Field: flagowner flag == player
Onactivation Field: [10, ?Time Left:?, ?plain?, ?hello.sqs?] exec ?countdown.sqs?

Then modify the countdown.sqs at the end to look something like this:

Code: [Select]
...
TitleText [format [_caption + " %1", _timeleft], _location]
? (flag player != Objnull) and (_timeleft > 0):  goto "Update"

#Done
? (flag player != Objnull): _boom = "grenade" createvehicle (getpos player)
exit

Try that and see if you get any joy ;)

monoloth69

  • Guest
Re:Flag Carrier penalty
« Reply #6 on: 05 Jan 2004, 06:46:34 »
by making some modifications to karillions CTF.sqs, we were able to come up with a superb solution.  It includes a timer counting down from whatever u want, then it cam creates anything from a maverick to a nuke on the soldier carrying the flag.  All this is done while it says on the screen that time is running out, like i siad, works GREAT!!!
BTW, in the notes it credit was given to Karillion for the script, and noted to the effect that it was modified.

I consider this topic solved, but i can send the modified script to anyone that wishes to take a look at it, just give me an IM here at the forum