Jump to content

AggrorJorn

Members
  • Posts

    4,816
  • Joined

  • Last visited

Posts posted by AggrorJorn

  1. I'm not 100% sure how to use the SetKey and GetKey functions. I have the following in the switch.lua:

    --hand icon menu
    group=grid:AddGroup( "Hand icon" )
    group:AddProperty( 'Show hand icon', PROPERTY_BOOL,'showicon')
    

    function SetKey(model,key,value)
    if key=="showicon" then
    	entity.pickable=tonumber(value)
           end
    return 1
    end
    

    Is 'showicon' in AddProperty the Key here?

     

     

    In the FPScontroller I use a raytrace:

    
    pick=CameraPick(camera,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,2.0),0,0)
    	if pick~=nil then
    		repeat
    			if pick.entity:GetClass()==ENTITY_MODEL then
    				break
    			end
    			pick.entity=pick.entity.parent
    		until pick.entity==nil
    
    		-- show hand true or false
    		if pick.entity~=nil then
      		 ????GetKey("showicon","true")
    	  		  	handIcon = true    
    		end
    	else
    	handIcon = false	
    
    	end
    

     

    At the question marks I need to retrieve if the value is true or false from 'showicon' in the switch.lua. As I understand this is done by the GetKey.

  2. You could give a setting for models that you want to be picked. pickable = true for example. Then check this setting.

     

    hmm, didn't think of that, nice one. For the first time I used a LUA menu style for this (getting a menu option makes it look really professional biggrin.gif)

    
    --hand icon menu
    group=grid:AddGroup( "Hand icon" )
    group:AddProperty( "Show hand icon", PROPERTY_BOOL )
    

     

     

    this code was added to the switch.lua. If I want to retrieve the state of the bool value from the FPS Controller script, do I have to use the GetKey and Setkey commans for this?

  3. I want to display a hand icon on the mouse position when a player can interact with an object. As it is now, the raytrace returns a true when it hits a moddel, thus it prety much always shows a hand icon on screen (walls are also moddels and will activate the hand icon). The hand icon only needs to appear when a raytrace sees a certain moddel of a certain class.

  4. Perhaps I have to use a different explanation. The raytraces that are used with the switch in the tunnel level, check on the ENTITY_MODEL. when it is a moddel a message can be sent.

     

    I wonder if I can make those raytraces check on my own kind of class instead of every moddel.

  5. He can, but how much cooler would it be to be able to distribute an entity that you can just drag & drop into the editor and have it do 2D stuff. People could make 2D HUDs and interfaces that we can just drop & drag into the editor. Now that's cool.

     

    now there's innovation!

  6. small question offtopic. I use the following code centering the image.

    
    --show hand
    if KeyDown(KEY_R)==1 then
    	local x = GraphicsWidth()/2
    	local y = GraphicsHeight()/2
    
    	hand = LoadTexture("abstract::hand.dds")
    	DrawImage(hand,x,y,50,50)
    
    end
    

     

     

    Is this a correct use of the restiction 'local'?

  7. Where are you doing this? In the main loop right before Flip() or in an entity? Remember that 2D needs to be done right before the Flip() statement so really an entity can't handle this right now. I think Josh should create a function that gets called per entity right before the Flip() so it can though. You could probably do this though by adding some code in the fps code. Loop through all entities and if the function Draw2D() exists call it. Then in the entity you want to do this add a Draw2D() function.

     

    in the main loop.

     

    That would be a solution. I think that when I´ll be using more of these drawings, I´ll try something like that.

  8. dont know if this will work but try:

    hand = LoadTexture("abstract::hand.dds")
    DrawImage(hand, MouseX(), MouseY(), 20, 20 )
    

     

    thx for your suggestion.

     

    the good news: no error message.

    the bad news: the image doesn't display.

     

    I've copied and modified the FPS controller scripts for this. I wonder if it is possible to run the script in the editor and to draw the image on screen when in game modus of the editor.

  9. Hi,

     

    I'm trying to load an image on screen when the player is very close to a certain object.

     

    I'm trying the following to achieve this:

    
    TTexture hand = LoadTexture("abstract::hand.dds")
    DrawImage(hand, MouseX(), MouseY(), 20, 20 )
    

     

    I get the following error message:

     

    '=' expected near 'hand'.

     

    According to the wiki, I'm using the commands correctly.

     

     

    Who can tell me whats going wrong here?

    • Upvote 1
  10. Hi,

     

    I don't have much programming experience but I want to know some general information about the differences between C# and C++. Is there really much difference between these 2. It's common knowledge that C++ is more difficult. But what I've seen so far with C++, it doesn't differ much from C#. I could be ofcourse very wrong about this.

     

    Can anyone tell me the differences, ups, downs or experiences with C#?

  11. I think that Josh should do a tutorial for this soon, even if he doesn't so much for other stuff, because those work for the most part and this is a fairly integral part of making a project work properly.

     

    So basicly put together:

    • load a scene/sbx with C++ including:
      • moddels
      • lights
      • nodes

      [*]process the scene with LUA scripts

      • perhaps, explanation which LUA scripts do the processing
      • what files need to be copied to your game folder

    Am I forgetting something?

  12. ow yeah, thats awesome! Reminds me of Torque 2D. they had a very easy particle system build in.

     

    both the fans are connected with the switch. Is there a special reason that the connection are made on different indexes?

     

    Leadwerks scores again!!rolleyes.gif

  13. Hi,

     

    I'm looking into this level: tunnel.sbx. When you run the FPS controller file you can walk through it. When you are close to the switch you can press E for turnig on 1 of the 2 fans.

     

    However I can't seem to find the connection between those 2. Where do you you say that the switch has to interact with the left fan? I know that the fps controller sends a "use" message, but I just can't find where that message is going to. I've looked in the scripts of the switch and the fan, as wel as in their properties.

     

    In the older version you would hav to specify a target. I wonder how it's done now.

     

    A small direction would suffice.

×
×
  • Create New...