Author Topic: Still Having Problems Trying To Raise An Airship :(. Please Help??  (Read 560 times)

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Still Having Problems Trying To Raise An Airship :(. Please Help??
« Reply #15 on: November 04, 2010, 07:54:34 am »


               

I'm not too sure what a conditional script is to be honest. Is there any point to telling me what it is, or would it only confuse me further?

A conditional script is the only kind in nwn besides includes that doesn't have a void main () function. Instead it returns TRUE or FALSE, and is used to determine whether or not to display a line of conversation in a nwn dialogue. It has nothing to do with this other than being the cause of your compiler error. Other compilers, like the PRCs, are able to identify and ignore includes.

Funky
               
               

               
            

Legacy_MissJaded

  • Full Member
  • ***
  • Posts: 243
  • Karma: +0/-0
Still Having Problems Trying To Raise An Airship :(. Please Help??
« Reply #16 on: November 06, 2010, 03:37:37 am »


               
Quote
FunkySwerve wrote...

Scratch that. There was a one-character typo in one of the variable names, causing it to never lock on to the object after the first iteration, because it was looking for "RisingPlaceble" instead of "RisingPlaceable". Fixed. Here's the demo mod:

http://dl.dropbox.co...407/airship.mod


I used a rowboat dubbed Ye Old Flying Dutchman, because I was too lazy to download the CEP demo mod. I also adjusted it to move every 2 seconds in the demo, and set the ceiling to 27.0  (it goes out of sight at 26.0). Looks pretty cool.

So yes, all my fault. Mea culpa.

Here is the corrected include, should you not want to pull it from the demo module:






// This function will create the illusion of a placeable moving up to the sky. It
// will eventually destroy the placeable. fRate is the rate of Ascent, the amount
// of height to 'move' during each iteration of the function. fCeiling is the
// highest you want the placeable to go before deleting, and fInterval is the number
// of seconds between iterations of the function. I entered default values for them
// based on the script you had, but you can specify them as you like.
void StartPlaceableAscent(object oPlaceable, float fRate = 3.0, float fCeiling = 40.0, float fInterval = 6.0);

void DoPlaceableAscent(float fRate, float fCeiling, float fInterval) {

    object oArea = OBJECT_SELF;//We AssignCommanded to the area, making it O.S.
    object oRise = GetLocalObject(oArea, "RisingPlaceable");

    location lLoc = GetLocation(oRise);
    vector vVec = GetPositionFromLocation(lLoc);
    vVec.z += fRate;

    if (vVec.z > fCeiling) {//end pseudo if the next move would take us over the ceiling
        DestroyObject(oRise);
        DeleteLocalObject(oArea, "RisingPlaceable");
        return;
    }

    //Since we didn't end the psuedo, we fire up the next iteration
    DelayCommand(fInterval, DoPlaceableAscent(fRate, fCeiling, fInterval));

    //The rest is simply creating the new, destroying the old
    string sRes = GetResRef(oRise);
    float fFace = GetFacingFromLocation(lLoc);
    location lNew = Location(oArea, vVec, fFace);
    DestroyObject(oRise);

    //normally I would delay creation by a second or so to make it look more natural, but
    //I'm trying to keep this simple
    object oNew = CreateObject(OBJECT_TYPE_PLACEABLE, sRes, lNew);
    SetLocalObject(oArea, "RisingPlaceable", oNew);
}

void StartPlaceableAscent(object oPlaceable, float fRate = 3.0, float fCeiling = 40.0, float fInterval = 6.0) {
    object oArea = GetArea(oPlaceable);
    SetLocalObject(oArea, "RisingPlaceable", oPlaceable);
    AssignCommand(oArea, DoPlaceableAscent(fRate, fCeiling, fInterval));
}





I was tempted to add more parameters, like change in rate of movement, movement on other axis, and such, but I'm gonna let you figure out the three you already have to toy with first. And yes, it will work from any event. I designed it to require a minimum of inputs and as much flexibility as possible with the simplistic inputs.

Best,
Funky



Hi again Funky.

Thanks a lot for your last reply. I found it very helpful indeed!'<img'>
The very quick demo mod you made, has also helped me a lot too. Thanks for that.'<img'>

It seems I didn't have much of an eagle eye to spot the small mistake you made in your earlier reply though.
I only noticed it after you pointed it out in your last post. I'm glad you were able to spot it and correct it for me.
Thanks!'<img'>

I added a little something extra to the airship script you made. (or should I say.... rising / floating rowboat script? '<img'>)


[quote]
#include "place_rise_inc"
#include "in_g_cutscene"

void main() {


// Find actors
 object oPC = GetFirstPC();


 GestaltStartCutscene(oPC,"mycutscene");


 GestaltCameraCrane (1.0,
                                           180.0, 15.0, 90.0, 0.0,
                                           180.0, 15.0, 90.0, 50.0,
                                            95.0, 40.0,
                                            oPC, 0);


GestaltStopCutscene (50.0, oPC);




    object oAirShip = GetObjectByTag("Airship1");
    StartPlaceableAscent(oAirShip, 1.0, 27.0, 2.0);


}
[/quote]

You'll probably recognize where I got that other part from. I find it very handy indeed!
I wanted to make a script which causes the screen view to rise up, just as the placeable boat or airship e.t.c does so that you can rise up with the placeable as you're watching it.

There is only 1 more little script I would like to add, which I am not too sure how to get hold of right now.
A cutscene invisibility script, which I have tried out with Lilac Soul's Script Generator. But for the type of script it creates for this effect, I cannot seem to be able to fit it in to enable the whole script to complete a successful compile.

If this is a bit too much to ask, after the amount of help you have given me already, then no worries.
It seems just a small piece of script though really. If you are able to spare a little time to put one in for me, It would be very helpful indeed! I would much appreciate it.'<img'>

Thanks again for the extra help, the quick demo and correcting the script.
I've started making use of it already, and it's working just fine.

Regards,
''MissJaded'' 'B)'





Quote
FunkySwerve wrote...

A conditional script is the only
kind in nwn besides includes that doesn't have a void main () function.
Instead it returns TRUE or FALSE, and is used to determine whether or
not to display a line of conversation in a nwn dialogue. It has nothing
to do with this other than being the cause of your compiler error.
Other compilers, like the PRCs, are able to identify and ignore
includes.

Funky



Ahh yes. I think I see what a conditional script is..... not fully since it does sound a litlte confusing.
But it does sound like one is really only used from pc and/or npc conversations, which as you stated, has nothing to do with this airship scripting stuff.

Regards,
"MissJaded"B)
               
               

               


                     Modifié par MissJaded, 06 novembre 2010 - 04:28 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Still Having Problems Trying To Raise An Airship :(. Please Help??
« Reply #17 on: November 06, 2010, 08:33:08 am »


               What is it you want to make invisible? It's very straightforward - you just create the effect in one line and apply it in a second.



Funky
               
               

               
            

Legacy_MissJaded

  • Full Member
  • ***
  • Posts: 243
  • Karma: +0/-0
Still Having Problems Trying To Raise An Airship :(. Please Help??
« Reply #18 on: November 07, 2010, 07:43:13 am »


               

FunkySwerve wrote...

What is it you want to make invisible? It's very straightforward - you just create the effect in one line and apply it in a second.

Funky


Hey again.

Thank you for your last reply.

Luckily, I managed to solve the last bit myself eventually.
I wanted a short piece of script to make the pc invisible, since I'm uisng this airship to rise in a cutscene, hence the cutscene invisibility.

I've been using Lilac Soul's Script Genarator to create this effect, and couldn't get it right at first.
It wouldn't compile with the rest of the script. But I managed to straighten it out eventually.

Here is the finished script.

#include "place_rise_inc"
#include "in_g_cutscene"

void main() {


// Find actors

object oPC = GetFirstPC();

GestaltStartCutscene(oPC,"mycutscene");


 GestaltCameraCrane (1.0,
                                           180.0, 15.0, 90.0, 0.0,
                                           180.0, 15.0, 90.0, 50.0,
                                            95.0, 40.0,
                                            oPC, 0);


GestaltStopCutscene (50.0, oPC);



if (!GetIsPC(oPC)) return;

object oTarget;
oTarget = oPC;

effect eEffect;
eEffect = EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oTarget);






    object oAirShip = GetObjectByTag("Airship1");
    StartPlaceableAscent(oAirShip, 1.0, 27.0, 2.0);


}


It's all fine now gladly.'<img'>

Just a quick question, if you don't mind me asking.
I'm a tad puzzled about something. Where you have - StartPlaceableAscent(oAirShip, 1.0, 27.0, 2.0);
You explained what the middle and end/right numbers mean. So that's fine.
Please could you tell me what the first/left number means too? What does "1.0" do, at the start there please?
Is it the amount of time before the airship (or a small rowboat in the case of the demo) starts rising?

Regards, "MissJaded"B)
               
               

               


                     Modifié par MissJaded, 07 novembre 2010 - 07:48 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Still Having Problems Trying To Raise An Airship :(. Please Help??
« Reply #19 on: November 07, 2010, 08:02:12 am »


               Actually, I explained all of them. Check the function definition. It's the amount of distance the airship rises each iteration (1.0 z, or vertical):

// This function will create the illusion of a placeable moving up to the sky. It
// will eventually destroy the placeable. fRate is the rate of Ascent, the amount
// of height to 'move' during each iteration of the function. fCeiling is the
// highest you want the placeable to go before deleting, and fInterval is the number
// of seconds between iterations of the function. I entered default values for them
// based on the script you had, but you can specify them as you like.
void StartPlaceableAscent(object oPlaceable, float fRate = 3.0, float fCeiling = 40.0, float fInterval = 6.0);

Funky
               
               

               


                     Modifié par FunkySwerve, 07 novembre 2010 - 08:05 .