How do you make catapults work?

Post » Thu Jun 21, 2012 4:00 am

So I'm trying to use some CWCatapults as part of a siege on a city, and I'm having an issue that I figured I would. In the script it gives instructions on how to make them work. It says to Enable() them, then call TurnOn(). They are always enabled for me (Not Initially Disabled)so I just did Catapult1.TurnOn(), and as expected, it said TurnOn() wasn't a function.

How do I make it recognize that function? I think it's built into the script that's ON the catapults, but I need to call the TurnOn() from my scene script. I figure I need to use 'as' here again, but I'm not sure how.

Thanks for any help,
Alexander J. Velicky
User avatar
Kayleigh Mcneil
 
Posts: 3352
Joined: Thu Jun 29, 2006 7:32 am

Post » Thu Jun 21, 2012 1:21 pm

Anyone? I'm filming the shots that would really look a lot cooler with the catapults firing in them in about 15 minutes, so it's now or never. :F
User avatar
Adrian Morales
 
Posts: 3474
Joined: Fri Aug 10, 2007 3:19 am

Post » Thu Jun 21, 2012 9:23 am

Have you tried importing stuff?

Like "import game" or "import utility" etc
User avatar
electro_fantics
 
Posts: 3448
Joined: Fri Mar 30, 2007 11:50 pm

Post » Thu Jun 21, 2012 4:24 am

You just have to cast the object to get it's methods, right? Something like:

Scriptname LaunchAllZig extends ObjectReference  ObjectReference Property Catapult autoEvent OnActivate(ObjectReference akActionRef)	(Catapult as CWCatapult).Enable()	(Catapult as CWCatapult).TurnOn()EndEvent

I'm just not sure how to assign the reference you've placed to that property. Is that a ReferenceAlias? Still trying to clear up how CK/Papyrus cooperate. Guess it's too late now but Amethyst, Noob, Justin, or Ducey should still have the right answer. :)
User avatar
Iain Lamb
 
Posts: 3453
Joined: Sat May 19, 2007 4:47 am

Post » Thu Jun 21, 2012 5:18 pm

Have you tried importing stuff?

Like "import game" or "import utility" etc
You just have to cast the object to get it's methods, right? Something like:

Scriptname LaunchAllZig extends ObjectReference  ObjectReference Property Catapult autoEvent OnActivate(ObjectReference akActionRef)	(Catapult as CWCatapult).Enable()	(Catapult as CWCatapult).TurnOn()EndEvent

I'm just not sure how to assign the reference you've placed to that property. Is that a ReferenceAlias? Still trying to clear up how CK/Papyrus cooperate. Guess it's too late now but Amethyst, Noob, Justin, or Ducey should still have the right answer. :smile:
I tried all of that except Importing. Not sure exactly what that means. Im done filming, but I managed to still get a shot or two of them firing by running up to them, slowing down gametime, activating them then quickly positioning the camera before they fired. That will have to do.

Thanks for the help! I'm still open to suggestions as this is not only a part of the video, but of the mod itself so it will still benefit from me figuring this out!
User avatar
Maria Garcia
 
Posts: 3358
Joined: Sat Jul 01, 2006 6:59 am

Post » Thu Jun 21, 2012 2:06 am

Aenara has it right, you need to use casting. The name of the script is CWCatapultScript so according to your first post, you should use:

(Catapult1 as CWCatapultScript).TurnOn()

Make sure that your catapults have all the necessary scripts.
User avatar
Heather beauchamp
 
Posts: 3456
Joined: Mon Aug 13, 2007 6:05 pm

Post » Thu Jun 21, 2012 11:35 am

CWCatapultScript Property CatapultActivatorScript Auto
...then...
CatapultActivatorScript.TurnOn()


Whoa! Didn't know about casting as a script to get to the function. Cool!

Edit: Duh... like any other casting. Makes perfect sense now.
User avatar
Amy Cooper
 
Posts: 3400
Joined: Thu Feb 01, 2007 2:38 am

Post » Thu Jun 21, 2012 12:49 pm

Aenara has it right, you need to use casting. The name of the script is CWCatapultScript so according to your first post, you should use:

(Catapult1 as CWCatapultScript).TurnOn()

Make sure that your catapults have all the necessary scripts.
Figured it was something like this. But how do you get to that Catapult1 wired up?

