OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: AlexZ on 21 Apr 2009, 18:58:50
-
Hello,
I am trying to indicate a grid on the terrain, I thought for now I could indicate each point of the grid by spawning a small object like a traffic cone for example. So I guess this is a two part question, how do I spawn a structure/object in real time, and how do I get the height of the terrain for the objects z position.
Thank you.
-
Use the createVehicle command (http://www.ofpec.com/COMREF/index.php?action=details&id=86).
You don't need a z dimension for objects that will be on the ground. Also note Spooner's comment: if the created object collides with another, the game engine will place it somewhere nearby.
Have a go with the following:
Start creating a new mission in the mission editor.
Place yourself as a soldier named dude.
Create a trigger, activated by Radio Alpha, repeatedly, and write the following in the On Activation line:
[] exec "barrel_square.sqs"
_firstbarrel = "Barrel1" createVehicle [(getPos dude select 0) - 5, (getPos dude select 1) - 5]
_secondbarrel = "Barrel1" createVehicle [(getPos dude select 0) - 5, (getPos dude select 1) + 5]
_thirdbarrel = "Barrel1" createVehicle [(getPos dude select 0) + 5, (getPos dude select 1) - 5]
_fourthbarrel = "Barrel1" createVehicle [(getPos dude select 0) + 5, (getPos dude select 1) + 5]
exit
Preview the mission. Every time you call Radio Alpha, you will find yourself in the centre of a ten-metre square marked by barrels.
P.S. Are you sure this is related to OFP, because I don't quite understand your other question (http://www.ofpec.com/forum/index.php?topic=33290.0)? Are the two topics somehow related?
-
Thank you very much for the solution. This is actually for VBS2, but those forums are not as active as the mod community forums, I thought I would try my luck here.
I will update my other post to clarify the question.
Thanks,
Alex