Ma-Shell
-
Posts
371 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Ma-Shell
-
-
It has to be "self.mode" inside the UpdatePhysics()-Function (My bad )
If it still doesn't work, try printing the value of "self.removeBodyTimer" after increasing it and see, if this creates any usable information.
-
Your EndDeath()-Function only gets called once, after the dying-animation is finnished. Assuming, you want the timer to start then, you should replace
self.removeBodyTimer = self.removeBodyTimer + (Time:GetSpeed()/100)
at that point by
self.removeBodyTimer = 0
Then you have to increase the timer every frame and check, if its value exceeded the given threshold. So, you should move the line, you originally had into UpdatePhysics()-Function.
You should have a chunk there that says:
if mode == "dead" then self.removeBodyTimer = self.removeBodyTimer + (Time:GetSpeed()/100) if (self.removeBodyTimer > self.removeBodyTime) then self.entity:Release() end end
-
Just one silly begginer question, will the Leadwearks gui work with C++ or I have to always compile from CodeBlocks (if I have no codechanges ...)
Whenever you make code-changes for c++, you will have to compile yourself (usually from within code::blocks). The Leadwerks-GUI only offers an option to run the existing executable binary. This works for LUA-Projects always because the LUA-Code is not compiled into the binary and thus the actual binary doesn't change (and there is a default one from the creation of the project).
EDIT:
So, if you have no codechanges and compiled it once, you can use the button.
-
Well, the whole point of EmitSound is an easy way to make an entity make some noise. I didn't want it to require any additional management.
Finally found some time and noticed, this also happens, if I create the source myself, without the use of EmitSound but with "Create", "SetSound" and "Play". From your statement I read, EmitSound should just be a convenient way for doing that, which makes sure, I never use a reference to the created source.
The way it is currently there is absolutely no point in getting a reference to a source and use that, as you can never be sure, it does not vanish, before you use it. That fact is taking a lot of possibilities from you for actually no advantage.
I can only repeat: That is, what a reference counter is for... Everyone, who needs a reference increases the refcount and when it is done, it releases it, with the last one destroying the object. So, if I need a reference, I explicitly increase the refcount and when I'm done, I release it. Meanwhile the engine increases the refcount by ONE, while it plays the sound and decreases by ONE, when it is done.
- 1
-
Did you assign an object to muzzleFlash?
-
I guess, there are some weird characters in your windows-username and thus also in the path of all the resources, maybe they are causing this.
What happens, when you try to start the game? Is there also an empty window or an error?
-
Well, the whole point of EmitSound is an easy way to make an entity make some noise. I didn't want it to require any additional management.
But the only time you would have to do any additional management is, if you want to. If you don't want additional management, you just don't get yourself a reference and don't call addRef.
That's exactly the purpose of the reference-counter-concept.
If you want more control over your played sounds you can always use the source class.
That's exactly, what I'm doing here but only I let EmitSound create the source for me and then get myself a pointer to that instance.
Or does this problem not occur, if I create the source myself?
What about the response you posted here: http://www.leadwerks.com/werkspace/topic/10830-entityemitsound-loop-stop-and-restart/#entry79363
Is this forthcoming?
There is no point in getting a reference to the created source, if this is the intended design, as you can not be sure, the source is still there, when you want to access it.
-
Even if I called addRef? So it is basically impossible to find out, whether a source has finished playing.
-
Josh, could you please confirm, whether this is the intended behavior or not. At the moment this is game breaking for me but I wouldn't want to do a (more or less dirty) workaround, if this is fixed anytime soon.
-
It turns out libsteam_api.so isn't copied into the directory when I build the project, which is a bit of an annoyance. But it seems to work when I copy libsteam_api.so to the published project's root directory.
-
Does this imply that there will be a release for Linux on steam in the NEAR future?
It is already there:
-
From monster.cpp the variables defined in your main.cpp are not visible (why should they be, the file is not included). Try moving the declarations of monsteriter and monsterarray to monster.h.
Edit:
You will have to put them at the end of the file because otherwise the class monster, which is needed, won't be defined.
Also be careful to place the definition outside the class.
-
The reason for this design is returning a source would require the user to release it.
If there was only a pointer returned, that would not be the case.
IMHO the most logical way to do that would be:
A pointer to the created source is returned but the refcounter is not increased.
If the user wants to keep the reference, he can increase its refcounter (src->AddRef()), so it would not be automatically removed, when it finished playing (the refcount would only be decreased by 1 (Currently it isn't even possible to keep the reference any further due to the bug I reported here: http://www.leadwerks.com/werkspace/topic/10804-finished-sound-sources-are-released-every-frame/)). If the user does not add a reference, the source will be removed once it finished and the user might end up with a corrupt reference, but that would be the user's own fault.
- 1
-
In C++ you can do
emitter->EmitSound(snd); Source* s = emitter->activesources.front();
with emitter being an Entity and snd a Sound.
Surely this isn't the cleanest way. I agree, it would be nice to have the actual Source returned by the Emit-Call.
- 1
-
Hi,
When a source has finished playing it gets released every frame. This is a problem, if you want to find out, if it has finished playing, as you can't keep the source (even if you add n AddRefs() for the source, the source will be gone n frames after it finished playing).
You can see this by adding a global static variable:
[App.h add as class-member] static Source* src; [App.cpp] Source* App::src; [App.cpp: App::Start()] Sound* s = Sound::Load("Sound\\Footsteps\\jump.wav"); Entity* e = world->entities.front(); e->EmitSound(s); src = SoundDriver::GetCurrent()->sources.front(); src->AddRef(); src->AddRef(); src->AddRef(); src->AddRef(); [App.cpp: App::Loop()] printf("Time: %f, Refs: %i\n", src->GetTime(), src->GetRefCount());
Will lead to the following output:
(...) Time: 0.074989, Refs: 5 (...) Time: 0.000000, Refs: 5 Time: 0.000000, Refs: 4 Time: 0.000000, Refs: 3 Time: 0.000000, Refs: 2 Time: 0.000000, Refs: 1
And an access violation after that, when accessing the GetTime()-method of the source.
The expected behaviour would be, that the RefCount is decreased only once, so if I added Refs before, I have to release it myself.
I even tried, setting "src->autorelease = false" but that didn't change anything.
- 1
-
When I place those shaders in the corresponding folder of the template project, update my project and restart Leadwerks, the problem is gone.
So it seems, Josh forgot to add them to the standalone-version.
-
Standalone here, problem still persistent. As mentioned, I think, the modified shaders aren't downloaded, as they are from april. Even if I run the updater, it says, everything is up to date.
- 1
-
I also get those errors. It seems, like you forgot to upload the new shaders, as the two you mentioned (at least in my template-project) are from April and if I hit update in my project, svn as well doesn't find any changes to the shaders
-
Just replace
if Math:Round(self.selected:GetRotation(true).x) == self.rotAngle.x
By
if Math:Abs(self.selected:GetRotation(true).x - self.rotAngle.x) < threshold
Where you have to choose an acceptable threshold
- 1
-
As far, as I understand the question, the problem seems to be, OP wants the files to be present to every project he has.
I assume, placing your assets within your LeadwerksInstallDir\Templates\Common folder will make them available in every project you create afterwards, as this folder seems to simply be copied.
-
I would guess, they are in object space. In that case you would have to multiply them by the transformation matrix of your entity.
-
This disables the usage of external libraries and some packages that might be dangerous.
If you want to publish to the steam-workshop, you have to use this, I think.
For further information see:
-
I'm not too experienced in LUA but I would guess, you didn't define the key-value "name" for the ground and thus the function returning nil for that case and a comparison between nil and a String isn't possible (as said, I don't know about LUA, but I would guess that's the case). So have you tried checking whether it is nil before doing that? Something like:
if pickinfo.entity:GetKeyValue("Name") then --This is the same as a comparison with ~= nil if pickinfo.entity:GetKeyValue("Name") == "Block" then pickinfo.entity:Release() end end
- 1
-
It should say LoadWeapon (with a big W)
Need Help with MonsterAI script
in Programming
Posted
You put the chunk inside the
if self.mode == "attack"
Block.
This is bound to fail. Move it outside.