-
Posts
382 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by tipforeveryone
-
-
Just do this
local hHit = window:KeyHit(Key.H)
if self.player_Inside_Room and hHit then
System:Print("Yay!")
end
This won't work I tried.
-
I would put it in the main.lua loop and not in an entity script. Somewhere at the end of the loop so you know that all updateworld and updatephysics already have taken place.
Same resuit I put window:FlushKeys() at the bottom of loop and still can't move. You should give it a try, please
-
Sound like your keys are stored untill usage. You probably just have to use flush keys:
http://www.leadwerks.com/werkspace/page/api-reference/_/window/windowflushkeys-r903
I thought about this function once, but I wonder will it flush every keyboard interaction, include KeyDown if I put this in UpdateWorld ?
....
Oh I have tried FlushKeys(), put it in UpdateWorld() then I can not use my AWSD key anymore :"D
can you suggest me how to use this to solve my KeyHit problem ?
-
Today I found a strange problem with window:KeyHit
I put this code inside an if statement
if self.player_Inside_Room == true then if window:KeyHit(Key.H) then System:Print("Yay!") end end
I create a CSG box with collision type = Trigger, it will set self.player_Inside_Room = true when player collides, after that, I can press H to display "Yay!"
Strange thing is: I press and release H before entering the trigger but when I enter that box, the debug console displays "Yay!". It doesn't matter how long I have pressed H key before
How can I solve this? I just want to execute something only when I get inside the trigger and hit a key
-
Awesome, thank you so much !
-
I got this accidently and I can't find out what its name is... hope someone know
- 4
-
Thanks Juan,
I can't find anyway to fix this atleast it work well with sanbox off
-
Finished and updated topic Hope you enjoy!
- 2
-
Totally off topic. What's that music?
Here you are https://www.youtube.com/watch?v=Xh1rGVFS4eY
- 1
-
Features
- Record camera path movement by controlling camera itself, what you see is what you get- Path information can be saved to sperated file for later use- Attach saved path file to any entity to playback recorded path- Camera movement can be adjusted for smooth and better path record- Great for cut scene or object with motion.Demo
What I did in this demo:- Record the first path and save it to path1.lua- Record the second path and save it to path2.lua- Create a small box then attach each of saved path files- Attach path1.lua to Pivot, attach path2.lua to box, watch their combinationHow to use
- Download and extract 2 lua files to anywhere in your project folder, example: Scripts/Recorder- Create a Pivot in your map then attachPlayerControl-PrototypeB.luato it- Create a lua file then choose it as" Record File" in Script tab of the pivot (This is required!)- Run the game- PressRto start/stop record- PressPto playback recorded path- PressEscto exit- Create an entity, ex: a box. AttachObjectPathMovement.luato it- Choose saved record file (This is required!)- Run the game- PressJto start playback recorded path for the entityOther attributes explaination
PlayerControl-PrototypeB.lua-Playback Start:Execute playback process right after the game start, using data from choosen record file-Clean Screen:Hide all HUD elements while playback-Both Playback Start and Clean Screen are good for cutscene camera-Focus Object:Drag any entity which you want camera to point at while moving, this will ignore recorded rotation of camera.ObjectPathMovement.lua-Play Rotation: if this is false, entity will ignore recorded rotation- 9
-
Yes it is, thank you. This works perfectly
-
This does not work
I try
function Script:Collision(entity,position,normal,speed) if entity:GetKeyValue("name") == "PlayerControl" then System:Print("hit") else System:Print("no hit") end end
Then there is no "no hit" in output when player is outside of trigger box, of course it will display "hit" when player step inside the box. I want to do something when player step out or out side triggerbox.
-
Can I use my custom character controller to complete the challenge ?
- 1
-
I can use a box with Collision Type = Trigger to detect player
function Script:Collision(entity,position,normal,speed) self.playerInside = true end
But I can't figure out how to execute when player NOT collides this box
something likes
function Script:Collision(entity,position,normal,speed) if entity == player then self.playerInside = true else self.playerInside = false --how can I do this :"D end end
-
1. Write cutscene script (all stuff like: How all entities are placed, which shoud be moved first etc..)
2. Create the scene (using leadwerks brush or 3d program like blender)
3. Prepare character animation
4. Write code for camera movement / position / time
5. Combine all of them
- 1
-
It should be a "FAQ" topic :"P soon
- 1
-
Another script for flicker light
Script.flicker = true --bool "Flicker enabled" Script.flickerRate = 0.5 --float "Flicker Rate" -- Value range should be from 0 to 1 -- near 0 ~> light is off most of time -- near 1 ~> light is on most of time function Script:FlickerControl() if self.flicker then local rand = Math:Random(0,1) if rand < self.flickerRate then self:entity:Show() else self.entity:Hide() end end end
-
I am trying this program trial, and it is so promising:D gonna buy it I think
-
I have a same problem now, is this solved ?
-
Here you are, I have finished this today ^^ http://www.leadwerks.com/werkspace/blog/188-tipforeveryones-blog/
- 4
-
Thank you guys
-
You could put a tall rectangle or cylinder around it with the invisible material and make it a prefab.
Thanks for your reply.
I thought about this solution before but it does not fit my need
I need to keep physic mesh of my object for specified purpose, this is my example, it is silly but can demontrate what I need hehe
I have a toilet, I want bulletshells which were ejected from my gun can physical interact to it,
I dont want to step on the toilet each time I get too close, decrease climbstep of character controler is the best solution (it is sad to know that it can not be changed)
If I use an invisible box to block my movement, bulletshells can not interact to toilet
-
I just want not to step on something :"P like a mine. if you get close to a mine you can not step on it and it will block character physic
-
How can I do that ?
window:KeyHit strange problem
in Programming
Posted
@Aggror: Yes this will solve the problem of window:KeyHit but affect window:KeyDown too, I use ASWD for character movement and they are flushed too, make my character unmovable. So that I think it is not good to put window:Keyflush() anywhere.
Is there any way to flush only one key ?
@Rick
I have a same thinking now I may combine window:KeyDown with some bool variable
@SGB: I want a key to execute an unique function only in specified condition(this case is player is inside a room), when player is outside the room, that key will do another task when hit.
Ex:
Press H in room 1 ~> display "Rick"
Press H in room 2 ~> display "Josh"
Press H in room 3 ~> display "SGB"
etc...
one key can execute diffirent tasks in a specified condition, so that I need to put window:KeyHit under an if statement
If I put if statement inside if window:KeyHit(). It does not work
this code does not work
this does but if I use this, I will have problem which I describe in the first entry of this topic