Jump to content

entity:GetKeyValue("name") does not work on prefab


tumira
 Share

Recommended Posts

Hi

 

Bought the engine and been doing some tutorials. Awesome stuff. While doing some tutorial I noticed some strange stuff.

 

Script.respawnPoint ="" --entity "Respawn Point"

 

function Script:Collision(entity, position, normal, speed)

if entity:GetKeyValue("name") == "FPSPlayer" then

spawnPos = self.respawnPoint:GetPosition()

entity:SetPosition(spawnPos)

end

end

 

The above code does not work on prefab ? If I change some property values, then the warning comes up telling me that this is not going to be an instanced prefab. If I clicked "OK" the above code will works otherwise it wont work. (I tested multiple times to confirm this)

 

I following tutorials from this guy. He is using version 3.1 and the same codes work on prefab (based from the video)

 

Also I think I notice someone else having the same problem here, I think..

http://www.leadwerks.com/werkspace/topic/11631-incomplete-objects-with-collision-type-trigger-always-box/#entry84154

 

I'm using the beta branch(4.0).

 

Thanks

Link to comment
Share on other sites

Anyway I just created and uploaded a simple map based from the FPS Template. Here are the links

 

https://dl.dropboxusercontent.com/u/65841566/GetKeyValuePrefab.zip

 

The original FPS template player prefab name is "fpsplayer" and not "FPSPlayer".

 

So I changed the codes to reflect this. Still same error occurs. Just jump over the platform to trigger it.

Link to comment
Share on other sites

Yes this doesn't work, so probably a bug yes.

 

If you want a quick workaround you can add this to fpsplayer.lua

 

Script.name="fpsplayer"

 

And change your code in DeathTrigger to:

 

if entity.script.name~=nil and entity.script.name == "fpsplayer" then

  • Upvote 1

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...