Creating an NRaas project Creating object with custom script ingame with CreateObjectOutOfWorl method

Talk nerdy to us here.
icarus_allsorts
Reactions:
Posts: 213
Joined: March 8th, 2012, 6:00 pm

Post by icarus_allsorts » March 18th, 2014, 12:41 pm

Thanks for the help :)

User avatar
Chain_Reaction
Site Admin
Reactions:
Posts: 7595
Joined: December 30th, 2011, 6:00 pm
Answers: 81
Contact:

Post by Chain_Reaction » March 19th, 2014, 12:25 am

Custom scripted object creation is painful. Pretty sure the game isn't fond of a new class being assigned to an existing object. To test, try changing the scripting class in GlassBar's OBJK to your new one (Resource Key: 0x02DC343F-0x00000000-0x0000000000000498). Does it work?

icarus_allsorts
Reactions:
Posts: 213
Joined: March 8th, 2012, 6:00 pm

Post by icarus_allsorts » March 19th, 2014, 12:45 am

Hmm, I did try cloning the GlassBar object, but didn't think of trying an outright object override. Will try that once I get home, thanks.

icarus_allsorts
Reactions:
Posts: 213
Joined: March 8th, 2012, 6:00 pm

Post by icarus_allsorts » March 22nd, 2014, 3:04 pm

So I've revisited the mod and followed JunJay's suggestion to redo my custom object class from scratch, this time inheriting from GameObject and pretty much the same interfaces as Bar.Glass and...

It WORKED! Not only was the bar glass created, it correctly carried the custom object class like I intended! *~Does Happy Dance~*

I'm GUESSING that the class has to directly inherit from either GameObject or IScriptObject in order to be successfully created with this method. But wtv, I'm just so glad it finally works! Thanks a bunch guys, especially JunJay for pointing me in the right direction :)

User avatar
JunJayMdM
Reactions:
Posts: 262
Joined: April 2nd, 2012, 6:00 pm

Post by JunJayMdM » March 23rd, 2014, 11:06 am

You're welcome, glad to hear it worked :)

Most of the time it's always best to do what EA does, and if they add new objects like that, then we should follow it, the reason being that they have some sort of background code that we can't see, some common dll picking up on stuff we have no clue about and sometimes the problem can be the most unsuspected thing, like the name of a method or a particular naming criteria for the class.

icarus_allsorts
Reactions:
Posts: 213
Joined: March 8th, 2012, 6:00 pm

Post by icarus_allsorts » March 23rd, 2014, 1:54 pm

You'd think I'd learn my lesson by now, this is the I don't know how many-th time something I've attempted has blown up just because I thought I could get away with saving code and just inheriting from large classes. (Though I did learn that I COULD get away with it for Interaction Definitions by overriding the CreateInstance method, but I guess that just made me cocky :P)

User avatar
Chain_Reaction
Site Admin
Reactions:
Posts: 7595
Joined: December 30th, 2011, 6:00 pm
Answers: 81
Contact:

Post by Chain_Reaction » March 24th, 2014, 12:25 am

Glad you got it going! It's always best to do your own thing wherever possible I've found. Once you get lost in the EA maze you will end up hairless trying to figure it out. :P

Post Reply