Page 1 of 1

Two quick lua mishaps [Solved]

Posted: Tue Jul 22, 2014 12:57 am
by Noobasaurus
Not really lua mishaps, but they both involve it.

Firstly, I've removed a line from one of my functions in my lua that teleports one person to another when something happens. However, when that something happens, the person is still teleported. The line that makes it happen does not exist. I've just done a manual clean and nothing has changed.

Secondly, I'm trying to create an effect on a person. Everything works fine except that I get this error when it happens.

Code: Select all

Message Severity: 2
C:\Battlefront2\main\Battlefront2\Source\LuaCallbacks_Mission.cpp(4519)
Effect class "com_sfx_blue" not found
I've loaded that effect through the world's effects folder, the sides' effects folders, and through common's effects folder using ingame.lvl. And it just doesn't want to show up. Here's how I'm spawning it.

Code: Select all

				AttachEffectToMatrix(CreateEffect("com_sfx_blue"), GetEntityMatrix(object))
Help is greatly appreciated.

Re: Two quick lua mishaps

Posted: Tue Jul 22, 2014 10:02 am
by Locutus
If you want to have help with the first issue I think it is necessary that you provide more information/showing the function.

Regarding your second issue, well, the code looks correct. I've also used this command and got the same error until I noticed that I forgot to add the effect to my MAP.req (was loading the effect in my world1 folder). Now, I don't think theres any difference between loading an effect through the world req or the ingame level but are you sure you added the name of your effect in the config section of your ingame.req?

Re: Two quick lua mishaps

Posted: Tue Jul 22, 2014 11:31 am
by Noobasaurus
Thanks. The second problem is solved now, I only had the effects in "texture" and not "config."

Here's the part of the lua where it used to be.

Code: Select all

	scanner = OnObjectDamage(function(object, damager)
		if GetObjectLastHitWeaponClass(object) == "imp_weap_inf_scanner" and GetObjectTeam ~= 0 then
			if GetObjectTeam(object) == 2 then
				AttachEffectToMatrix(CreateEffect("com_sfx_red"), GetEntityMatrix(object))
			end
			if GetObjectTeam(object) == 3 then
				AttachEffectToMatrix(CreateEffect("com_sfx_blue"), GetEntityMatrix(object))
			end
			if GetObjectTeam(object) == 1 then
				AttachEffectToMatrix(CreateEffect("com_sfx_red"), GetEntityMatrix(object))
			end
		end
    end)
So basically when I hit them with a weapon it teleports them to me and makes them float a bit. That's not what I want. I've searched through the entire thing and there aren't any more lines that could make it happen.

Re: Two quick lua mishaps

Posted: Tue Jul 22, 2014 11:38 am
by Locutus
Hmm, I don't see any teleporting code in that function :p

Re: Two quick lua mishaps

Posted: Tue Jul 22, 2014 11:42 am
by Noobasaurus
WAIT. Nevermind, solved. It was the weapon the whole time. It didn't teleport the person anymore but it still choked them, and the choking part was the actual weapon.