Jump to content

Introduction/questions


insomniac_lemon
 Share

Recommended Posts

Hello.

 

I recently purchased this program on Steam because I wish to make my own game, basically an RPG inspired by the many downfalls discovered after playing copious amounts of Oblivion/Skyrim. Things like gold/stature being relatively useless and easy to acquire, inventory management being tedious, useless items, and seemingly important things like bartering needing to be fleshed out. I also have tons of ideas on how the spell/combat system can be improved, and have story/mechanic ideas from an unrelated RPG idea I had previously.

 

One of the main reasons I was interested in Leadwerks was the Linux support, as it seems the Unreal editor does not yet support it (at least not according to their site), plus Leadwerks seems to be more user-friendly in a *few* ways.

 

Naturally, I have a few questions....

 

1. Is dual-wielding weapons supported, or would I need to somehow make custom scripts, and weapon-combo prefabs from those instead?

 

2. Is it possible to take a skeletal-like structure (like the FPSPlayer prefab) and animate that using kinematics and scripted modifications (such as for different weapons/spells) to do movements instead of pre-made animations? (obviously binding a skin to it later?)

 

3.With the indie version, is it possible to unlock the mouse so I can try maximizing the window?

 

 

Unrelated, how do I change my forum avatar? I don't see the option anywhere.

Link to comment
Share on other sites

1. Leadwerks is a game engine. Anything gameplay related has to be programmed. There are some gun examples in the deafult SDK but dual wielding is not part of that. This is something you would have to make yourself.

 

2. This is really complex stuff you are talking about here. I would not recommend doing this and rather use existing animations.

 

3. 2 answers here: Yes you can inlock the mouse: ShowMouse() to view it and making sure the Mouse coordinates are not centered every frame. Maximizing a window can also done by code. http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/window/windowcreate-r462

  • Upvote 1
Link to comment
Share on other sites

1. Leadwerks is a game engine. Anything gameplay related has to be programmed. There are some gun examples in the deafult SDK but dual wielding is not part of that. This is something you would have to make yourself.

 

2. This is really complex stuff you are talking about here. I would not recommend doing this and rather use existing animations.

 

3. 2 answers here: Yes you can inlock the mouse: ShowMouse() to view it and making sure the Mouse coordinates are not centered every frame. Maximizing a window can also done by code. http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/window/windowcreate-r462

 

1. I know, I was just thinking out loud and asking in case others knew something I didn't. So am I right in thinking in my situation I should be avoiding the weapon prefab situation altogether and just use scripts with needed variables (left/right hand, spell info) and call them through code?

 

2. Again, I know.... but when it comes to character customizability (different clothes, armor, etc) it would be an easier setup, and I'd love if I could make hits so they actually.... hit... rather than just passing through the enemy. I'd like it if the enemy hit could influence the way the weapon keeps going, along with the ability to cause dynamic destruction (cut off limbs, dent armor, collide weapons) is probably even more advanced, but something I hope I could eventually do.

 

3. Thanks! Tried both, and they worked perfectly. I never actually thought to look in app.lua (I didn't really know about it).....

Link to comment
Share on other sites

1. I know, I was just thinking out loud and asking in case others knew something I didn't. So am I right in thinking in my situation I should be avoiding the weapon prefab situation altogether and just use scripts with needed variables (left/right hand, spell info) and call them through code?

 

Since you are just starting out I would encourage you to play around with the autopistol prefab. It think it is easier to edit an existing script rather than writing it from scratch. Majority of the ground work is already there.

Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)

Link to comment
Share on other sites

Definitely look at everything that comes with the engine.

 

For example, many spells are really nothing but very flashy bullets. You'll have a cast (fire) anim + instantiate the spell effect (bullet) with travel and then on collision you can create another anim/efffect and add damage to the player. The existing gun code gives you a framework to adapt to your needs, much faster than starting from scratch.

content over form, game play over all.

Link to comment
Share on other sites

Since you are just starting out I would encourage you to play around with the autopistol prefab. It think it is easier to edit an existing script rather than writing it from scratch. Majority of the ground work is already there.

Definitely look at everything that comes with the engine.

 

For example, many spells are really nothing but very flashy bullets. You'll have a cast (fire) anim + instantiate the spell effect (bullet) with travel and then on collision you can create another anim/efffect and add damage to the player. The existing gun code gives you a framework to adapt to your needs, much faster than starting from scratch.

 

 

