Jump to content

Rick

Members
  • Posts

    7,936
  • Joined

  • Last visited

Everything posted by Rick

  1. Right, but behind the scenes this is what's happening. It's not like you are saving storage space or anything by not putting virtual in front of the child overloaded function.
  2. I don't think it is. Try putting pick.entity inside GetEntityKey() instead of model. If that doesn't work try pick.entity.model.
  3. What surrounding this code? What is model?
  4. I would expect that to work. Are you calling this GetEntityKey in fpscontroller inside the main loop or before it? If it's before it might be an issue as things might not be loaded. Also your true is a string so in your if statement you will need to check for == "true"
  5. I would strongly point you to use standard template libraries vector or lists. It can make things much easier.
  6. It doesn't matter because it's virtual anyway. So really by not putting virtual on child classes I think it just hides the fact that this overrides a base class method. The below code will call MyKnights::Move() over though I don't have virtual on the Move() functions for Knight or MyKnight. No need in hiding this fact by not putting virtual. class Piece { public: virtual void Move()=0; }; class Knight : public Piece { public: void Move() { } }; class MyKnight : public Knight { public: void Move() {// this is } }; int main() { Piece* p = new MyKnight(); p->Move(); return 0; }
  7. That's generally why I just always put virtual on the child functions. Like you said in this example he wouldn't derive and override Knight:Move(), but I generally do that do I know when looking at Knight that this function is virtual and most likely the parent one is also.
  8. I would just try: SetEntityKey(model, "key", "value")
  9. I would be all over LE C# if it was supported by Josh and not the community. It's to risky to rely on the small community LE has for .NET in my view. I hope with the great design it gains more acceptance.
  10. function SetKey(model,key,value) entitymodel:SetKey("showicon","true") What is entitymodel? The code you posted doesn't show what entitymodel is? If you look at other script examples there is a way to get the lua entity from the model that is being passed into SetKey(). There is something like get_Base() or something that you pass your model into and it returns a lua entity in which you can call SetKey() from. The other route to go is to just use the C++/BMax functions for SetEntityKey() passing in the model that is passed to SetKey(). I'm pretty sure the same result will happen.
  11. Generally what you do is: Piece* p = new Knight(); p->Move(); // this would call the Knight's Move() method. You would do this because you want a list of Piece objects, but you want a common method to call child methods of the same name because they'll act differently. You chess example is a perfect example of this. You have the parent Piece which has a virtual Move() function. I would make Piece Move() a pure virtual (virtual void Move() = 0). You would want this because you wouldn't want a Piece object to be created. Instead you want it's children to be created. There is no such thing as a generic piece. It has to a specific piece (child). So in closing class Piece { public: virtual void Move()=0; }; class Knight : public Piece { public: virtual void Move() {} }; Piece* p = new Knight(); p->Move(); Ideally you will create a list or vector of Piece pointers like: list<Piece*> p; p.push_back(new Knight());
  12. Rick

    December 8, 2009

    I think the fact that Josh is able to see a needed change and react quickly is a big advantage for him. Most other engines would most likely have just left the multi-state lua system and said too bad. He's quick to realize another way is better and react to it. That being said I am surprised at the lack of lua testing the community did with the beta. I know Josh is convinced that artists make games so maybe he had more artist testing than programmers and that was the reason no one really cared about lua that much? Maybe because Josh himself thought of the lua implementation as more of a toy that people didn't think to put much time or effort into playing with it? I didn't ask for the beta as I was pretty busy, but it took me about 3 days of playing with it to realize the multi-state lua system wasn't the way to go for lua developers. It seems odd the other beta developers didn't at least question that.
  13. Rick

    send message

    True. I guess it could be preference at that point.
  14. Rick

    send message

    I think SendMessage() can still serve a purpose. I'm thinking of using it to control animations. In my scripts, when I'm moving a character model, before I set the movement in action I would send a message to the character telling them to play the walk animation. Then when DoMoveTo() comes back I would stop the walk animation.
  15. Rick

    send message

    I do too, but with the multi-state lua, when I loop through the entities in the world, I think I'm getting the model and not the lua entity table, so I would need to use SendEntityMessage() to send a message with this.
  16. Rick

    send message

    Also SendEntityMessage() from lua I assume then?
  17. Rick

    send message

    Do I send messages via the lua entity table or can I send messages directly to the LE model? When I loop through the main world entities I want to send a message to one and then receive it, but from what I see it looks like those messages are via the lua entity. Does the ReceiveMessage() function get fired if I send a message through the LE model?
  18. Just a small little demo of the early works of my lua scripting scene library. Basically it allows you to make complex "scenes" in your game through scripting and a few map elements. Here is the code to the scene. The scene library functions have the Do in front of them and the GetEntityByName() and RunScript(). In the beginning you can the pivots setup and in the code you can see I assign those to variables for easier access. The library currently has: DoWait() -- waits x ms before continuing on with the script. Note I said just the script because the entire game continues to play. Only the function you defined waits. This is the best part of this. Your function isn't blocking to the game. DoSound() -- waits to continue with your script until the sound is finished. All the sound you hear are wav files that I created DoMoveTo() -- waits to continue until one entity reaches a destination entity function MyScript(cr) local pivot1 = GetEntityByName("pivot1") local pivot2 = GetEntityByName("pivot2") local pivot3 = GetEntityByName("pivot3") local pivot4 = GetEntityByName("pivot4") local general = GetEntityByName("pivot_7") local generalModel = GetEntityByName("1_4") local soldier = GetEntityByName("pivot_5") local miscSoldier = GetEntityByName("1_42") local miscSoldierModel = GetEntityByName("1_6") local camera = fw.main.camera PositionEntity(camera, EntityPosition(pivot1)) PointEntity(camera, miscSoldier, 3, 1, 0) DoWait(cr, 2000) DoSound(cr, "abstract::hello1.wav") PositionEntity(camera, EntityPosition(pivot2)) PointEntity(camera, soldier, 3, 1, 0) DoSound(cr, "abstract::ripoff.wav") DoWait(cr, 500) PositionEntity(camera, EntityPosition(pivot3)) PointEntity(camera, general, 3, 1, 0) DoSound(cr, "abstract::whosaidthat.wav") DoWait(cr, 500) PositionEntity(camera, EntityPosition(pivot2)) PointEntity(camera, soldier, 3, 1, 0) DoSound(cr, "abstract::idid.wav") DoWait(cr, 1000) PositionEntity(camera, EntityPosition(pivot1)) PointEntity(camera, miscSoldier, 3, 1, 0) DoMoveTo(cr, generalModel, pivot4, .005, .5, miscSoldierModel) DoSound(cr, "abstract::private_joker.wav") DoWait(cr, 250) PositionEntity(camera, EntityPosition(pivot2)) PointEntity(camera, soldier, 3, 1, 0) DoSound(cr, "abstract::from.wav") DoWait(cr, 500) -- debugging, makese it easier to go back to starting point PositionEntity(camera, EntityPosition(pivot1)) PointEntity(camera, miscSoldier, 3, 1, 0) SetGlobalNumber("runGame", 2) end -- this kicks the script off RunScript(MyScript) There is a bug in the DoMoveTo() which you can see at the end. The "general" guy seems to be slowly moving upward as he moves. This scene took me about 20 mins to setup. This is pretty powerful because you can create very complex "scenes"/interactions in your game with very little effort and logical flow. I will release the lua code when I'm complete but if you are interested in how I did this you can look into lua's coroutines.
  19. I have all those. The 2 I meant was when I select mpg, then I have 2 more options under that. Do you know what other formats youtube supports? I thought it was just mpeg-2, mpeg-4.
  20. Yeah but the 2 formats that are in there are just MPEG2. This is what I used and youtube didn't seem to like it. The other one is MPEG1. Youtube says H.264 or MPEG-2 preferred. I'm guessing MPEG2 and MPEG-2 are different because the MPEG2 didn't work.
  21. http://www.leadwerks.com/wiki/index.php?title=Entities#Animate Probably the same way you animated models using C++/BMax. I think your Animate() function would need to be in the entities Update() method since some values passed to Animate() will need to change each cycle.
  22. You don't access the menu value directly. What you do is in the SetKey() function (you can look at other entities to see how the SetKey() works) for the model you added this property to, you would use http://www.leadwerks.com/wiki/index.php?title=Entities#SetEntityKey to assign this model instance a key/value. In your case you would do something like: model:SetKey("hand_icon", "true") Then in your fps lua file where you pick, you are picking the model and when you get the model you can do: if(model:GetKey("hand_icon")) then -- change icon to the hand icon end So the ideas is you create menu options. When the menu options are set the SetKey() function is called which allows you to assign the value to your entities OR models that you can later get at other places.
  23. I can't get the Debut Video Capture Software video I do uploaded correctly to youtube. The format must be different but I can't find where to change the video format to something youtube likes.
×
×
  • Create New...