Jump to content

Josh

Staff
  • Posts

    23,222
  • Joined

  • Last visited

Everything posted by Josh

  1. Use TFormPoint and TFormVector to transform the position and force from local to global space.
  2. Extra is a BlitzMax object, which includes strings. It cannot be an integer (unless it is converted to a string) or a Lua table.
  3. You can send the damage value as a string. What is the hit info thing you are talking about?
  4. A single model can only have one link on an index.
  5. Make sure "Show Helpers" is enabled so you can see links. If you don't see a link where you think you should, try changing the link index in the main menu. This sets the link index that is displayed, and if you create a link it is created on this index.
  6. Josh

    Week 2

    I think BlitzMax is the best language to use, but people won't use it because they have never heard of it. C/C++ is pretty hard for beginners, so Lua offers a good combination of what people want. It is a well-known name, so people won't reject it for being unknown, and it is a lot easier for them to achieve progress with.
  7. I'm going to do some experiments with a single lua state. It will make scripting harder, and you will have to manually clean everything up yourself, but it would allow shared data like this: player.enemy.bullet:shoot()
  8. It's in the configuration settings.
  9. You're planning to write a unique script to make all those events occur? I think it makes more sense to have a set of rules so the artist can place objects and adjust settings without writing a new script for each map.
  10. You'll walk upstairs, the basement will flood, and you'll hear a lot of objects banging around. Then you go back downstairs and things aren't in the same place you left them.
  11. Yes. Or if you just want the local rotation use this: entity.rotation.x These members should be treated as read-only.
  12. Use alpha blend with an all-zero alpha texture.
  13. Why wouldn't it, if those entities have been added to the scene?
  14. You can use the procedural command, just as you did above.
  15. That example is just a lot of different things going on, but nothing itself is very complicated: Trigger sets a key in the player model: SetKey("controlmode","auto") Trigger sets the camera model's target to the player. The camera script follows the target, when one exists. Trigger sends a message to a sound entity to play the music. Player moves to his target until he reaches it, and some more events are triggered. ...and so on. A bullet hitting a player, hurting them, and updating the owner's score was about the most complicated single interaction I could think of. Any other ideas? One advantage of this system is it encourages you to create a defined set of actions with the messages, instead of making spaghetti code. One disadvantage is when you have something like the roads, and you want to tell if a wheel of a car lies on the road. You need to communicate with the road script, but how do you get that info back? That is where it gets sticky.
  16. I think that command was missing internally. I am going through the docs and I find a few missing methods that I fill in as I document it. So sync in a couple days and it will be available.
  17. Maybe enter this text in the property editor: function CustomBehavior(entity) Notify("Hello!") end Then in SetKey add this: function SetKey(key,value) if key=="customscript" then dostring(value) end end So now at this point the new code has been evaluated and the function is usable in Lua. Now add this to the message receive function: function ReceiveMessage(message,extra) if message=="custombehavior" then CustomBehavior(entity) end end I don't know if this is a great idea, because it is confusing, and the state is shared across all instances of the model, but it's interesting that it works.
  18. Don't use it in real-time, because iterating through the whole model list will be slow when there are lots of models.
  19. I think at some point you should just work within the bounds of what you have. Eventually you will have more options to do stuff like this, and writing workarounds in the meantime will likely cause unforeseen problems like what Red Oktober mentioned. You'll walk up the stairs and find a lot of fish flopping around in your living room, or something.
  20. It makes sense because camera range is a per-map setting. Small indoors scenes need a short range, and outdoors scenes vary depending on fog range and other factors.
  21. I want to make sure the system can handle complicated interactions. Here is an example where a bullet shoots an enemy. I added an imaginary extra "sender" parameter to make it easier: Bullet/player script: enemy:SendMessage("hurt",0,"-5") Enemy script: function ReceiveMessage( message, extra, sender ) if message="hurt" self.health=self.health-tonumber(extra) if self.health<=0 then self:Kill() sender:SendMessage("addscore")--Add to the killer's fragcount else self.model:EmitSound(sound_ouch) end end end What other scenarios can you think of that might be difficult? As far as I can tell, this system can handle everything, but I want to make sure.
  22. It would hurt something, because it would cause more bugs for me to spend time on. The biggest problem would be if two models have the same name, and then one is freed, there would be no model for that name, even though it exists. You can have up to 8 targets. I can raise that if needed, but it seemed like enough for now. You can loop through all entities with the world entity list: for entity in iterate(CurrentWorld().entities) do end Or: for entity in iterate(CurrentWorld().models) do end Or: for entity in iterate(model.reference.instances) do end
  23. You can even write a little script in the property editor and make the model execute that code. There's an option in the text property to open a multiline text editor in a separate window. I didn't use this feature, but it is an example of just how flexible Lua is.
  24. The point of targets is so you don't have to type in unique names and find them later. Just click and drag between two models. Unique names are more error-prone. Target relationships won't run into problems with redundant names. You can set up one system of objects, then copy and paste them, and the copied group will behave the same, with targets intact. If you copy and paste named objects, their names will be identical, and they will interfere with each other.
×
×
  • Create New...