catapulte

Répondre
Partager Rechercher
j'aimerai que lorsqu'on utilise une catapulte, celle ci lance une boule de feu vers un point choisi aleatoirement entre x WP définis auparavant.

Quelqu'un a t'il deja fait ce genre de script ?
merci a vous ! encore une question : voici le script principal

Code PHP:

///////////////////////////////
//:: Catapulte : Feu !
///////////////////////////////
//:: Cree par Taern
///////////////////////////////

// Lancement d'une boule de feu (apres countdown :p) en direction du waypoint de tag "catapulte_cible" le plus proche
// La fonction Decalage() permet de creer un decalage (cercle de rayon 7 par defaut) aleatoire par rapport a la cible

location Decalage(location lLocfloat fRayon 10.0)
{
    
vector vPos GetPositionFromLocation(lLoc);

    
float fR IntToFloat(Random(100)+1)/100 fRayon;//Definition des coordonnes polaires du nouveau point
    
float fTheta IntToFloat(Random(360));

    
vPos.+= fR*cos(fTheta);                                   //Calcul des modifications faites aux coordonnes initiales
    
vPos.+= fR*sin(fTheta);

    
lLoc Location(GetAreaFromLocation(lLoc), vPos0.0);//Redefinition de la location apres application du decalage

    
return lLoc;
}

void main()
{
    
object oPJ GetNearestCreature(CREATURE_TYPE_PLAYER_CHARPLAYER_CHAR_IS_PC);  //On considere que l'activateur est le PJ le plus proche (pour ne pas utiliser de variables locale)
    
object oCible GetNearestObjectByTag("catapulte_cible");   //Objet cible
    
location lCible Decalage(GetLocation(oCible));//Cible a viser (apres decalage)

    
DelayCommand(1.0AssignCommand(oPJSpeakString("3..")));                      //Decompte
    
DelayCommand(3.0AssignCommand(oPJSpeakString("2..")));
    
DelayCommand(5.0AssignCommand(oPJSpeakString("1..")));
    
DelayCommand(7.0AssignCommand(oPJSpeakString("FEU !")));
    
DelayCommand(6.5AssignCommand(oPJPlayAnimation(ANIMATION_LOOPING_GET_LOW3.01.0)));
    
DelayCommand(7.5SpeakString("Tchak !"));
    
DelayCommand(9.0ActionCastSpellAtLocation(SPELL_FIREBALL,lCible,METAMAGIC_NONE,1,PROJECTILE_PATH_TYPE_BALLISTIC,1));//Application de l'effet sur la cible
    
DelayCommand(7.5DestroyObject(GetFirstItemInInventory()));//Suppression du boulet
    
DelayCommand(7.5SetLocalInt(OBJECT_SELF"boulet_present"FALSE));//On laisse la place a un autre boulet

    

qu'est ce que je dois faire pour que la boule de feu choisisse entre 3 ou 4 WP definis auparavant ?
Tu crées 4 waypoints avec le tag "catapulte_cible", et tu remplaces la ligne qui désigne la cible par celle_ci :

Code PHP:

object oCible GetObjectByTag("catapulte_cible",Random(3)); 

Si tu mets 6 cibles, c'est Random(5), etc...
Voici le script modifié en tenant compte de ce qui a été dit :

Code PHP:


///////////////////////////////
//:: Catapulte : Feu !
///////////////////////////////
//:: Cree par Taern
///////////////////////////////

// Lancement d'une boule de feu (apres countdown) aléatoirement en direction du waypoint de tag "catapulte_cible" parmi 4

void main()
{
    
object oPJ GetNearestCreature(CREATURE_TYPE_PLAYER_CHARPLAYER_CHAR_IS_PC);  //On considere que l'activateur est le PJ le plus proche (pour ne pas utiliser de variables locale)
    
object oCible GetObjectByTag("catapulte_cible",Random(3)); //Objet cible
    
location lCible GetLocation(oCible); //Cible a viser

    
DelayCommand(1.0AssignCommand(oPJSpeakString("3..")));                      //Decompte
    
DelayCommand(3.0AssignCommand(oPJSpeakString("2..")));
    
DelayCommand(5.0AssignCommand(oPJSpeakString("1..")));
    
DelayCommand(7.0AssignCommand(oPJSpeakString("FEU !")));
    
DelayCommand(6.5AssignCommand(oPJPlayAnimation(ANIMATION_LOOPING_GET_LOW3.01.0)));
    
DelayCommand(7.5SpeakString("Tchak !"));
    
DelayCommand(9.0ActionCastSpellAtLocation(SPELL_FIREBALL,lCible,METAMAGIC_NONE,1,PROJECTILE_PATH_TYPE_BALLISTIC,1));//Application de l'effet sur la cible
    
DelayCommand(7.5DestroyObject(GetFirstItemInInventory()));//Suppression du boulet
    
DelayCommand(7.5SetLocalInt(OBJECT_SELF"boulet_present"FALSE));//On laisse la place a un autre boulet

    

Répondre

Connectés sur ce fil

 
1 connecté (0 membre et 1 invité) Afficher la liste détaillée des connectés