I have a trigger, a Drow, 2 Waypoints and a Player.
I want to enter the trigger with my PLAYER, and have the DROW, move across 2 WAYPOINTS.
How can I make this happen? I know its simple, but I couldnt seem to get it to work.. please help
Simple scripting needs help
Débuté par
Leyf
, janv. 31 2011 12:28
#1
Posté 31 janvier 2011 - 12:28
#2
Posté 31 janvier 2011 - 01:17
//This script goes in the OnEnter of a trigger
void main()
{
object oPC = GetEnteringObject();
object oDrow = GetObjectByTag("drowTag");
location lLoc = GetLocation(GetWaypointByTag("wapointTag"));
AssignCommand(oDrow, ActionMoveToLocation(lLoc));
}
void main()
{
object oPC = GetEnteringObject();
object oDrow = GetObjectByTag("drowTag");
location lLoc = GetLocation(GetWaypointByTag("wapointTag"));
AssignCommand(oDrow, ActionMoveToLocation(lLoc));
}
#3
Posté 31 janvier 2011 - 09:37
Excellent! If I want to change this creature to lets say a Fairy, do I have to Hard-Edit the script? Like change all of the oDrow to oFairy?
#4
Posté 31 janvier 2011 - 10:58
Leyf wrote...
Excellent! If I want to change this creature to lets say a Fairy, do I have to Hard-Edit the script? Like change all of the oDrow to oFairy?
The best thing if you're going to use this more than once would probably be to have a generic script that you put in the triggers' OnEnter events. Then, you put a variable on each specific trigger that tells the tag of the creature you want to move in this particular case, and a variable that tells it which waypoint you want it to move to.
Knightmare's tutorial talks about storing and retrieving Local variables.
#5
Posté 01 février 2011 - 10:17
Could you supply this "Generic Script" Im still new at this and I dont want to mess anything up..
#6
Posté 01 février 2011 - 10:56
Something like so:
You would put 2 string variables on the trigger in the toolset. One for the creature you want to move (creature1) and one for the waypoint to move to (waypoint1).
void main()
{
string sCreature = GetLocalString(OBJECT_SELF, "creature1");
string sWaypoint = GetLocalString(OBJECT_SELF, "waypoint1");
object oCreature = GetObjectByTag(sCreature);
object oWaypoint = GetWaypointByTag(sWaypoint);
AssignCommand(oCreature, ActionMoveToObject(oWaypoint));
}
You would put 2 string variables on the trigger in the toolset. One for the creature you want to move (creature1) and one for the waypoint to move to (waypoint1).
#7
Posté 02 février 2011 - 03:59
so the variables would be named "creature1" and "waypoint1" and they would have a string that is the tag of the creature and the waypoint thusly:
string creature1 = somecreaturetag
string waypoint1 = somewaypointtag
string creature1 = somecreaturetag
string waypoint1 = somewaypointtag
#8
Posté 02 février 2011 - 10:53
Thank you very much for justifying that Morbane. Im still a bit new with Variables and Scripts. But im getting better!





Retour en haut






