Jump to content

LUA Documentation


  • You cannot reply to this topic

5 replies to this topic

#1 Martin Thompson

Martin Thompson

    Member

  • Members
  • 125 posts

Posted 18 July 2014 - 10:21 PM

Hey Guys,

 

I'm still working on my map and noticed the comments in the func_usable section in GTK about LUA and sounds. Ive used a script to play some sounds using lua, which works pretty good!

 

I had a few questions about this though.

 

1. Does a lua script contribute to the entity count (like a speaker entity does) ?

 

2. Where is the latest documentation on lua? I found a document from november 2011 in a git repo, not sure if that is the latest one.

 

I'll try to experiment some more with it, especially if it means being able to reduce entity count!

 



#2 GSIO01

GSIO01

    UberGames Developer

  • UberGames Developer
  • 1,021 posts

Posted 19 July 2014 - 08:04 AM

  1. Sounds used in Lua have no impact to the entity count.
  2. I think that is the newest we have. There were some updates in the meanwhile though but we didn't find the time to update the documentation. You'll may be able to find some additional information or functions available in the source files (prefixed with lua_) here.

Anyway if you come accross any problems or questions feel free to ask us.



#3 Martin Thompson

Martin Thompson

    Member

  • Members
  • 125 posts

Posted 26 July 2014 - 08:08 AM

Hey,

 

I've been playing around with this some more and ive been trying to move around some entities using the mover library. However, when I call mover.SetPosition on an entity, it just disappears.

 

In the code i noticed G_SetOrigin gets called, but i cant search trough the rest of the code on github so i dont have a clear view of what the parameters should be. I just assumed the origin required as input is the same origin an info_notnull or the like displays in GTK Radiant. However, when i call mover.SetPosition, even with the same origin as the entity is currently located, it just vanishes. Any idea as to why?

 

EDIT:

 

I figured it out by printing the entities origin. The mover.SetPosition uses relative positions in stead of absolute positions. So to move the entity back to its spawn position, the xyz vector is just 0,0,0 to move it 18 units up, the movement vector is 0,0,18 etc.



#4 GSIO01

GSIO01

    UberGames Developer

  • UberGames Developer
  • 1,021 posts

Posted 26 July 2014 - 10:08 PM

The behaviour of that function might change depending on whether the entity has an origin brush or not. Guess I'll have to check out if that is the case.



#5 Martin Thompson

Martin Thompson

    Member

  • Members
  • 125 posts

Posted 06 August 2014 - 06:19 PM

The behaviour of that function might change depending on whether the entity has an origin brush or not. Guess I'll have to check out if that is the case.

 

The behavior of the rotational variant does have a dependency on an origin brush, haven't tried it for linear movement, but I assume that works the same.

 

Also, rotating a brush 90 degrees which itself is not aligned to any axis, is a pain in the *ss! :P



#6 GSIO01

GSIO01

    UberGames Developer

  • UberGames Developer
  • 1,021 posts

Posted 07 August 2014 - 11:29 PM

The behavior of the rotational variant does have a dependency on an origin brush, haven't tried it for linear movement, but I assume that works the same.

 

Also, rotating a brush 90 degrees which itself is not aligned to any axis, is a pain in the *ss! :P

 

Vector math is fun ;):P





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users