lxFirebal69xl Posted January 31, 2015 Share Posted January 31, 2015 So, I want the player to enter a collision trigger and that trigger makes it shows a picture, kind of like this script for text but instead of text, it shows a picture. How can I do this? Script.ObjectDescription = "" --String "Object Description" Script.DisplayTimeMax = 5000 --Int "Display time" Script.Used = "0" Script.DisplayTime = 0 Script.DisplayEnabled = false local font1 = Font:Load("Fonts/True Lies.ttf", 20) function Script:Use(context) self.Used = "1" self.CurrentTime = Time:GetCurrent() self.DisplayTime = Time:GetCurrent() + self.DisplayTimeMax end function Script:PostRender(context) if self.Used == "1" then App.context:SetBlendMode(Blend.Alpha) App.context:SetFont(font1) self.DisplayEnabled = true if self.DisplayEnabled == true then if self.DisplayTime > Time:GetCurrent() then App.context:SetColor(255,255,255) context:DrawText(self.ObjectDescription, 100, 600) else self.DisplayEnabled = false self.Used = "0" end end App.context:SetBlendMode(Blend.Solid) end end Quote Link to comment Share on other sites More sharing options...
nick.ace Posted January 31, 2015 Share Posted January 31, 2015 This does a picture instead: Script.ObjectDescription = "test" --String "Object Description" Script.DisplayTimeMax = 5000 --Int "Display time" Script.Used = "0" Script.DisplayTime = 0 Script.DisplayEnabled = false Script.image=Texture:Load("Materials/Effects/bloodspatter.tex") function Script:Use(context) self.Used = "1" self.DisplayTime = Time:GetCurrent() + self.DisplayTimeMax self.DisplayEnabled=true end function Script:PostRender(context) if self.Used == "1" then context:SetBlendMode(Blend.Alpha) self.DisplayEnabled = true if self.DisplayEnabled == true then if self.DisplayTime > Time:GetCurrent() then context:DrawImage(self.image, 100, 100,100,100) else self.DisplayEnabled = false self.Used = "0" end end App.context:SetBlendMode(Blend.Solid) end end Collision trigger: Are you talking about if the player enters a certain zone this script gets played? Or is it if the player selects an object like with this script? Quote Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted January 31, 2015 Author Share Posted January 31, 2015 This does a picture instead: Script.ObjectDescription = "test" --String "Object Description" Script.DisplayTimeMax = 5000 --Int "Display time" Script.Used = "0" Script.DisplayTime = 0 Script.DisplayEnabled = false Script.image=Texture:Load("Materials/Effects/bloodspatter.tex") function Script:Use(context) self.Used = "1" self.DisplayTime = Time:GetCurrent() + self.DisplayTimeMax self.DisplayEnabled=true end function Script:PostRender(context) if self.Used == "1" then context:SetBlendMode(Blend.Alpha) self.DisplayEnabled = true if self.DisplayEnabled == true then if self.DisplayTime > Time:GetCurrent() then context:DrawImage(self.image, 100, 100,100,100) else self.DisplayEnabled = false self.Used = "0" end end App.context:SetBlendMode(Blend.Solid) end end Collision trigger: Are you talking about if the player enters a certain zone this script gets played? Or is it if the player selects an object like with this script? I was talking about the player entering the zone and the picture would show up. Looks like this one only works for when a player uses an objectand it only shows up with a black box on the corner, no actual picture shows up Quote Link to comment Share on other sites More sharing options...
nick.ace Posted February 1, 2015 Share Posted February 1, 2015 I'm not really sure why you are getting a black box, but it may have something to do with other code that you may have (like if you edited App.lua code or something) or maybe the image doesn't exist or something like that. Try a different image instead. These tutorials explain how to make a collision trigger ("zone") effect: The second link shows code on how to do this, but the first one gives a little bit of background. Quote Link to comment Share on other sites More sharing options...
lxFirebal69xl Posted February 1, 2015 Author Share Posted February 1, 2015 I'm not really sure why you are getting a black box, but it may have something to do with other code that you may have (like if you edited App.lua code or something) or maybe the image doesn't exist or something like that. Try a different image instead. These tutorials explain how to make a collision trigger ("zone") effect: The second link shows code on how to do this, but the first one gives a little bit of background. Only the default texture you use works, I've tried others and it only works if they're in the "Effects" folder, which is quite strange... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.