My major problem is many things are behind the scenes, like how you see the weapon prefab, but there's no clear link to the script it uses (although it's clear if you're LOOKING for it in the scripts section)

 

I think I understand most of it, but trying to make my own script/prefab has not worked thus far. Even pasting in the autopistol's code into my script causes a sprite to appear at [0,0,0] which tells me I've made the prefab wrong. What I did was make a pivot near the player, attach the script in that, and make that into a prefab [i've tried different parent/prefab combos].

 

So my real question here, as I've not seen and tutorials on it yet, either/or

 

How do you actually MAKE weapon prefabs? Also,

 

How exactly am I supposed to be getting the user's position? What I thought worked doesn't seem to, so I'm assuming I'm missing some crucial piece? What about numbers for velocity, how does that work in relation to the player?

 

 

The reason why I'd like to make my own script is because what I'm trying to do is fundamentally different on many levels, and many things in the autopistol script don't really apply. I get that bolt spells *would* be useful to still use bullets (especially if I could attach an emitter to the bullet), but what I'm trying to do first is make a flamethrower/stream spell, so instead of a bullet I'd like to use actual emitted particles instead.

 

How exactly would I call the script manually instead of from a prefab? I already know that I'm likely going to abandon it later, because of the amount of possibilities for dual wield combinations it woudn't be worth making a prefab for each one (unless it's possible to load multiple weapon prefabs at once, say for left and right?).

Link to comment
Share on other sites

While in the weapon script I'd say self.player:GetPosition() should return an appropriate vec3.

 

To make a prefab afaik you create the entity with all its scripts, materials and such and then in the scene tab just do save as prefab. I know that if I don't give the name with the .pfb suffix then its not treated as a prefab. The prefab is your final step though, you do all the work on your created entity first. I wouldn't even consider looking at making something a prefab until I'd finished debugging the source entity.

 

As for the dual wield thing, for weapons and spells I'd guess you would need to pass an additional argument into the different weapon scripts signifying if they being used left or right handed. The scripts would then have to load either the left or right handed images and animations and also choose between left and right offsets to keep everything consistent.

 

I think I'm making sense....

content over form, game play over all.

Link to comment
Share on other sites

  • 2 weeks later...

While in the weapon script I'd say self.player:GetPosition() should return an appropriate vec3.

 

To make a prefab afaik you create the entity with all its scripts, materials and such and then in the scene tab just do save as prefab. I know that if I don't give the name with the .pfb suffix then its not treated as a prefab. The prefab is your final step though, you do all the work on your created entity first. I wouldn't even consider looking at making something a prefab until I'd finished debugging the source entity.

 

As for the dual wield thing, for weapons and spells I'd guess you would need to pass an additional argument into the different weapon scripts signifying if they being used left or right handed. The scripts would then have to load either the left or right handed images and animations and also choose between left and right offsets to keep everything consistent.

 

I think I'm making sense....

 

I've switched over to trying to use a box that's repositioned, but so far it seems to not be working at all. It rotates with the view, but seems to stay in one place.

 

My specific code for that so far is:

 

function Script:Draw()

    local place
    place= self.player.camera:GetPosition()
self.entity:SetPosition(place)
self.animationmanager:Update()

end

 

Full script:

 

 

import "Scripts/AnimationManager.lua"

Script.index=1--int "Weapon slot"
Script.offset=Vec3(0,0,0)--Vec3 "Offset"
Script.rotation=Vec3(0,0,0)--Vec3 "Rotation"
Script.clipsize=6--int "Clip size"
Script.ammo=200--int "Ammunition"
Script.maxswayamplitude=0.01
Script.amplitude=0
Script.swayspeed=0
Script.timeunits=0
Script.smoothedposition=Vec3(0)
Script.smoothedrotation=Vec3(0)
Script.verticalbob=0
Script.jumpoffset=0
Script.bulletspeed=200--float "Bullet speed"
Script.landoffset=0
Script.pellets=1--int "Pellets"
Script.scatter=0.01--float "Scatter"
Script.firetime=0
Script.refirerate=100--int "Refire rate"
Script.bulletrange=1000
Script.muzzleflashscale=0.2--float "Flash size"
Script.bulletforce=500--float "Force"
Script.bulletdamage=10--int "Damage"
Script.automatic=true--bool "Automatic"
Script.dryfiresoundfile=""--path "Dry fire" "Wav File (*wav):wav|Sound"
Script.fire1soundfile=""--path "Fire sound 1" "Wav File (*wav):wav|Sound"
Script.fire2soundfile=""--path "Fire sound 2" "Wav File (*wav):wav|Sound"
Script.fire3soundfile=""--path "Fire sound 3" "Wav File (*wav):wav|Sound"
Script.pumpsoundfile=""--path "Pump sound" "Wav File (*wav):wav|Sound"
Script.ricochet1soundfile=Sound:Load("Sound/Ricochet/bullet_impact_dirt_01.wav")
Script.ricochet2soundfile=Sound:Load("Sound/Ricochet/bullet_impact_dirt_02.wav")
Script.ricochet3soundfile=Sound:Load("Sound/Ricochet/bullet_impact_dirt_03.wav")
Script.reloadsoundfile=""--path "Reload sound" "Wav File (*wav):wav|Sound"
Script.reloadspeed=0.05--float "Reload speed"
Script.firespeed=0.05--float "Fire speed"
Script.tracer = Sprite:Create()
Script.tracer:Hide()
Script.currentaction=nil


function Script:Start()

if self.started then return end
self.started=true

self.entity:SetAnimationFrame(0,1,"fire")

self.entity:Hide()


self.entity:SetShadowMode(0)
self.entity:SetOcclusionCullingMode(false)
self.currentaction=nil
self.clipammo=self.clipsize

self.ammo = self.ammo - self.clipammo
self.muzzle = self.entity:FindChild("muzzle")

self.sound={}
self.animationmanager = AnimationManager:Create(self.entity)
self.originalposition = self.entity:GetPosition()
self.originalrotation = self.entity:GetRotation()
self.emitter={}


--Create the water mist emitter
self.emitter[0]=Emitter:Create()

--Create the water mist material
self.emitter[0]:SetMaterial("Materials/Effects/muzzleFlash.tex")
self.emitter[0]:SetEmissionVolume(0.5,0.5,0.5)
self.emitter[0]:SetColor(1,0.1,0.1,1)
self.emitter[0]:SetVelocity(1.5,1.5,1.5,1)
self.emitter[0]:SetParticleCount(10)
self.emitter[0]:SetReleaseQuantity(10)
self.emitter[0]:SetMaxScale(0.3)
self.emitter[0]:SetDuration(1000)
self.emitter[0]:SetAcceleration(0,-12,0)
self.emitter[0]:Hide()


--emitter:AddScaleControlPoint(0,1) --sets inital scale to 1
-- emitter:AddScaleControlPoint(1,3) --sets final scale to 3

--emitter:AddAlphaControlPoint(0,0) --sets inital alpha to 0
--emitter:AddAlphaControlPoint(1,1) --sets final alpha to 1



return true



end



function Script:UpdateWorld()
local pickinfo=PickInfo()
end


--[[
function Script:UpdatePhysics()

end
]]--

--[[
function Script:Collision(entity, position, normal, speed)

end
]]--


function Script:Fire()
local pickinfo=PickInfo()
local e
local place
place= self.player.camera:GetPosition()
e = self.emitter[0]:Instance()
e = tolua.cast(e,"Emitter")
e:Show()
e:SetLoopMode(false,true)
e:SetPosition(place)
local v=0.2
e:SetVelocity(100, 0, 0 ,0)


end



function Script:Draw()

local place
place= self.player.camera:GetPosition()
self.entity:SetPosition(place)
self.animationmanager:Update()


end


--[[
function Script:DrawEach(camera)

end
]]--

--[[
--This function will be called after the world is rendered, before the screen is refreshed.
--Use this to perform any 2D drawing you want the entity to display.
function Script:PostRender(context)

end
]]--


function Script:Hide()
self.entity:Hide()
self.muzzleflash:Hide()
self.muzzlelight:Hide()
end


--[[
--This function will be called when the entity is deleted.
function Script:Detach()

end
]]

function Script:Release()
self.emitter[0]:Release()
self.emitter[1]:Release()
self.emitter=nil
ReleaseTableObjects(self.sound)
end



--This function will be called when the last instance of this script is deleted.
function Script:Cleanup()
self.Release()
end

 

 

Please forgive me for I'm still in the stage where I'm not sure what to do next. I'm sure my emitter isn't working, but it could be emitting somewhere I can't see, which is why getting the positioning working properly is important. I hope this has an easy fix, but there's so much non-basic stuff (view bob, bullet tracer, etc.) that makes it hard for me to understand how it's been (or how it SHOULD be) done.

Link to comment
Share on other sites

You are taking local camera position and it's always the same for camera. Use :GetPosition(true) and :SetPosition(place, true) to work with global position.

 

Thanks, I got it working now, that was one of my issues. (another was needing an offset so a non-colliding model would appear).

 

Why is it that SetRotation doesn't need to be done, but the rotation still occurs?

 

Also, am I doing something wrong with my emitter that would cause it not to work?

 

 

 

import "Scripts/AnimationManager.lua"

Script.index=1--int "Weapon slot"
Script.offset=Vec3(1,-0.6,0)--Vec3 "Offset"
Script.rotation=Vec3(0,0,0)--Vec3 "Rotation"

function Script:Start()

       if self.started then return end
self.started=true
       self.entity:SetPickMode(0)
self.entity:SetAnimationFrame(0,1,"fire")


self.entity:SetShadowMode(0)
self.entity:SetOcclusionCullingMode(false)
       self.currentaction=nil

self.sound={}
self.animationmanager = AnimationManager:Create(self.entity)
self.originalposition = self.entity:GetPosition()
self.originalrotation = self.entity:GetRotation()
self.emitter={}


      --Create the water mist emitter
       self.emitter[0]=Emitter:Create() 

       --Create the water mist material
       self.emitter[0]:SetMaterial("Materials/Effects/muzzleFlash.tex")
       self.emitter[0]:SetEmissionVolume(10,10,10) 
self.emitter[0]:SetColor(1,0.1,0.1,1)
self.emitter[0]:SetVelocity(2,0,0,1)
self.emitter[0]:SetParticleCount(100)
self.emitter[0]:SetReleaseQuantity(10)
self.emitter[0]:SetMaxScale(100)
self.emitter[0]:SetDuration(1000)
self.emitter[0]:SetAcceleration(0,-12,0)
self.emitter[0]:Hide()


       --emitter:AddScaleControlPoint(0,1)  --sets inital scale to 1
      -- emitter:AddScaleControlPoint(1,3)  --sets final scale to 3

       --emitter:AddAlphaControlPoint(0,0)  --sets inital alpha to 0
       --emitter:AddAlphaControlPoint(1,1)  --sets final alpha to 1





       return true



end



function Script:UpdateWorld()
local pickinfo=PickInfo()
end


--[[
function Script:UpdatePhysics()

end
]]--

--[[
function Script:Collision(entity, position, normal, speed)

end
]]--


function Script:Fire()
       local pickinfo=PickInfo()
local e
       local place
       place= self.player.camera:GetPosition(true)
       e = self.emitter[0]:Instance()
e = tolua.cast(e,"Emitter")
e:Show()
e:SetLoopMode(false,true)
e:SetPosition(place, true)
local v=3
e:SetVelocity(10, 0, 0 ,0)


end



function Script:Draw()

       local place
       place= self.player.camera:GetPosition(true)
self.entity:SetPosition(place+self.offset, true)
self.animationmanager:Update()


end


--[[
function Script:DrawEach(camera)

end
]]--

--[[
--This function will be called after the world is rendered, before the screen is refreshed.
--Use this to perform any 2D drawing you want the entity to display.
function Script:PostRender(context)

end
]]--


function Script:Hide()
self.entity:Hide()
end


--[[
--This function will be called when the entity is deleted.
function Script:Detach()

end
]]

function Script:Release()
       self.emitter[0]:Release()
self.emitter[1]:Release()
self.emitter=nil
ReleaseTableObjects(self.sound)
end



--This function will be called when the last instance of this script is deleted.
function Script:Cleanup()
self.Release()
end

 

 

 

Basically what I'm trying to accomplish is to have a jet of particles (like a flamethrower) spew forwards from the character, but I don't see any indication of ANY particles after holding the left mouse button and looking around.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...