Jump to content

SetKey in lua script doesn't work


ParaToxic
 Share

Recommended Posts

Hey Guys,I would like to make a sound class for a FPS game and to check out on which type of ground the player is ,I would like to set to all Models a Key named "Surface" and a value like "Metal" or "Concrete".I set the Key ,but in C,in my Game it can't find this key or the value.

 

Maybe somebody can help me ;D

 

Little Map lue file:

 

require("scripts/class")

local class=CreateClass(...)

function class:CreateObject(model)
local object=self.super:CreateObject(model)

self.model:SetKey("Surface","Concrete")

end

 

and in C :

else if(GetEntityKey(weapon->shootpick.entity,"Surface") == "Concrete")
			{
				PositionEntity(metal,EntityPosition(weapon->shootpick.entity));
				PlaySource(concrete);
			}

 

Thanks os much :)

Link to comment
Share on other sites

try this:

require("scripts/class")
local class=CreateClass(...)

function class:CreateObject(model)
       local object=self.super:CreateObject(model)

       object.model:SetKey("Surface","Concrete")

end

 

and probably in the C code, you would need to find the model of the pick.entity as a pick's entity is a mesh not the model...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

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...