PDA

View Full Version : Issue with flag return on players death.



[SoF]Max
Dec 22 2006, 05:52
I thought I had this set right but it just sits on a dead players body. East and West

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">expCond=&#34;HasflagW AND &#33;&#40;alive flagownerWflag&#41;&#34;;
expActiv=&#34;EastFlagRun=false; Wflag setFlagOwner objNull; HasflagW=false; titletext&#91;&#34;&#34;The SLA flag was returned&#34;&#34;,&#34;&#34;Plain down&#34;&#34;&#93;&#34;;
class Effects[/QUOTE]

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">expCond=&#34;HasflagE AND &#33;&#40;alive flagownerEflag&#41;&#34;;
expActiv=&#34;WestFlagRun=false; Eflag setFlagOwner objNull; HasflagE=false; titletext&#91;&#34;&#34;The US flag was returned&#34;&#34;,&#34;&#34;Plain down&#34;&#34;&#93;&#34;;
class Effects[/QUOTE]



Any suggestions?

[SoF]Max
Dec 26 2006, 00:00
Max @<hidden> Dec. 22 2006,07:52)]I thought I had this set right but it just sits on a dead players body. East and West

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">expCond=&#34;HasflagW AND &#33;&#40;alive flagownerWflag&#41;&#34;;
expActiv=&#34;EastFlagRun=false; Wflag setFlagOwner objNull; HasflagW=false; titletext&#91;&#34;&#34;The SLA flag was returned&#34;&#34;,&#34;&#34;Plain down&#34;&#34;&#93;&#34;;
class Effects

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">expCond=&#34;HasflagE AND &#33;&#40;alive flagownerEflag&#41;&#34;;
expActiv=&#34;WestFlagRun=false; Eflag setFlagOwner objNull; HasflagE=false; titletext&#91;&#34;&#34;The US flag was returned&#34;&#34;,&#34;&#34;Plain down&#34;&#34;&#93;&#34;;
class Effects[/QUOTE]



Any suggestions?[/QUOTE]
Anyone?

[DirTyDeeDs]-Ziggy-
Dec 26 2006, 15:03
well I have the will to help , I just lack the knowledge http://forums.bistudio.com/oldsmileys/confused_o.gif

I have opened up an OFP map and looked at a CTF script made by Karrilion, which has flag return included. Perhaps what you seek is in the script. I hope this helps. Of course, the names for my flag images will be different than yours...


Quote[/b] ];;CTF script by KaRRiLLioN
;;This selects the flag&#39;s name
;;Exec this from init.sqs like so:
;;[FlagW]exec "CTF.sqs"
;;do this for each flag

_flag = _this select 0
?(isnull _flag):goto "end"

;;The following simply sets the textures on the flags and can be
;;changed to whatever you want. You could actually
;;remove the ?(_flag==FlagW) and instead just put in
;;FlagW SetFlagTexture "&#92;Flags&#92;Nato.jpg and do the same
;;for each one.

?(_flag==FlagW):_flag setflagtexture "&#92;Flags&#92;Nato.jpg"
?(_flag==FlagE):_flag setflagtexture "&#92;Flags&#92;Ussr.jpg"
?(_flag==FlagR):_flag setflagtexture "&#92;Flags&#92;Pirates.jpg"

;;This just creates a name for when the flag is taken or
;;capped or dropped.

?(_flag==FlagW):_flagname="the NATO Flag"
?(_flag==FlagE):_flagname="the Soviet Flag"
?(_flag==FlagR):_flagname="the Resistance Flag"

;;This inits the flagside for each flag.

?(_flag==FlagW):_flag SetFlagSide WEST
?(_flag==FlagE):_flag SetFlagSide EAST
?(_flag==FlagR):_flag SetFlagSide RESISTANCE

;;this sets the flag owner to nobody

_flag setFlagOwner objNull


#start
~1
_flagowner=Flagowner _flag
?(isnull _flagowner):Goto "start"

?(Side _flagowner==WEST):_team="NATO"; _flagownerside=WEST
?(Side _flagowner==EAST):_team="Soviets"; _flagownerside=EAST
?(Side _flagowner==RESISTANCE):_team="Resistance"; _flagownerside=RESISTANCE
?&#33;(Alive _flagowner):Goto "DeadHasFlag"

#FlagTaken


#DelayLoop
~1
_delay=_delay-1
?(&#33;Alive _flagowner):goto "DeadHasFlag"
?(_delay>0):Goto "DelayLoop"




Goto "loop"

;;the loop continues to check for whether the flagcarrier is
;;dead, or has capped the flag. Once either happens, the
;;flag is returned

#loop
~1
?(&#33;Alive _flagowner):goto "DeadHasFlag"
?(isnull Flagowner FlagW) and _flagownerside==WEST and _flagowner distance FlagW<5:goto "WCaps"
?(isnull Flagowner FlagE) and _flagownerside==EAST and _flagowner distance FlagE<5:goto "ECaps"
?(isnull Flagowner FlagR) and _flagownerside==RESISTANCE and _flagowner distance FlagR<5:goto "RCaps"

Goto "loop"

;;this increments the score by 1 point for whichever team
;;caps the flag. You can change the +1 to +5 or whatever
;;you want for a scoring method. The ?(local Server)
;;makes sure the score is only incremented by the server
;;so that it remains accurate.

#WCaps


Goto "ShowScore"

#ECaps


Goto "ShowScore"

#RCaps


Goto "ShowScore"

#ShowScore
?(local Server):ShowScore=true; PublicVariable "ShowScore"

Goto "FlagReturn"

;;if flagcarrier dies, this resets the flag immediately to the
;;flagpole. You can delay this by any time you want by
;;adding a value in seconds just before where it says
;;goto "FlagReturn"

#DeadHasFlag




;;~60 If you remove the
;; then the ~60 will delay the flag
;;returning to the flagpole by 60 seconds. I leave this off
;;because sometimes someone will try to cap a flag that
;;is on a body and not get there before 60 seconds and the
;;flag disappears on them.


#FlagReturn
?(_flag==FlagW):_flag SetFlagSide WEST
?(_flag==FlagE):_flag SetFlagSide EAST
?(_flag==FlagR):_flag SetFlagSide RESISTANCE

_flag setFlagOwner objNull

Hint _flagreturnmsg

Goto "start"

#end
Exit

;;;;END of CTF.SQS

KaRRiLLioN
Dec 26 2006, 17:03
Ah, reminds me of the original OFP days of working out BIS&#39;s CTF with bloody triggers. Gah&#33;

That script Ziggy posted will work, but it&#39;s an old version of my CTF script. I&#39;ve discovered a few bugs that happen with JIP so I&#39;m gonna rejigger my script to account for those anomolies. I also have a newer version with dynamic variables.

That script will still work. Just place your flags on the map and follow the instructions in the comments of the script.