Author Topic: Getting a creature to spawn at the EXACT location of a placeable - Can this be done?  (Read 319 times)

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0


               

I'm working on Baba Yaga's Hut for the current CCC challenge and I need the creature version of the model to spawn at the exact location as the placeable. Currently, no matter what delays settings I use to destroy the placeable, the creature spawns to the right of the placeable's location. I think it might be because of the pwk associated with the placeable. Is there a way to get this to work that does not require removing the pwk geometry from the hut placeable?


 


Here's my script:


 


//Placeable OnUsed


 


void main()

{

    object oHut = CreateObject(OBJECT_TYPE_CREATURE, "qc_babayagahut", GetLocation(OBJECT_SELF));

    SetPlotFlag(OBJECT_SELF, FALSE);

    DestroyObject(OBJECT_SELF, 0.5);

}


               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0


               

Try custscene ghost the creature before spawning placeable.


 


If that wont work try adjust the locations Z position by -1.



               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0


               

is there a way to cut a hole in the PWK so that the creature can spawn into the center of the donut?



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0


               


Try custscene ghost the creature before spawning placeable.


If that wont work try adjust the locations Z position by -1.




... or cutscene ghost the placeable.


Nuance - if the placeable is in an inaccessible location, the creature can never spawn there. One workaround is to create a null creature at the proposed location of the placeable, then use its exact location, which will always be legal.


Another nuance - cutscene ghost will bake on a placeable when the last player leaves the area, so, if that can happen, OnExit must remove the effect, setting a flag to reapply it when a player next enters.
               
               

               


                     Modifié par Proleric, 03 juin 2014 - 10:29 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0


               
void main()
{
    object oHut = CreateObject(OBJECT_TYPE_CREATURE, "qc_babayagahut", GetLocation(OBJECT_SELF));
    SetPlotFlag(OBJECT_SELF, FALSE);
    DestroyObject(OBJECT_SELF, 0.5);
}
 

Is that not backwards?
 
Should you not be destroying the object and then creating the creature.
 
void vObj(object oObj) {}

void main()
{
  location lLoc = GetLocation(OBJECT_SELF);
  AssignCommand
  (
    GetArea(OBJECT_SELF),
    DelayCommand
    (
      0.5,
      vObj
      (
        CreateObject
        (
          OBJECT_TYPE_CREATURE,
          "qc_babayagahut",
          lLoc
        )
      )
    )
  );
  DestroyObject(OBJECT_SELF);

}



               
               

               
            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0


               



void main()
{
    object oHut = CreateObject(OBJECT_TYPE_CREATURE, "qc_babayagahut", GetLocation(OBJECT_SELF));
    SetPlotFlag(OBJECT_SELF, FALSE);
    DestroyObject(OBJECT_SELF, 0.5);
}

 


Is that not backwards?

 

Should you not be destroying the object and then creating the creature.

 

void vObj(object oObj) {}

void main()
{
  location lLoc = GetLocation(OBJECT_SELF);
  AssignCommand
  (
    GetArea(OBJECT_SELF),
    DelayCommand
    (
      0.5,
      vObj
      (
        CreateObject
        (
          OBJECT_TYPE_CREATURE,
          "qc_babayagahut",
          lLoc
        )
      )
    )
  );
  DestroyObject(OBJECT_SELF);

}





 


Works like a charm. Thanks a lot!