Rick Posted May 11, 2014 Share Posted May 11, 2014 Script.MyEntity = nil --entity "MyEntity" Then I fill this in via the editor by dragging and dropping an entity to this parameter. It doesn't seem like the engine is filling this in anymore as the value stays nil which causes the program to bomb. This is in the beta branch. Link to comment Share on other sites More sharing options...
YouGroove Posted May 11, 2014 Share Posted May 11, 2014 I'm in Beta, just tested and no problem, what i put in the field remains and works in the code. Script.cam = nil --entity function Script:Start() local pos = self.cam:GetPosition(true) self.entity:SetPosition(pos,true) end Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted May 11, 2014 Author Share Posted May 11, 2014 Try doing that in UpdateWorld() because it works for me when it's accessed in Start() too, but errors when inside UpdateWorld() 1 Link to comment Share on other sites More sharing options...
Josh Posted May 11, 2014 Share Posted May 11, 2014 Let's see your script. I bet you forgot "self.". My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted May 11, 2014 Author Share Posted May 11, 2014 Negative batman. Take YouGrooves script above and put the code that he has in Start() in UpdateWorld() and it blows up. It works in Start() though. A straight up copy/paste of local pos = self.cam:GetPosition(true) causes the blow up in UpdateWorld() but works in Start() Script.cam = nil --entity function Script:Start() local pos = self.cam:GetPosition(true) self.entity:SetPosition(pos,true) end Link to comment Share on other sites More sharing options...
shadmar Posted May 11, 2014 Share Posted May 11, 2014 Had a quick test and this works, my box jumps up and down when player does. Attach this to a box and drag and drop player to the script variable Script.playerentity= ""--entity function Script:Start() end function Script:UpdateWorld() local y = self.playerentity:GetPosition().y local pos = self.entity:GetPosition() pos.y = y self.entity:SetPosition(pos) end HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Rick Posted May 11, 2014 Author Share Posted May 11, 2014 Bah, this was the csg getting collapsed issue. My entity was a csg. Put a dummy script on it then it worked. Where is our checkbox for csg to not collapse Although I'll have to dbl check because if my training session this morning we passed a camera entity and it wasn't working, which isn't csg and wouldn't get collapsed. hmm I swear I double checked everything this morning and it didn't work. >< I guess you can close. 1 Link to comment Share on other sites More sharing options...
YouGroove Posted May 11, 2014 Share Posted May 11, 2014 @Rick : New code Script.cam = nil --entity function Script:Start() --local pos = self.cam:GetPosition(true) --self.entity:SetPosition(pos,true) end function Script:UpdateWorld() local pos = self.cam:GetPosition(true) self.entity:SetPosition(pos,true) end It's some one time bug , i got your problem like you first time only. But trying again and putting again camera on script field it worked now, i made several other tests with same script no more problem. Could you try again dropping entity on script slot ? 1 Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted May 11, 2014 Author Share Posted May 11, 2014 Yeah, I know I'm not going crazy here. There must be some special situation where the engine isn't setting the param. Link to comment Share on other sites More sharing options...
Josh Posted May 11, 2014 Share Posted May 11, 2014 I see the visible entity disappearing when a prefab is used for the scripted entity. Ah, no it is a hierarchy thing. If you have multiple entities selected, it just appears blank. I should make that say <different>. However, this does not seem to effect actual behavior in the game as you describe,. My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Admin Posted March 12, 2019 Share Posted March 12, 2019 I'm going to file this one away unless there is still an issue here... Link to comment Share on other sites More sharing options...
Recommended Posts