Page 4 of 4

Re: Fixing the CTF flag object so it doesn't fall through me

Posted: Tue Jun 11, 2019 6:28 pm
by Diamondback
I've been playing around with different scripts to force the game to move the flag above ground level. So far it seems that the best way to go would be to use variables and conditional statements to tell the flag object to stay at a position, along the Y-Axis, that is high enough so that players can pick up a dropped flag even if it fell on the floor of a mesh such as a building. This is the code I've been testing this morning, in CTF Berlin. Comments are in the code following rem statements.

rem *Declare variables*
Var v_pos
Var v_pos2
Var v_ycoord
rem *Activate the CTF flag we want to test, GermanFlag*
objectTemplate.active GermanFlag
rem *Assign it's absolute position to a variable that we already defined*
object.absolutePosition -> v_pos
rem *Add 5 vertical BF units to v_pos and assign the new position to a variable called v_pos2*
Utils.mathExprV3 v_pos + 0/5/0 -> v_pos2
rem *Get the vertical coordinate (Y) of v_pos and assign it to a variable called v_ycoord, a float*
Utils.getV3Y v_pos -> v_ycoord

rem *if the value of v_ycoord is smaller than 40 vertical units, we assign the new position (v_pos2) to the old position (v_pos) of GermanFlag. In other words, we add 5 vertical units to v_pos, no matter what v_pos is*
if v_ycoord < 40

objectTemplate.active GermanFlag
objectTemplate.setPosition v_pos2

else

endIf


I've tested the code on my own and the console doesn't spit out any errors. So the code is clean, but I haven't been able to have the flag drop position be displaced by 5 vertical units. I will keep testing.

I would need a second person to help me test this to see if the new drop position is indeed 5 units above the ground or not. If anyone wants to volunteer to do this, please let me know.

Re: Fixing the CTF flag object so it doesn't fall through me

Posted: Fri Nov 15, 2019 2:02 am
by Crash
I'd just build the terrain up under the building (a closed building players cant enter for obvious reasons)so the flag doesnt fall through? Im not a coder so thats all I can suggest lol

Re: Fixing the CTF flag object so it doesn't fall through me

Posted: Wed Mar 11, 2020 9:18 pm
by Diamondback
Well that kind of goes against the purpose of the code I posted. We want to be able to make a script that prevents the flag from falling through buildings players can go in but also objects like cat walks or bridges.

Re: Fixing the CTF flag object so it doesn't fall through meshes

Posted: Sat Feb 17, 2024 11:31 pm
by Diamondback
Here is the fix: https://github.com/uuuzbf/bf1942-patche ... objects.md

The fix comes from uuuzbf.