SteveV Posted October 3, 2010 Share Posted October 3, 2010 I put this request in a while ago but i seem to have lost it. I'm still trying to work out if it's possible to programmatically add a road in the editor. I want to create a road several kilometres long with many nodes, and it would be great if I could start by scripting the placement of, for example, 20 nodes in a circle on the terrain. Any ideas anybody? I made an attempt earlier to replicate entities, but they never got saved. Maybe there is something I can do to register the entities/nodes in the saved world file? Quote All the best, Steve Vink Link to comment Share on other sites More sharing options...
SteveV Posted October 3, 2010 Author Share Posted October 3, 2010 This is how I tried to replicate my objects: 1. Create an entity (oildrum) 2. Add the CloneObject entity (just a cube to which I can attach a script) 3. Name the object to clone and the number of clones in the CloneObject parameters 4. Apply, and allow the script to clone away. The script that is triggered follows: function object:CloneMe() SourceObject = object.model:GetKey("ObjectName") found = 0 count = 0 for k,v in pairs(objecttable) do if SourceObject == GetEntityKey(v.model, "name") then found = 1 tempModel = v.model end end if found == 1 then for i = 1, object.model:GetKey("ObjectCount") do newObj=tempModel:Copy() newObj:Move(3,0) end else Notify("Failed to find object " .. SourceObject,1) end end end As you can see in the screenshot the extra oildrum is not "registered" in the list of scene entities. The other problem I have is that the copy works, but trying to move the copy fails - object not found. This could be a simple logic error, or related to the entity not existing in the system. Quote All the best, Steve Vink Link to comment Share on other sites More sharing options...
AggrorJorn Posted October 4, 2010 Share Posted October 4, 2010 perhaps because you are copying the model, the names are no longer correct. Creating a new object rather then copying might do the trick. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.