Placing a creture on a loaction?
#1
Posté 02 janvier 2010 - 06:12
#2
Posté 02 janvier 2010 - 07:35
For an example:
SetLocation(GetObjectByTag("tag_npc"), GetLocation(GetObjectByTag("tag_waypoint")));
You can create custom location by using "Location" function.
Modifié par BioSpirit, 02 janvier 2010 - 07:36 .
#3
Posté 02 janvier 2010 - 08:42
I'm not exaclty sure how to make a location. IIRC; Waypoints can't be placed with a script.
I'd need the name o the area, coordinates (I guess mouse coordinates in the editor) and orientation. Teh are is cir200_ar_tower_level_1.are
void main()
{
object oAquae=GetObjectByTag(aquae,0);
location AquaePoint (??????); <--------------------????????
void SetLocation (oAquae,AquaePoint);
}
Modifié par Lotion Soronnar, 02 janvier 2010 - 08:44 .
#4
Posté 05 janvier 2010 - 07:50
#5
Posté 05 janvier 2010 - 10:50
Open a local copy of the area and place a waypoint where you want the NPC to appear, Take the position information from the waypoint properties.
Create the location in your script:
location loc = Location(oArea, Vector(x, y, z), 0.0); Where x,y,z is the position you took. There seems to be handiness problem so you may need to reverse the signs from x and y coordinates.
Modifié par BioSpirit, 05 janvier 2010 - 10:56 .
#6
Posté 06 janvier 2010 - 12:18
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().
#7
Posté 06 janvier 2010 - 12:24
#8
Posté 06 janvier 2010 - 01:44
So If I want to place a NPC in Redciffe (it not placed anywhere ATM) I use CreateObject().
If I want to move it to defend Recliffe at night, then Set Location?
Ok, scratch that...I'll just create a copy of the NPC for Redcliffe at night or something.
More experimentation is needed.
#9
Posté 06 janvier 2010 - 03:20
#10
Posté 06 janvier 2010 - 06:51
So how do I go about placing a NPC (tag "aquae") into Redcliffe (I have the exact coordinates).
This OK?
----------
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
switch(nEventType)
{
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{
object oAreaAq = GetArea("arl100cr_perth");
object oAquae = GetObjectByTag("aquae");
int aType = GetObjectType(aAquae);
location aLoc = Location(oAreaAq,(355.699,344.979,36.9077),0);
CreateObject(aType,"aquae.utc",aLoc);
}
}
Modifié par Lotion Soronnar, 06 janvier 2010 - 07:10 .
#11
Posté 06 janvier 2010 - 09:34
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;
}
}
}
#12
Posté 07 janvier 2010 - 07:04
But yes...I should have seen the compile errors. I can be downright stupid sometimes.
#13
Posté 07 janvier 2010 - 10:46
social.bioware.com/wiki/datoolset/index.php/How-tos
Set up your 2da so the script only runs when entering Redcliffe, if that's what you want.
Modifié par Craig Graff, 07 janvier 2010 - 10:47 .
#14
Posté 07 janvier 2010 - 11:20
#15
Posté 07 janvier 2010 - 03:23
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.
#16
Posté 08 janvier 2010 - 06:08
****
#include "plt_aquae_plot"
#include "wrappers_h"
void main()
{
if (WR_GetPlotFlag(PLT_AQUAE_PLOT, AQUAE_PLACED_1) == FALSE)
{
object oTown = GetObjectByTag("arl100ar_redcliffe_village");
vector vAqLocation = Vector(288.951f, 381.666f, 40.514f);
CreateObject(
OBJECT_TYPE_CREATURE,
R"aquae.utc",
Location(oTown, vAqLocation, 180.0f)
)
WR_SetPlotFlag("aquae_plot", AQUAE_PLACED_1, TRUE)
}
}
Why do I get a "E: 19:09:28 - add_aquae_redcliffe.nss - add_aquae_redcliffe.nss(18): No semicolon after expression" compile error? I removed the ; and I still get the same error.
Every single script so far shows 1warning when compliling - and I copy-paste the mfrom tutorials. Are these bogus warnings?
EDIT: I do have a PRSCR_Aquae.gda all setup (wiht the area list name and script name), and still the NPC ain't appearing...
Modifié par Lotion Soronnar, 08 janvier 2010 - 06:15 .
#17
Posté 08 janvier 2010 - 06:22
CreateObject(
OBJECT_TYPE_CREATURE,
R"aquae.utc",
Location(oTown, vAqLocation, 180.0f)
)
That last ) needs a semicolon after it because it is the end of the expression. You also need one at the end of the line right after it too.
These errors you are seeing are not warnings. They are *errors*. Meaning if you don't fix them, your script won't do anything. You cannot ignore them.
Modifié par FalloutBoy, 08 janvier 2010 - 06:24 .
#18
Posté 08 janvier 2010 - 06:59
Complies without errors...NPC still doesn't show up....hmmmmmm
*******
Well, since oyu seem to be in the mood for answering questions:
#include "utility_h"
#include "plt_aquae_plot"
#include "add_custom_party_member_h"
void main() {
object oHero = GetHero();
object oAquae = CreateObject(OBJECT_TYPE_CREATURE, R"aquae.utc", GetLocation(oHero));
hireCustomFollower(oAquae, class_WIZZARD, PLT_AQUAE_PLOT, AQUAE_JOIN);
SetPartyPickerGUIStatus(2);
ShowPartyPickerGUI();
}
I get this:
E: 20:00:46 - party_join_script.nss - party_join_script.nss(10): Variable defined without type (while compiling var_constants_h.nss)
The add_custom_party_member_h is hireCustomFollower_h from the tutorial..I just gave it a different name.
Modifié par Lotion Soronnar, 08 janvier 2010 - 07:04 .
#19
Posté 08 janvier 2010 - 07:13
#20
Posté 08 janvier 2010 - 07:28
I switched back to using the regular UT_HireFollower instead of the modified script.
Get this - if I run the place_aquae_redclifffe and aquae_party_join scripts from the console - BOTH WORK.
She appears in Redcliffe and the joins the party. But playing normally, nether script fires!!!!
I just don't get this..
I get it that I might put a typo somewhere in the PRSCR file (but I copy-pasted resource named directly from the toolset), but hte hire script is called directly from the convo. Has can that possibly misfire???
EDIT: Forget I said anyting. I have been testing so many possible combinations that I forgot I switcehd back to triggering via plot-flags in the convo.
HA!
Modifié par Lotion Soronnar, 08 janvier 2010 - 07:30 .
#21
Posté 08 janvier 2010 - 08:04
PRCSCR... hehe..works now. She appears and I can hire her.
Still need to tweak it a bit, since Iwant to use the hire function that allows her template to be used...that and I get 2 of her, so I have to change Create to Get





Retour en haut







