Page 1 of 1

Grappling Hook Code research

Posted: Sat Feb 28, 2009 5:23 pm
by Fiodis
We all know, I'm sure, about Mav's clever workaround to the no-grapple problem. He wrote up a code that, I think, went something like this: upon hitting a certain type of object with a certain weapon, teleport the player to the object's location.

After pinning down a few basics of LUA, I tried to compose a code that would duplicate this effect. After all, I'm sure we'd all love to use a grappling hook in our maps! :)

Here's the code (so far), where "grapple_target" is the name of the object's ODF. The object is, for now, a destructable prop placed in ZE. "rep_inf_grapple" is the ODF name of the grappling hook weapon. For the purpose of testing, I just copied the republic stock EMP launcher, toned down it's damage, and renamed it (odf, ord, and exp).
Hidden/Spoiler:
[code]
grapplefunction = OnObjectDamage (
function (object, damager)
if GetEntityClass (object) == "grapple_target" and IsCharacterHuman (damager) and GetObjectLastHitWeaponClass (object) == "rep_inf_grapple" then
GetEntityMatrix (object)
MoveEntityToMatrix (damager, object)
end
end
)
[/code]
This is under ScriptPostLoad. I'm rather sure some of it is incorrect (not sure how to get the matrix and cite it) but the thing is that it munged perfectly without any mungelog complaints.

Still, I get a CTD right after loading the map. The only Severity: 3, shown below, apparently has nothing to do with the LUA or the weapon.
Hidden/Spoiler:
[code]Message Severity: 3
.\Source\Weapon.cpp(1604)
Weapon base class "com_weap_inf_lightsaber" not found[/code]
This confuses me because I don't use lightsabers. Why would this happen?

Re: Grappling Hook Code research

Posted: Sat Feb 28, 2009 5:27 pm
by YaNkFaN
did you copy the common folder when you made a custom side?

Re: Grappling Hook Code research

Posted: Sat Feb 28, 2009 5:32 pm
by Fiodis
D'oh! :oops:

Makes another one for that "embarrasing modding mistakes" topic....

I'll fix that and report on the code's status.

Re: Grappling Hook Code research

Posted: Sat Feb 28, 2009 5:37 pm
by YaNkFaN
yea i always get that error cause i forget to put in the common folder the game i believe checks to see if it can find all the weapons whether you've loaded them or not i believe or maybe if u have a hero then it checks but neway if you see that error or any error about a com_item_something check to see if you put your common folder where it belongs :thumbs:

Re: Grappling Hook Code research

Posted: Sat Feb 28, 2009 5:40 pm
by Maveritchell
Of course you could have just asked what lua code I used and saved yourself the trouble. I don't mind sharing how I set it up, provided no one releases anything with it in it until I've released "The Big 'L'."

Re: Grappling Hook Code research

Posted: Sat Feb 28, 2009 5:42 pm
by Fiodis
I thought you didn't take requests?

And off-topic, you're still working on the Big L? :D Been such a while since that topic was posted in I thought you gave it up for Battlefront Unleashed.

Well, if you're willing to give out the code, that'd be great, and thanks!

About my own attempt: didn't work. Nothing showed up in the error log about it, either.

Re: Grappling Hook Code research

Posted: Sat Feb 28, 2009 5:52 pm
by Maveritchell
Fiodis wrote:And off-topic, you're still working on the Big L? :D Been such a while since that topic was posted in I thought you gave it up for Battlefront Unleashed.
No, "Rebel Ops" is still in the works. Because I like it as a project more than Battlefront Unleashed, I wanted to get Unleashed out of the way first (but I only work on one thing at a time).

I'll PM you the code.