That is to say... out on a cell somewhere there's a catapult placed called BlowUpMaiq. How do I get the parameter in Papyrus to point Catapult1 to the reference BlowUpMaiq so that TurnOn() is called.

I'm not at the CK so I'm having to guess it's the parameter type. Instead of ObjectReference it should be.... ReferenceThinger? The type that when you hit the Set Value button in the Parameter List it gives you the Select Object in Render Window button. And cross hairs. And such.

Wow. It's getting late. Sorry. If this doesn't make sense I'll edit it after I get some sleep. :blush:
User avatar
trisha punch
 
Posts: 3410
Joined: Thu Jul 13, 2006 5:38 am

Post » Thu Jun 21, 2012 10:41 am

CWCatapultScript Property CatapultActivatorScript Auto
...then...
CatapultActivatorScript.TurnOn()


Whoa! Didn't know about casting as a script to get to the function. Cool!
you can also cast as script to pull values from its variable or property. super cool indeed
User avatar
Strawberry
 
Posts: 3446
Joined: Thu Jul 05, 2007 11:08 am

Post » Thu Jun 21, 2012 6:17 am

I'm not at the CK so I'm having to guess it's the parameter type. Instead of ObjectReference it should be.... ReferenceThinger? The type that when you hit the Set Value button in the Parameter List it gives you the Select Object in Render Window button. And cross hairs. And such.

No, it is ObjectReference.
User avatar
Erin S
 
Posts: 3416
Joined: Sat Jul 29, 2006 2:06 pm

Post » Thu Jun 21, 2012 3:31 am

I THINK this is what you're asking... to assign a ref to a property, you would open whatever your script is attached to, then tab over to the script. Select it and click 'properties', then click auto-fill. If the property name is different from your actual ref or baseObject, you'll have to either assign the specific ref ('select in renderWin') or use aliases in a quest (then try auto-fill again).
User avatar
jess hughes
 
Posts: 3382
Joined: Tue Oct 24, 2006 8:10 pm

Post » Thu Jun 21, 2012 3:33 pm

Aenara has it right, you need to use casting. The name of the script is CWCatapultScript so according to your first post, you should use:

(Catapult1 as CWCatapultScript).TurnOn()

Make sure that your catapults have all the necessary scripts.
That was that first thing I tried, before even posting, and it still said that TurnOn() wasn't a function...
User avatar
Darlene Delk
 
Posts: 3413
Joined: Mon Aug 27, 2007 3:48 am

Post » Thu Jun 21, 2012 1:48 am

That was that first thing I tried, before even posting, and it still said that TurnOn() wasn't a function...

Are you sure? I just tried compiling it and it worked fine.
User avatar
ruCkii
 
Posts: 3360
Joined: Mon Mar 26, 2007 9:08 pm

Post » Thu Jun 21, 2012 12:29 pm

No, it is ObjectReference.
Okay. Got some sleep and in my right mind now. :sleep2: And yes, you're right. I've been working with a lot of base objects lately.

That was that first thing I tried, before even posting, and it still said that TurnOn() wasn't a function...
I had something similar going on which is how I learned about casting as scriptTypes. It means there's a problem with how your Catapult1 is defined. The compiler doesn't see Catapult1 as a CWCatapult. I would try re-creating the ObjRef parameter on your Scene script. Clear it's value and re-link it in the render window.

Could go a little further. Maybe attach a new, simple script with an OnLoad event that throws out a Debug.Trace. It could then fires .TurnOn(). At least you know there's not some lingering CW dependency.
User avatar
MarilĂș
 
Posts: 3449
Joined: Sat Oct 07, 2006 7:17 am

Post » Thu Jun 21, 2012 2:00 pm

Are you sure? I just tried compiling it and it worked fine.
I finally got back to this after working on a lot of the other stuff in my main quest, and now that works... I assume since it compiled it will run ingame, so thanks everyone! :D
User avatar
Sophie Payne
 
Posts: 3377
Joined: Thu Dec 07, 2006 6:49 am

Post » Thu Jun 21, 2012 1:30 pm

Script compiles but ingame it still doesn't work. The only difference is that now I cannot manually fire them by standing next to them, looking at them and hitting E. So it did something, I'm just not all the way there yet...
User avatar
james reed
 
Posts: 3371
Joined: Tue Sep 18, 2007 12:18 am


Return to V - Skyrim