Aller au contenu

Photo

A complete beginner with eyes bigger than belly


  • Veuillez vous connecter pour répondre
38 réponses à ce sujet

#26
Ribouldingue

Ribouldingue
  • Members
  • 27 messages
Well I've set a trigger around the lift itself with this script on it:

void main()
{
effect eDamage;
object oTarget;

// Get the creature who triggered this event.
object oAll = GetEnteringObject();

// Checks positions
oTarget = GetNearestObjectByTag("Ropedtc001");
int a = GetLocalInt(oTarget, "LV_DTC_Areaheight");
oTarget = GetObjectByTag("DTC_Southernlift_03");
int b = GetLocalInt(oTarget, "LV_DTC_Southernliftheight");

// If the lift is right there
if (a=B)
{
// Confirms the creature steps on the lift.
SetLocalInt(oAll, "LV_DTC_isonsouthernlift", 1);
}

else
{
ExecuteScript("dtc_liftpit_c", oAll);
}
}

I'm trying then to make the port active for everything that would have "LV_DTC_isonsouthernlift" set to 1 when the PC uses the rope. Any other PC that the one using the rope, any creature or any dropped item, just to make it realistic.

#27
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

Ribouldingue wrote...

Lightfoot8 wrote...
1 Placables can not be moved.


Well indeed I haven't been clear. Sorry again.

I'm not trying to animate the placeable but to make it port, it's quite working now, I just have still to get the old one destroyed and figuring out how to do it by location I guess since by tag would destroy the newly spawned one.

Anyway thanks.




I assume that you would have already found the current  placable before you created the new one.  

...

object oOldLift  = GetObjectByTag("LiftTag");
object oNewLift = CopyObject( oOldLift, lNewLoc);
DestroyObject (oOldLift);  
...

#28
Ribouldingue

Ribouldingue
  • Members
  • 27 messages
Well I didn't know this... but the lift does work well for the PC, appearing, disappearing, marking the fall spot... the two things I need to work it with are:

It's not related yet to variables, so I could manually do them one by one, but not a good scripting solution I guess. But still the one I think I'll use... a bit complicated for me now... too many variables and placeables.

And it's only porting the PC, that's the annoying side.

Rest is working well really.

Modifié par Ribouldingue, 01 février 2013 - 06:56 .


#29
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

Ribouldingue wrote...

Well I've set a trigger around the lift itself with this script on it:...

...I'm trying then to make the port active for everything that would have "LV_DTC_isonsouthernlift" set to 1 when the PC uses the rope. Any other PC that the one using the rope, any creature or any dropped item, just to make it realistic.



Forget about the int.  You are going to wast a lot of time tring to find all the stuff that has it on it.   Just use
GetFirstInPersistentObject andGetNextInPersistentObject

#30
Ribouldingue

Ribouldingue
  • Members
  • 27 messages
Ok thanks, checking it right now.

#31
Ribouldingue

Ribouldingue
  • Members
  • 27 messages
Thanks it worked just fine.

Sorry for the delay... have been off for eleven, if I'm reading well, days... that's quiite a big few!

#32
Ribouldingue

Ribouldingue
  • Members
  • 27 messages
Yes, I know, I should be done with this for long... But well it's happily not given to everyone to be slow...

Little question so: Where is the local variable recorded in the following script part? I wrote it thinking it was on the spawned placeable but now I've got bugs with another script calling this variable and I wonder if it's not in fact stored in the waypoint or anywhere else?

Rope script parts:

// Moving the lift down.
oTarget = GetWaypointByTag("WP_DTC_L_3801s");
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "dtc_southlift_01", GetLocation(oTarget));
oTarget = GetWaypointByTag("WP_DTC_L_3802s");
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "dtc_southlift_02", GetLocation(oTarget));
oTarget = GetWaypointByTag("WP_DTC_L_3803s");
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "dtc_southlift_03", GetLocation(oTarget));

// Adjusts lift height.
nValue = GetLocalInt(oSpawn, "LV_DTC_Southernliftheight") - 1;
SetLocalInt(oSpawn, "LV_DTC_Southernliftheight", nValue);

#33
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
it would be on the dtc_southlift_03 placeable.

Hmmm,  Keep in mind that you have just created that object.  So the:

GetLocalInt(oSpawn, "LV_DTC_Southernliftheight")

will always return 0  since that placable has never had the var set on it.   You then subtract 1 so;

SetLocalInt(oSpawn, "LV_DTC_Southernliftheight", nValue);

is always setting the var to -1

Modifié par Lightfoot8, 21 février 2013 - 02:30 .


