Jump to content

burgelkat

Members
  • Posts

    203
  • Joined

  • Last visited

Everything posted by burgelkat

  1. Maybe you can build this in blender and use the result as model?
  2. function Script:Start() self.close=false self.conservation2=false end -----------------------Conservation-------------------------- function Script:StartConservation()--in System:Print("Conservation") self:ConservationPart1() end function Script:ConservationPart1() Talkingpanel=gui System:Print("TextShow") local Talkingpanel={} local scale = 1 --GUI local gui = GUI:Create(context) Talkingpanel.gui=gui Talkingpanel.context = context Talkingpanel = Widget:Panel(gui:GetBase():GetClientSize().x/2+150,gui:GetBase():GetClientSize().y/2-300,500,600,gui:GetBase()) Talkingpanel:SetAlignment(0,0,0,0) Talkingpanel.Talkingpanel=Talkingpanel Talkingpanel=Talkingpanel local widget widget = Widget:Tabber(indent,indent,Talkingpanel:GetClientSize().x-indent*2,Talkingpanel:GetClientSize().y-indent*2,Talkingpanel) widget:AddItem("Name of Person",true) x=30 y=60 Talkingpanel:SetObject("backgroundcolor",Vec4(0.15,0.15,0.15,1)) Talkingpanel.tabber = widget local indent = 12 Talkingpanel = Widget:Panel(indent,indent,widget:GetClientSize().x-indent*2,widget:GetClientSize().y-indent*2-30,widget) Talkingpanel = Widget:TextArea(x,y,Talkingpanel:GetClientSize().x-indent*2-50,Talkingpanel:GetClientSize().y-indent*2-300,Talkingpanel) --------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------Dialog 1----------------------------------------------------------------------------- Talkingpanel:SetText(" NPC Text 1 ") Talkingpanel:SetBool("border",true) Talkingpanel.panel={} Talkingpanel.panel.general=panel Talkingpanel.btnClose = Widget:Button("Close",widget:GetClientSize().x-72-indent,widget:GetClientSize().y-28-5,72,28,widget) Talkingpanel.btnClose:SetStyle(BUTTON_CANCEL) ------------------------------------------------------------------------------------------------------------------ --Talkingpanel.btnClose = Widget:Button("Close",widget:GetClientSize().x-450-indent,widget:GetClientSize().y-250,100,28,widget) --Talkingpanel.btnClose:SetStyle(BUTTON_CANCEL) Talkingpanel.btnConservation2 = Widget:Button("Answer 1",widget:GetClientSize().x-450-indent,widget:GetClientSize().y-280,160,28,widget) Talkingpanel.btnConservation2:SetStyle(BUTTON_CANCEL) Talkingpanel.btnConservation3 = Widget:Button("Answer 2",widget:GetClientSize().x-450-indent,widget:GetClientSize().y-280,300,28,widget) Talkingpanel.btnConservation3:SetStyle(BUTTON_CANCEL) ----------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------ ---------------------------------------------------------------------------------------------------------------- Talkingpanel.btnConservation3:Hide() local y=20 local sep=40 while true do world:Render() Time:Update() Time:Resume() window:ShowMouse() if window:Closed() then return end ---------------------------------------------------------------------------------------------- while EventQueue:Peek() do local event = EventQueue:Wait() if event.id == Event.WidgetAction then ---------------------------------------------------------- if event.source == Talkingpanel.btnClose then --self:ProcessEvent(Event(Event.WidgetAction,Talkingpanel.btnClose)) System:Print("WidgetAction1") self.component:CallOutputs("Output1") Talkingpanel.btnClose:Hide() window:FlushMouse() window:FlushKeys() window:HideMouse() window:SetMousePosition(window:GetWidth()/2,window:GetHeight()/2) gui:Hide() widget:Hide() return elseif event.source == Talkingpanel.btnConservation2 then --self:ProcessEvent(Event(Event.WidgetAction,Talkingpanel.btnConservation2)) System:Print("WidgetAction2") Talkingpanel:SetText("NPC Text 2") Talkingpanel.btnConservation2:Hide() Talkingpanel.btnConservation3:Show() elseif event.source == Talkingpanel.btnConservation3 then System:Print("WidgetAction3") self.component:CallOutputs("EndConservation3") Talkingpanel.btnConservation3:Hide() end end end context:Sync() end end Mybe someone can use it for NPC conversations
  3. ok, solved it. In the player script I have to make a reference to the weapon index in order to trigger the function. self.weapons[self.currentweaponindex]:becomewater()
  4. ah ok got it.. thanks .. i try .. and post again if it function. many thanks
  5. thanks for your answer. i got the first part. but at the "DoSomething" it crashs to desktop without error
  6. Hallo, i hope someone can explain this to me. i build a vwep praefab (like autogun) this script function and the bucket is show in the Start function i have this code. if i take the bucket, the child is now hidden. function Script:Start() local child = self.entity:FindChild("WaterforBucket") child:Hide() the problem now is, if i would show it again, i got an error. this is the code for showing the child function Script:becomewater()--in self.becomewater=true local child = self.entity:FindChild("WaterforBucket") if child:Hidden() then child:Show() end end the child is now nil. (Script Error attempt to index local "child" (a nil value) why now the child is not found? can someone explain and how i can fix it?
  7. thanks for the replay .. i think i should explain a little better. this ist the working script, but only with one button function Script:Start() self.close=false self.conservation2=false end -----------------------Conservation-------------------------- function Script:StartConservation()--in System:Print("Conservation") self:Conservation1() end function Script:Conservation1() Talkingpanel=gui System:Print("TextShow") local Talkingpanel={} local scale = 1 --GUI local gui = GUI:Create(context) Talkingpanel.gui=gui Talkingpanel.context = context Talkingpanel = Widget:Panel(gui:GetBase():GetClientSize().x/2+150,gui:GetBase():GetClientSize().y/2-300,500,600,gui:GetBase()) Talkingpanel:SetAlignment(0,0,0,0) Talkingpanel.Talkingpanel=Talkingpanel Talkingpanel=Talkingpanel local widget widget = Widget:Tabber(indent,indent,Talkingpanel:GetClientSize().x-indent*2,Talkingpanel:GetClientSize().y-indent*2,Talkingpanel) widget:AddItem("Old Man",true) x=30 y=60 Talkingpanel:SetObject("backgroundcolor",Vec4(0.15,0.15,0.15,1)) Talkingpanel.tabber = widget local indent = 12 Talkingpanel = Widget:Panel(indent,indent,widget:GetClientSize().x-indent*2,widget:GetClientSize().y-indent*2-30,widget) Talkingpanel = Widget:TextArea(x,y,Talkingpanel:GetClientSize().x-indent*2-50,Talkingpanel:GetClientSize().y-indent*2-300,Talkingpanel) --------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------Dialog 1----------------------------------------------------------------------------- Talkingpanel:SetText("Mhm? What do you want from me?") Talkingpanel:SetBool("border",true) Talkingpanel.panel={} Talkingpanel.panel.general=panel --Talkingpanel.btnClose = Widget:Button("Close",widget:GetClientSize().x-72-indent,widget:GetClientSize().y-28-5,72,28,widget) --Talkingpanel.btnClose:SetStyle(BUTTON_CANCEL) ------------------------------------------------------------------------------------------------------------------ local y=20 local sep=40 while true do Time:Update() window:ShowMouse() if window:Closed() then return end --if window:KeyHit(Key.Escape) then return end ---------------------------------------------------------------------------------------------- while EventQueue:Peek() do local event = EventQueue:Wait() if event.id == Event.WidgetAction then System:Print("Conservation2") self.conservation2=true return end end context:Sync() end end so with one button its no problem. i really try now to understand how it function with more then one button . becaus this event is for all buttons in the script. so i search some posts and look into menu.lua to understand. but if i try to do the same, the button have no reacton this is the code ( i cleaned it a little) function Script:Start() self.close=false self.conservation2=false end -----------------------Conservation-------------------------- function Script:StartConservation()--in self:Conservation1() System:Print("Conservation") --self.component:CallOutputs("Conservation") end function Script:Conservation1() local Talkingpanel={} local scale = 1 --GUI local gui = GUI:Create(context) --Talkingpanel.context = context Talkingpanel = Widget:Panel(gui:GetBase():GetClientSize().x/2+150,gui:GetBase():GetClientSize().y/2-300,500,600,gui:GetBase()) Talkingpanel:SetAlignment(0,0,0,0) Talkingpanel.Talkingpanel=Talkingpanel Talkingpanel=Talkingpanel local widget widget = Widget:Tabber(indent,indent,Talkingpanel:GetClientSize().x-indent*2,Talkingpanel:GetClientSize().y-indent*2,Talkingpanel) widget:AddItem("Old Man",true) x=30 y=60 Talkingpanel:SetObject("backgroundcolor",Vec4(0.15,0.15,0.15,1)) Talkingpanel.tabber = widget local indent = 12 Talkingpanel = Widget:Panel(indent,indent,widget:GetClientSize().x-indent*2,widget:GetClientSize().y-indent*2-30,widget) Talkingpanel = Widget:TextArea(x,y,Talkingpanel:GetClientSize().x-indent*2-50,Talkingpanel:GetClientSize().y-indent*2-300,Talkingpanel) --------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------Dialog 1----------------------------------------------------------------------------- Talkingpanel:SetText("Mhm? What do you want from me?") Talkingpanel:SetBool("border",true) Talkingpanel.panel={} Talkingpanel.panel.general=panel Talkingpanel.btnClose = Widget:Button("Close",widget:GetClientSize().x-72-indent,widget:GetClientSize().y-28-5,72,28,widget) Talkingpanel.btnClose:SetStyle(BUTTON_CANCEL) ------------------------------------------------------------------------------------------------------------------ Talkingpanel.btnConservation1 = Widget:Button("Who am i?",widget:GetClientSize().x-450-indent,widget:GetClientSize().y-250,72,28,widget) Talkingpanel.btnConservation1:SetStyle(BUTTON_CANCEL) ------------------------------------------------------------------------------------------------------------------ local y=20 local sep=40 ----------------------------------------------------------------------------------------------------- while true do Time:Update() window:ShowMouse() if window:Closed() then return end ----------------------------------------------------------------------------------------------------- function Talkingpanel:ProcessEvent(event) if event.id == Event.WidgetAction then if self.event.source == self.btnClose then self:ProcessEvent(Event(Event.WidgetAction,self.btnClose)) System:Print("WidgetAction") self.component:CallOutputs("LostAttention") Talkingpanel.btnClose:Hide() window:FlushMouse() window:FlushKeys() window:HideMouse() window:SetMousePosition(window:GetWidth()/2,window:GetHeight()/2) gui:Hide() widget:Hide() end end end function Talkingpanel:Update() if self.btnClose:GetText()=="Close" then self:ProcessEvent(Event(Event.WidgetAction,self.btnClose)) end while EventQueue:Peek() do self.event = EventQueue:Wait() if self:ProcessEvent(event)==false then return false end end return true end context:Sync() end end the Widget show up with buttons but if i click on the button. nothing happens. I cleand this code to only one Event becaus if the Event Close function, i think i understand and the other buttons will function too. i hope really someone understand me and can help me here
  8. Hallo, I am experimenting with widgets. I don't know what I'm doing wrong here. A single button as described in the documentation works very well. But if I want to use more buttons, it doesn't respond. What am I doing wrong? i hope someone can help function Script:Start() self.close=false self.conservation2=false end -----------------------Conservation-------------------------- function Script:StartConservation()--in System:Print("Conservation") self.component:CallOutputs("Conservation") end function Script:Conservation1()--in local gamemenu={} gameMenu=gui System:Print("TextShow") local Talkingpanel={} local scale = 1 --GUI local gui = GUI:Create(context) -----------------------no need for this ------------------ --gui:Show() --gui:SetScale(scale) --gui:GetBase():SetScript("Scripts/GUI/Panel.lua") --gui:GetBase():SetObject("backgroundcolor",Vec4(0.2,0.2,0.2,1)) ------------------------------------------------------------ Talkingpanel.gui=gui Talkingpanel.context = context Talkingpanel = Widget:Panel(gui:GetBase():GetClientSize().x/2+150,gui:GetBase():GetClientSize().y/2-300,500,600,gui:GetBase()) Talkingpanel:SetAlignment(0,0,0,0) Talkingpanel.Talkingpanel=Talkingpanel Talkingpanel=Talkingpanel local widget widget = Widget:Tabber(indent,indent,Talkingpanel:GetClientSize().x-indent*2,Talkingpanel:GetClientSize().y-indent*2,Talkingpanel) widget:AddItem("Old Man",true) x=30 y=60 --Talkingpanel = Widget:TextArea(indent,indent,400,150,Talkingpanel) --Talkingpanel = Widget:TextArea(x,y,Talkingpanel:GetClientSize().x-indent*2-50,Talkingpanel:GetClientSize().y-indent*2-300,Talkingpanel) --Talkingpanel:SetText("Mhm? What do you want from me?") Talkingpanel:SetObject("backgroundcolor",Vec4(0.15,0.15,0.15,1)) Talkingpanel.tabber = widget local indent = 12 Talkingpanel = Widget:Panel(indent,indent,widget:GetClientSize().x-indent*2,widget:GetClientSize().y-indent*2-30,widget) Talkingpanel = Widget:TextArea(x,y,Talkingpanel:GetClientSize().x-indent*2-50,Talkingpanel:GetClientSize().y-indent*2-300,Talkingpanel) --------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------Dialog 1----------------------------------------------------------------------------- Talkingpanel:SetText("Mhm? What do you want from me?") Talkingpanel:SetBool("border",true) Talkingpanel.panel={} Talkingpanel.panel.general=panel Talkingpanel.closeoptions = Widget:Button("Close",widget:GetClientSize().x-72-indent,widget:GetClientSize().y-28-5,72,28,widget) Talkingpanel.closeoptions:SetStyle(BUTTON_CANCEL) ------------------------------------------------------------------------------------------------------------------ Talkingpanel.Conservation1 = Widget:Button("Who am i?",widget:GetClientSize().x-450-indent,widget:GetClientSize().y-250,72,28,widget) Talkingpanel.Conservation1:SetStyle(BUTTON_CANCEL) ------------------------------------------------------------------------------------------------------------------ local y=20 local sep=40 ----------------------------------------------------------------------------------------------------- while true do Time:Update() window:ShowMouse() if window:Closed() then return end --if window:KeyHit(Key.Escape) then return end ---------------------------------------------------------------------------------------------- function Talkingpanel:ProcessEvent(event) if event.id == Event.WidgetAction then if event.source == self.closeoptions then System:Print("WidgetAction") self.component:CallOutputs("Close") Talkingpanel.button:Hide() window:FlushMouse() window:FlushKeys() window:HideMouse() window:SetMousePosition(window:GetWidth()/2,window:GetHeight()/2) gui:Hide() widget:Hide() end end end function Talkingpanel:Update() if self.closeptions:GetText()=="Close" then self:ProcessEvent(Event(Event.WidgetAction,self.closeoptions)) end while EventQueue:Peek() do local event = EventQueue:Wait() if self:ProcessEvent(event)==false then return false end end return true end context:Sync() end end
×
×
  • Create New...