[CSM] Fixing the CTF flag object so it doesn't fall through meshes

Ask questions, discuss ideas, get answers

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

Postby Classical Modder » Tue Jun 11, 2019 6:28 pm

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



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.
{SoH} Clan Leader // http://sohclan.forumotion.com/
See my Strasbourg map project here.
GSC: diamondback67
Steam: diamondback67
Classical Modder
Posts: 473
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada


Return to 1942 Modding Discussion

Who is online

Users browsing this forum: No registered users and 14 guests