Aller au contenu

Photo

Transition to areas


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

#1
Nebril2

Nebril2
  • Members
  • 59 messages

Hi all....

 

Well im trying to make a script to make the first character who uses a placeable to jump to a waypoint in other area... 

The script tiggers because the visual effects works, but theres no transition, i have my waypoint in the other area with the right tab... 

And as you can see in the code i tried many ways to do it "jump to location" "actionjumptolocation" etc. But nothing works :/ can you help me? it may be easy but im stuck. Im new at scripting in nwn2 but i have lots of experience in nwn1. 

void main()
{
object p1 = GetLastUsedBy();
location l1 = GetLocation(GetObjectByTagAndType("empezar_1",OBJECT_TYPE_WAYPOINT,1));
object oW = GetObjectByTagAndType("empezar_1",OBJECT_TYPE_WAYPOINT,1);

if (GetLocalInt(OBJECT_SELF,"Usado")!=1)
{

ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_HIT_AURORA_CHAIN), p1);
     AssignCommand(p1, ActionJumpToLocation(l1));
     AssignCommand(p1, JumpToLocation(l1));
     SetLocalInt(p1, "Jugador", 1);
	 SetLocalInt(OBJECT_SELF, "Usado", 1);

 }

 
 
 







 
}


#2
Tchos

Tchos
  • Members
  • 5 072 messages

Well, perhaps try

object oW = GetWaypointByTag("empezar_1");

 

instead of

object oW = GetObjectByTagAndType("empezar_1",OBJECT_TYPE_WAYPOINT,1);

 

and use

AssignCommand(p1, JumpToObject(oW) );

 

instead of JumpToLocation

 

And don't worry about getting the location.


  • Nebril2 aime ceci

#3
kevL

kevL
  • Members
  • 4 070 messages
yeh, GetObjectByTagAndType() didn't return a valid waypoint for me.

This worked tho
 
//void Tell(string sTell){ SendMessageToPC(GetFirstPC(FALSE), sTell); }

void main()
{
    //Tell("run ( testjump ) " + GetName(OBJECT_SELF));

    if (GetLocalInt(OBJECT_SELF,"Usado") == FALSE)
    {
        SetLocalInt(OBJECT_SELF, "Usado", TRUE);

        object oPC = GetLastUsedBy();
        //Tell(". lastUsedBy = " + GetName(oPC));

        object oWP = GetObjectByTag("empezar_1");
        //if (GetIsObjectValid(oWP)) Tell(". wp Valid");

        effect eVis = EffectVisualEffect(VFX_DUR_SPELL_BLESS);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);

        AssignCommand(oPC, ClearAllActions(TRUE));
        DelayCommand(2.f, AssignCommand(oPC, ActionJumpToObject(oWP)));

        SetLocalInt(oPC, "Jugador", 1);
    }
}
notes:
- VFX_HIT_AURORA_CHAIN looks like it attaches itself to OBJECT_SELF (ie. the placeable, not the PC ), so i went with Bless but that's not up to me. Just pointing it out ..

- a DelayCommand() on the jump lets the player see the Visuals fire up for a couple seconds.

- this won't jump any party members other than the User who clicked the trigger


[edit] refactor that.

Modifié par kevL, 14 mai 2014 - 09:06 .

  • Nebril2 aime ceci

#4
Nebril2

Nebril2
  • Members
  • 59 messages

Wow fast and goodlucking replies :D thanks for your time guys, it worked :)