Bienvenue sur JeuxOnLine - MMO, MMORPG et MOBA !
Les sites de JeuxOnLine...
 

Panneau de contrôle

Recherche | Retour aux forums

JOL Archives

deplacement pour les newbies

Par hido le 6/8/2002 à 21:23:51 (#1927231)

bonjour a tous !

j'ai trouvé un script du TONNERRE !!!

comment avoir plusieurs mode de deplacement :

voici un script qui a eu le merite d'avoir 5 etoiles sur les sites americains.

dans la fenetre de gauche (area,conversations,script)

-clic droit sur script+new

-dans la fenetre qui s'ouvre viré :

void main()
{

}

-pour avoir toute la page blanche !
-apres inserez ca :

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// Adam's Improved Waypoint Walker
// July 2, 2002
//
// USAGE:
//
// ATS_WalkWayPoints( int nRun, float fPause, int nWalkType );
//
// PARAMETERS:
//
// nRun - Use TRUE or FALSE for running or walking. Defaults to FALSE;
// fPause - A floating point number for the length of pause at each stop. Defaults to 1.0f
// nWalkType - Type of walking to do:
// 1 - Default. Back and forth pattern. (Waypoints 1, 2, 3, 4, 3, 2, 1, 2...)
// 2 - Circular (Waypoints 1, 2, 3, 4, 1, 2...)
// 3 or more - Random. Give the number of waypoints possible (say, 7), and
// the character will choose one at random.
//
// EXAMPLES:
//
//
// In your NPC's OnSpawn script, make sure that at the top you have the
// following two lines:
//
// #include "NW_I0_GENERIC" // this line will already be there
// #include "ats_waypoints" // add this line after the previous one
//
// Then, instead of using the default WalkWayPoints(), replace it with something like:
//
// ATS_WalkWayPoints(); // Use all the defaults. Walk, 1 second pause, back-and-forth.
// ATS_WalkWayPoints(FALSE, 1.0f, 2); // Walk, 1 second pause, circular path
// ATS_WalkWayPoints(TRUE, 5.0f, 8); // Run around the 8 waypoints randomly, with a 5 second pause
// // at each.
//
//
// Note that this script will give an error if you try to compile it.
// That's fine. Just save it, and #include it in other scripts to use it.
//
// ADDITIONAL NOTES:
//
// If you create a script with the same name as one of the waypoints, that
// script will be executed by the NPC when they walk to that waypoint.
//
// For example, if your waypoints are tagged WP_GUARD_01, WP_GUARD_02, etc...
// and at WP_GUARD_05 you want him to bow and say "Hello m'lord!", then
// create a script called "wp_guard_05" (in lower case).
// That script should look like this:
//
// void main()
// {
// ActionPlayAnimation(ANIMATION_FIREFORGET_BOW);
// ActionDoCommand(SpeakString("Hello m'lord!")));
// }
//
//
// Please note that the script for the waypoints should contain ONLY
// actions. Luckily, you can do any arbitrary command (I think)
// as an action by wrapping it in a ActionDoCommand(...) function call
// (like the SpeakString above).
//
//
// As with the default WalkWayPoints(), it is easily interrupted if you
// start a conversation with the NPC, or otherwise call ClearAllActions();
// To restart the NPC, issue another call to ATS_WalkWayPoints() as necessary
// after a conversation or whatever.
//
// Please give me your comments!
// Please use this in your mods!
// Please give me credit and/or thanks if you like it!
//
// Adam Spragg
// aspragg@yahoo.com
//
// DISCLAIMER!
// This script has been tested on my setup, and works very well.
// That does not mean, however, that it won't completely screw your own
// stuff up. Use at your own risk.



//void ATS_WalkWayPoints(int nRun = FALSE, float fPause = 1.0, int nWalkType = 1);

//
// Edited Bioware functions
void RunCircuit2(int nTens, int nNum, int nRun = FALSE, float fPause = 1.0, int nWalkType = 1);
void WalkWayPoints2(int nRun = FALSE, float fPause = 1.0, int nWalkType = 1);
void RunNextCircuit2(int nRun = FALSE, float fPause = 1.0, int nWalkType = 1);


//************************************************************************************************************************************
//************************************************************************************************************************************
//
//WAY POINT WALK FUNCTIONS
//
//************************************************************************************************************************************
//************************************************************************************************************************************


void ATS_WalkWayPoints( int nRun = FALSE, float fPause = 1.0, int nWalkType = 1)
{

WalkWayPoints2(nRun, fPause, nWalkType);

}


//::///////////////////////////////////////////////
//:: Walk Way Point Path
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Allows specified person walk a waypoint path
*/
//:://////////////////////////////////////////////
//:: Created By: Aidan Scanlan
//:: Created On: July 10, 2001
//:://////////////////////////////////////////////

void WalkWayPoints2(int nRun = FALSE, float fPause = 1.0, int nWalkType = 1) //Run first circuit
{
ClearAllActions();
string DayWayString;
string NightWayString;
string DayPostString;
string NightPostString;
string sWay;
string sPost;

//The block of code below deals with night and day cycle for postings and walkway points.
if(GetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING))
{
DayWayString = "WP_";
NightWayString = "WN_";
DayPostString = "POST_";
NightPostString = "NIGHT_";
}
else
{
DayWayString = "WP_";
NightWayString = "WP_";
DayPostString = "POST_";
NightPostString = "POST_";
}

if(GetIsDay() || GetIsDawn())
{
SetLocalString(OBJECT_SELF, "NW_GENERIC_WALKWAYS_PREFIX", DayWayString);
SetLocalString(OBJECT_SELF, "NW_GENERIC_POSTING_PREFIX", DayPostString);
}
else
{
SetLocalString(OBJECT_SELF, "NW_GENERIC_WALKWAYS_PREFIX", NightWayString);
SetLocalString(OBJECT_SELF, "NW_GENERIC_POSTING_PREFIX", NightPostString);
}


sWay = GetLocalString(OBJECT_SELF, "NW_GENERIC_WALKWAYS_PREFIX");
sPost = GetLocalString(OBJECT_SELF, "NW_GENERIC_POSTING_PREFIX");

//I have now determined what the prefixs for the current walkways and postings are and will use them instead
// of POST_ and WP_

if(GetSpawnInCondition(NW_FLAG_STEALTH))
{
//MyPrintString("GENERIC SCRIPT DEBUG STRING ********** " + "Attempting to Activate Stealth");
ActionUseSkill(SKILL_HIDE, OBJECT_SELF);
}
if(GetSpawnInCondition(NW_FLAG_SEARCH))
{
//MyPrintString("GENERIC SCRIPT DEBUG STRING ********** " + "Attempting to Activate Search");
ActionUseSkill(SKILL_SEARCH, OBJECT_SELF);
}

//Test if OBJECT_SELF has waypoints to walk
string sWayTag = GetTag( OBJECT_SELF );
sWayTag = sWay + sWayTag + "_01";
object oWay1 = GetNearestObjectByTag(sWayTag);
if(!GetIsObjectValid(oWay1))
{
oWay1 = GetObjectByTag(sWayTag);
}
if(GetIsObjectValid(oWay1) && GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS))
{
//turn off the ambient animations if the creature should walk way points.
SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS, FALSE);
SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS, FALSE);
}

