Jump to content

AggrorJorn

Members
  • Posts

    4,816
  • Joined

  • Last visited

Posts posted by AggrorJorn

  1. I'm trying to make a switch work for turning on and of lights. First problem is, is that I can turn the light of (hide message), but then I can't get it back on (show message.) I use these messages in the switch.lua:

     if entity.hidden==1 then
                                           target:SendMessage("show",nil,delay)
                                   else
                                           target:SendMessage("hide",nil,delay)
                                   end

    .

  2. I've made a projector spotlight for you. Place the map with the other lights and drag a projector-spotlight on screen. The only thing you need to do is replace the "projector-map.dds", with your own dds file if you want to. Be sure to give it the same name though.

     

     

    27 december update:

    The new 2.3 sync changes the lua a bit. 3 replies lower is the new file.

  3. yes, i have a selectable boolean property as well inside the switch to determine whether to show it or not... also i am doing the loading of the texture with the switch so its loaded with the model

     

    and I am also doing a entitydistance check as well in the fpscontroller script. what i have right now is very consistent with one model type... meaning i can have several instances of the same model and it works just fine, but add the same key to a different model and it fails to work for both models...

    can you show what you have? I'm interested in how much it differs from what I have. perhaps this way I can find something that solves the problem.

  4. i have only been messing with it since last night really but thats where i am stuck at the moment... once i have that same key on another model its just looks at the first model that it comes across with that key and goes no further... so at the moment this key/value is particular to this model...

    The problem is (I think) that the key doesn't refresh as it is in the loop. I build a menu to check if you want an icon to appear. however when you set a key, you don't check wether the value in the menu is true or false. I used this approach (with a lot of help from Rick).

     

    switch.lua :

     

    fpscontroller.lua:

    --check hand icon
    	pick=CameraPick(camera,Vec3(GraphicsWidth()/2,GraphicsHeight()/2,2.0),0,0)
    	if pick~=nil then
    		-- show hand icon
    		if (GetEntityKey(pick.entity,"showhand","yes")==true) then
    			handIcon = true
    		end
    	else
    	handIcon = false
    	end

     

     

    But it's not working correctly. Sometimes it works but not always.

  5. getting close to having something like this right now...

    Macklebee: Are you able to show the hand icon just on the switch only? I've been strugling with that for a week. I manage to show the image with raycast but I can't make it so, that it only appears on specified objects (like just the switch.)

     

    Rick: I tried to make a simple flat plane with a texture and alpha on it, but the effects really ugly. When you stand in the volume ligt you are sort of in the plane and you will see the the edge of the plane going through your screen.

  6. The switch should be able to handle that all inclusively.

    So true.

     

    Another thing that would be great to use this with is placeable Volume lights. This way you can place several billboars on screen creating volume light and you have more controll over it.

     

     

     

    on 3:30 in this movie you see how this works. You have to freeze there though because it goes really fast.

  7. I don't think I'm going to solve this any time soon. The logic seems to slip away at some points. I guess I have to wait for some tutorials/

     

    Is there another way to check via pick.entity what kind of model it is? Like say: the pick.entity returns a model name or something?

  8. using

    if (GetEntityKey(pick.entity,"switchIcon","true")) then

    results in no errors, but the icon appears on every single model.

     

    If I try

    if (GetEntityKey(pick.entity,"switchIcon","true"))== true then

    then the hand icon doesn't appear. So it looks like the command is right now, but it doesn't refer to the right key. Also this code seems quite fragile as the editor crashes with the smallest of change.

  9. I though that 'model' was some kind of global class.

     

    --check hand icon
    
    	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 icon
    		if (GetEntityKey(model,"switchIcon","true"))== true then
    			handIcon = true
    		end
    
    	else
    	handIcon = false	
    
    	end

     

     

    In a previous topic I wondered if I could change "GetClass()==ENTITY_MODEL " could change into my own kind of class. But this ways seemed the better solution to this.

  10. I have to be close then:

    switch.lua

    	group=grid:AddGroup( 'Icon' )
    group:AddProperty( 'showicon', PROPERTY_BOOL,'', 'Show hand icon' )
    group:Expand(1)
    end
    
    function SetKey(model,key,value)
    if key=='showicon' then
    	SetEntityKey(model,"switchIcon","true")
    end
    end

    the fpscontroller:

    -- show hand icon
    if (GetEntityKey(model,"switchIcon","true")) then
    handIcon = true
    end

    The engine crashes entirely when I approach the switch.

  11. hmm Although I'm more clear about what the SetKey does, it's not entirely clear where to put them exactly. This is the menu option.

    group:AddProperty( "showicon",PROPERTY_BOOL,"","Show hand icon")

    I've added this to the spawn function :

    function Spawn(model)
    model:SetKey("showicon","1")

    This way when a new switch is being dragged on, it has a default value of 1 (true).

     

    Next there is the function SetKey(model,key,value). I've place a new model.setkey command but here I get an error.

    function SetKey(model,key,value)
    entitymodel:SetKey("showicon","true")

    The error message "attempt to index global 'entitymodel' (a nill value)". What does this error mean exactly?

  12. I will upload a screenshot from Model Viewer with the Gold XIX weapon I have been using. I will have bones and hierarchy visible, and Photoshop some labels to the "important" bones.

     

    I am at school right now, it is 10 AM EST, I get home and can have the screenshot up around 4 - 4:30 PM EST.

     

    OK, I'll wait for that. for me it will be tomorrow because of the time difference.

  13. The only thing I would really ask is that you make a bone called "FIRESPOT" where the bullet should leave the muzzle. This library is oriented towards artists who want to get their weapons working quickly or anyone who just wants some fun guns working with lots of features.

    I'll be looking in to that then. It's isn't a problem to create a few bones btw. However if you have an example of how you prefer it, please send it to me. (an image with the bone placements and names would suffice. I work in 3ds Max) That way I can better understand how you want the weapons to be structured with bones.

  14. I've made this extra menu for the switch moddel. You can select true or false.

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

    My question is: How can I retrieve the selected value in the menu, outside the script where I created the menu?

×
×
  • Create New...