#34
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
updated above post.

#35
Ribouldingue

Ribouldingue
  • Members
  • 27 messages
Heck, I thought the variable was remaining on the placeable when it was spawned from place to place... will have to reconsider it all then... anyway thanks a lot for pointing it out and making it clear to me... *puts a scaphander on and dives*

#36
Ribouldingue

Ribouldingue
  • Members
  • 27 messages
Is this a problem in the long term to multiply scripts?

And something else, where should I put my nose first to prevent flying objects not following the lift moves?

Here's the descending script:

void main()
{
    int nValue;
    object oTarget;
    object oSpawn;
    object oAll;

    // Get the creature who triggered this event.
    object oPC = GetLastUsedBy();

    // Have the PC perform a sequence of actions.
    AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND)));
    AssignCommand(oPC, ActionUnequipItem(GetItemInSlot(INVENTORY_SLOT_LEFTHAND)));
    AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0, 2.0));

    // Activating pulleys.
    oTarget = GetWaypointByTag("WP_DTC_P_5001s");
    oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "dtc_southpull_02", GetLocation(oTarget));
    oTarget = GetWaypointByTag("WP_DTC_P_5002s");
    oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "dtc_southpull_22", GetLocation(oTarget));

    // Find the location to which to teleport.
    oTarget = GetWaypointByTag("WP_DTC_LP_3911s_down");

    // Moving the lift down.
    oTarget = GetWaypointByTag("WP_DTC_L_3911s");
    oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "dtc_southlift_01", GetLocation(oTarget));
    oTarget = GetWaypointByTag("WP_DTC_L_3912s");
    oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "dtc_southlift_02", GetLocation(oTarget));
    oTarget = GetWaypointByTag("WP_DTC_L_3913s");
    oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "dtc_southlift_03", GetLocation(oTarget));

    // Adjusts lift height.
    SetLocalInt(oSpawn, "LV_DTC_Southernliftheight", 1);

    // Get everything/one who is on the lift
    object oTrigger=GetNearestObjectByTag("Trigger_DTC_LP_a");
    object oInTrigger=GetFirstInPersistentObject(oTrigger, OBJECT_TYPE_CREATURE | OBJECT_TYPE_ITEM);
    // Confirms PC is on the lift.
    SetLocalInt(oInTrigger, "LV_DTC_isonsouthernlift", 1);
    while (GetIsObjectValid(oInTrigger))

    {
    // Teleport everything/one
    DelayCommand (2.0, AssignCommand(oInTrigger, ClearAllActions()));
    DelayCommand (2.5, AssignCommand(oInTrigger, JumpToObject(oTarget)));
    oInTrigger=GetNextInPersistentObject(oTrigger, OBJECT_TYPE_CREATURE | OBJECT_TYPE_ITEM);
    }

    // Stops pulleys (not fully effective until this script ends).
    DelayCommand (5.0, DestroyObject(GetObjectByTag("DTC_Southernpulley_02")));
    DelayCommand (5.0, DestroyObject(GetObjectByTag("DTC_Southernpulley_22")));

    // Destroy the lift up.
    DelayCommand (2.0, DestroyObject(GetNearestObjectByTag("DTC_Southernlift_01")));
    DelayCommand (2.0, DestroyObject(GetNearestObjectByTag("DTC_Southernlift_02")));
    DelayCommand (2.0, DestroyObject(GetNearestObjectByTag("DTC_Southernlift_03")));

}

Modifié par Ribouldingue, 21 février 2013 - 09:49 .


#37
Morbane

Morbane
  • Members
  • 1 883 messages
is there a nwn1 "move-to-location" function?

is there was, a trigger around the pit could call that function and move the creature away from the pit...

#38
Ribouldingue

Ribouldingue
  • Members
  • 27 messages
Yep I think it's doable Morbane thanks, Highv Priest talked about it in the previous page, but for now I'm working on the item lifting to avoid to get flying-above-pit-stuff and frankly I've abandonned the idea of creatures avoiding the pit... seems very hard for me obviously... I think I'll pass on creatures too... no creatures at all.... hehehe... thanks anyway!

Modifié par Ribouldingue, 25 février 2013 - 09:23 .


#39
Ribouldingue

Ribouldingue
  • Members
  • 27 messages
I do confirm: this beginner had way too big eyes for his belly size!

Hello folks, sorry for giving it up, but well even if the lift works, thanks to your help, scripting is really too hair pulling for me. I'll stick anyway around NWN1 and will try to think about a smaller thing one day.

I'll be glad to send you the lift if you want hahaha...

Thanks again for the welcome and the help, see you around someday!