if(GetIsObjectValid(oWay1))
{
int nNth = 1;
int nTens;
int nNum;
object oNearest = GetNearestObject(OBJECT_TYPE_WAYPOINT, OBJECT_SELF, nNth);
while (GetIsObjectValid(oNearest))
{
string sNearestTag = GetTag(oNearest);
//removes the first 3 and last three characters from the waypoint's tag
//and checks it against his own tag. Waypoint tag format is WP_MyTag_XX.
if( GetSubString( sNearestTag, 3, GetStringLength( sNearestTag ) - 6 ) == GetTag( OBJECT_SELF ) )
{
string sTens = GetStringRight(GetTag(oNearest),2);
nTens = StringToInt(sTens)/10;
nNum= StringToInt(GetStringRight(GetTag(oNearest),1));
oNearest = OBJECT_INVALID;
}
else
{
nNth++;
oNearest = GetNearestObject(OBJECT_TYPE_WAYPOINT,OBJECT_SELF,nNth);
}
}
RunCircuit2(nTens, nNum, nRun, fPause, nWalkType); //***************************************
ActionWait(fPause);
ActionDoCommand(RunNextCircuit2(nRun, fPause, nWalkType));
//ActionDoCommand(SignalEvent(OBJECT_SELF,EventUserDefined(2)));
}
else
{
sWayTag = GetTag( OBJECT_SELF );
sWayTag = sPost + sWayTag;
oWay1 = GetNearestObjectByTag(sWayTag);
if(!GetIsObjectValid(oWay1))
{
oWay1 = GetObjectByTag(sWayTag);
}

if(GetIsObjectValid(oWay1))
{
ActionForceMoveToObject(oWay1, nRun, 1.0, 60.0);
float fFacing = GetFacing(oWay1);
ActionDoCommand(SetFacing(fFacing));
}
}
if(GetIsObjectValid(oWay1) && GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS))
{
SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS, FALSE);
SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS, FALSE);
}
}

