Aller au contenu

Photo

Placing a creture on a loaction?


4 réponses à ce sujet

#1
Lotion Soronarr

Lotion Soronarr
  • Members
  • 14 481 messages
What's the proper way to place a creature (NPC) in a game location? I know it can be placed with a script but I can't find functions that seem to do it. I see no GetCreatureByTag function anywhere....*sigh*

#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
Are you trying to create an object, or move an existing object? If you want to create an object, you need to use CreateObject().



To move an object, it's easier to use SetPosition() rather than SetLocation(). SetLocation() let's you specify and area and orientation, but I don't think the area part of that will let you move creatures between areas anyway.



If you just want to move a creature to a waypoint, use UT_LocalJump(), which is really just a wrapper around SetPosition().

#3
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
Redcliffe day and night are seperate areas and not in the same area list. You won't be able to move creatures between them.

#4
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
Do you know how to see compile errors? The code you've posted has a number of errors that wouldn't compile. Try this:



void main()

{

event ev = GetCurrentEvent();

int nEventType = GetEventType(ev);

switch(nEventType)

{

case EVENT_TYPE_AREALOAD_PRELOADEXIT:

{

object oArea = GetArea(GetHero());

location aLoc = Location(oArea, Vector(355.699,344.979,36.9077),0.0);



CreateObject(OBJECT_TYPE_CREATURE, R"aquae.utc", aLoc);

break;

}

}

}

#5
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages

Lotion Soronnar wrote...

But wouldn't this place the NPC in any area the PC is currently in, instead of a specific area (Redclifffe)?

But yes...I should have seen the compile errors. I can be downright stupid sometimes.


You can't create creatures in areas the player isn't in. Well, maybe within the area list, but I don't like to rely on that. You have to create the creature using the area load script for the specific area.