void RunNextCircuit2(int nRun = FALSE, float fPause = 1.0, int nWalkType = 1)
{

RunCircuit2(0,1, nRun, fPause, nWalkType); //***************************************
ActionWait(fPause);
ActionDoCommand(RunNextCircuit2(nRun, fPause, nWalkType));
//ActionDoCommand(SignalEvent(OBJECT_SELF,EventUserDefined(2)));
}

//::///////////////////////////////////////////////
//:: Run Circuit
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Calculates the proper path to follow along a
predetermined set of way points
*/
//:://////////////////////////////////////////////
//:: Created By: Aidan Scanlan
//:: Created On: July 10, 2001
//:://////////////////////////////////////////////

void RunCircuit2(int nTens, int nNum, int nRun = FALSE, float fPause = 1.0, int nWalkType = 1)
{
// starting at a given way point, move sequentialy through incrementally
// increasing points until there are no more valid ones.
string sWay = GetLocalString(OBJECT_SELF, "NW_GENERIC_WALKWAYS_PREFIX");

object oTargetPoint;

if ( nWalkType >= 3 )
{
int nRand = Random(nWalkType) + 1;
nTens = nRand/10;
nNum= nRand - (nTens * 10);

oTargetPoint = GetWaypointByTag(sWay + GetTag(OBJECT_SELF) + "_" + IntToString(nTens) +IntToString(nNum));
ActionMoveToObject(oTargetPoint, nRun);
ActionWait(fPause);
ExecuteScript(GetStringLowerCase(GetTag(oTargetPoint)), OBJECT_SELF);
return;
}

oTargetPoint = GetWaypointByTag(sWay + GetTag(OBJECT_SELF) + "_" + IntToString(nTens) +IntToString(nNum));

while(GetIsObjectValid(oTargetPoint))
{
ActionMoveToObject(oTargetPoint, nRun);
ActionWait(fPause);
ExecuteScript(GetStringLowerCase(GetTag(oTargetPoint)), OBJECT_SELF);
nNum++;
if (nNum > 9)
{
nTens++;
nNum = 0;
}
oTargetPoint = GetWaypointByTag(sWay + GetTag(OBJECT_SELF) + "_" + IntToString(nTens) +IntToString(nNum));

}

// ATS
// If walktype is 2 (Circlular), then return at this point...
if ( nWalkType == 2 )
return;

// once there are no more waypoints available, decriment back to the last
// valid point.
nNum--;
if (nNum < 0)
{
nTens--;
nNum = 9;
}

// start the cycle again going back to point 01
oTargetPoint = GetWaypointByTag(sWay + GetTag(OBJECT_SELF) + "_" + IntToString(nTens) +IntToString(nNum));
while(GetIsObjectValid(oTargetPoint))
{
ActionMoveToObject(oTargetPoint, nRun);
ActionWait(fPause);
ExecuteScript(GetStringLowerCase(GetTag(oTargetPoint)), OBJECT_SELF);
nNum--;
if (nNum < 0)
{
nTens--;
nNum = 9;
}
oTargetPoint = GetWaypointByTag(sWay + GetTag(OBJECT_SELF) + "_" + IntToString(nTens) +IntToString(nNum));
}
}



-apres appuyez sur la disquette en haut nomé: (save As)
-nomé-le : ATS_WalkWayPoints
-apres ca il va vous dire qu'il a rencontré un probleme

--error'deplacement' did not compile.
--'ATS_WalkWayPoints.nss(131): ERROR :
NOT RIGHT BRACKET ON EXPRESSION.

-cliquez quand meme sur EXIT en bas a droite pour valider !
-voila votre script :ATS_WalkWayPoints creer.
-de nouveau cliquez droite sur script et new
-de nouveau viré :

void main()
{

}

-toujours une page blanche ok ?
-apres mettez ca :

//::///////////////////////////////////////////////
//:: Default: On Spawn In
//:: NW_C2_DEFAULT9
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
Determines the course of action to be taken
after having just been spawned in
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Oct 25, 2001
//:://////////////////////////////////////////////
#include "NW_O2_CONINCLUDE"
#include "NW_I0_GENERIC"
#include "ats_waypoints"

void main()
{
// OPTIONAL BEHAVIORS (Comment In or Out to Activate ) ****************************************************************************
//SetSpawnInCondition(NW_FLAG_SPECIAL_CONVERSATION);
//SetSpawnInCondition(NW_FLAG_SPECIAL_COMBAT_CONVERSATION);
// This causes the creature to say a special greeting in their conversation file
// upon Perceiving the player. Attach the [NW_D2_GenCheck.nss] script to the desired
// greeting in order to designate it. As the creature is actually saying this to
// himself, don't attach any player responses to the greeting.

//SetSpawnInCondition(NW_FLAG_SHOUT_ATTACK_MY_TARGET);
// This will set the listening pattern on the NPC to attack when allies call
//SetSpawnInCondition(NW_FLAG_STEALTH);
// If the NPC has stealth and they are a rogue go into stealth mode
//SetSpawnInCondition(NW_FLAG_SEARCH);
// If the NPC has Search go into Search Mode
//SetSpawnInCondition(NW_FLAG_SET_WARNINGS);
// This will set the NPC to give a warning to non-enemies before attacking

//SetSpawnInCondition(NW_FLAG_SLEEP);
//Creatures that spawn in during the night will be asleep.
//SetSpawnInCondition(NW_FLAG_DAY_NIGHT_POSTING);
//SetSpawnInCondition(NW_FLAG_APPEAR_SPAWN_IN_ANIMATION);
//SetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS);
//SetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS);
//This will play Ambient Animations until the NPC sees an enemy or is cleared.
//NOTE that these animations will play automatically for Encounter Creatures.

// NOTE: ONLY ONE OF THE FOLOOWING ESCAPE COMMANDS SHOULD EVER BE ACTIVATED AT ANY ONE TIME.
//SetSpawnInCondition(NW_FLAG_ESCAPE_RETURN); // OPTIONAL BEHAVIOR (Flee to a way point and return a short time later.)
//SetSpawnInCondition(NW_FLAG_ESCAPE_LEAVE); // OPTIONAL BEHAVIOR (Flee to a way point and do not return.)
//SetSpawnInCondition(NW_FLAG_TELEPORT_LEAVE); // OPTIONAL BEHAVIOR (Teleport to safety and do not return.)
//SetSpawnInCondition(NW_FLAG_TELEPORT_RETURN); // OPTIONAL BEHAVIOR (Teleport to safety and return a short time later.)

// CUSTOM USER DEFINED EVENTS
/*
The following settings will allow the user to fire one of the blank user defined events in the NW_D2_DefaultD. Like the
On Spawn In script this script is meant to be customized by the end user to allow for unique behaviors. The user defined
events user 1000 - 1010
*/
//SetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1001
//SetSpawnInCondition(NW_FLAG_PERCIEVE_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1002
//SetSpawnInCondition(NW_FLAG_ATTACK_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1005
//SetSpawnInCondition(NW_FLAG_DAMAGED_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1006
//SetSpawnInCondition(NW_FLAG_DISTURBED_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1008
//SetSpawnInCondition(NW_FLAG_END_COMBAT_ROUND_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1003
//SetSpawnInCondition(NW_FLAG_ON_DIALOGUE_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1004
//SetSpawnInCondition(NW_FLAG_DEATH_EVENT); //OPTIONAL BEHAVIOR - Fire User Defined Event 1007

// DEFAULT GENERIC BEHAVIOR (DO NOT TOUCH) *****************************************************************************************
SetListeningPatterns(); // Goes through and sets up which shouts the NPC will listen to.
ATS_WalkWayPoints(); // Optional Parameter: void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)
// 1. Looks to see if any Way Points in the module have the tag "WP_" + NPC TAG + "_0X", if so walk them
// 2. If the tag of the Way Point is "POST_" + NPC TAG the creature will return this way point after
// combat.
GenerateNPCTreasure(); //* Use this to create a small amount of treasure on the creature
}


-appuyez sur la disquette (save As)
-nomé-le : move_normal
-aucune erreur ne doit apparaitre !!!!!!!
-si une erreur vient c'est que vous avez ou
-oubliez de virer pour laisser une page blanche ou
-vous avez mal fait votre copié coller.
-(moi je suis tellement c.. que je mis suis repris a 2 fois)
-cliquez sur EXIT en bas a droite !!!

-et hop on continue !!!
-clic droite sur script+new
-comme toujours une page blanche
-et la lisez attentivement !!!
-faites un copier collé du meme script que : move_normal
-et a la ligne 69 :

ATS_WalkWayPoints(); // Optional Parameter: void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)

-remplacez la par celle ci !

ATS_WalkWayPoints(FALSE, 1.0, 2); // Optional Parameter: void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)

-appuyez disquette (save As)
-nomez-le : move_circuit
-pas d'erreur comme dab sinon vous avez merderrr :p
-appuyez sur EXIT en bas a droite et voila votre 2eme mode cree

-on continue:
-fait la meme chose que pour mode circuit mais changez la ligne 69 par ca :

ATS_WalkWayPoints(FALSE, 1.0, 5); // Optional Parameter: void WalkWayPoints(int nRun = FALSE, float fPause = 1.0)

-appuyez disquette (save As)
-nomez-le : move_random
-pas d'erreur comme dab sinon vous avez merderrr :p
-appuyez sur EXIT en bas a droite et voila votre 3eme mode cree

-y'en a un 4 eme mais je le garde pour moi :mdr:

ensuite c'est vraiment simple !!!!! j'en reviens pas de la simplicité.

vous cree un PNJ, vous mettez 2 ou + de waypoint
ex:
-votre PNJ a le tag GIGI
-les waypoints tag WP_GIGI_01, 02,03 etc etc etc....
-clic droite sur le PNJ puis propriété
-clic script : viré tout les scripts
-dans le script OnSpawn:
-a coté de edit vous avez 3 petits points !
-cliquez dessus et choisissez l'une des formules
ex : circuit
-une fois revenue sur la fenetre, cliquez OK !
-sauvegarder votre module et regardez !!!!!

CA BOUGEEEEEEEEEEEE !!!!!

PS:
le mode normal permet de faire aller le PNJ de A a D
le mode circuit permet de faire tourner en boucle le PNJ
le mode random permet au PNJ de choisir entre les waypoints.

essayez c'est vraiment tres simple et je m'amuse comme un petit fou.
-pour info 3 creatures bouge + 2 gardes+2 PNJ (civiles) bouge sans faire ramer !!!

Par BlackWings le 6/8/2002 à 21:27:56 (#1927244)

je crois uq'il y a un thread sur le sujet des script ou tout le monde post son script (ou celui des autres). C'est plus simple si tu veux pas que ton thread se perde au fin fond du forum ;)

je sais !

Par hido le 6/8/2002 à 21:38:49 (#1927280)

:ange:

nous les quichs on est jamais prit au serrieux.

et puis faut pas tout melanger...

-les scripts proposés sont de bien meilleur info que mon truc piqué sur internet ou la plupart des scripteurs save deja ceci !

et puis je suis sur que meme toi tu sais deja faire ca non ?

;)

ce message s'adresse uniquement aux quichsssss !!!

Clap clap clap !

Par Blam le 7/8/2002 à 0:58:51 (#1927879)

Bravo,

J'ai pas encore testé mais........bravo, c'est cool des gens qui font de la resistance. Ici forum, les quiches parlent aux quiches, je repete les quiches parlent aux quiches !

message personel de papy a son facteur: les quiches ont des oignons, je repete les quiches ont des oignons.


NB Encore bravo, on fait ce qu'on peut ;)

Signée
La quiche masquée

JOL Archives 1.0.1
@ JOL / JeuxOnLine