Conduire un char t34.
(Tuto pour conduire un char t34 en solo sur coduo.)

Retour au sommaire.

Tutorial Créé par Tropheus.

Dans ce tutorial vous allez apprendre à conduire un char t34. Il y juste un bug que je n'ai pas réussi à corriger c'estqu'avec votre char vous n'arrivez pas à écraser vos ennemis.

1/  MAPPING.

Pour cela rien de bien compliqué. Une map comme il faut avec un info_player_start.

De plus, vous allez y mettre le script_vehicle suivant.

model/xmodel/vehicle_tank_t34_green_viewmodel_p
targetname/player_tank
vehicletype/t34

Ce qui vous donne ceci.



En vue2D

 


En vue 3D

Et c'en est fini de la partie mapping.

2/ SCRIPTING

a/ Le fichier gsc.

Il y a surement des lignes inutiles mais celles qui sont là ne gènent pas le script.

#using_animtree( "panzerIV" );
main()
{
maps\_load_gmi::main();
playertank = getent("player_tank","targetname");
level.playertank = playertank;
setcvar("debug_tankgod", "off");
setcvar("debug_enemykillcomit", "on");

//GIVE PLAYER WEAPONS
level.player takeallweapons();
level.player giveWeapon("panzerfaust");
level.player giveWeapon("thompson");
level.player giveWeapon("colt");
level.player giveWeapon("fraggrenade");
level.player switchToWeapon("thompson");

maps\_t34_pi::mainnoncamo();

//définition du tank comme joueur///

level thread tank_use();
level thread put_player_in_tank();
level.playertank thread init_player();
playertank thread tank_hud();

}


put_player_in_tank()
{
level.playertank useby(level.player); // puts player in tank
}

////////////////////
init_player() // self is intended to be level.playertank
{
self useAnimTree( #animtree );
self player_life();
self thread player_kill();
self thread player_shoot();
}

player_life()
{
skill = getdifficulty();
println("skill is ",skill);
if(skill == ("easy"))
self.health = 9500; // 6500;
else if(skill == ("medium"))
self.health = 8000; // 5500;
else if(skill == ("hard"))
self.health = 7500; // 5000;
else if(skill == ("fu"))
self.health = 4750; // 3500;
else if(skill == ("gimp"))
self.health = 11000; // 7500;
else
self.health = 7500; // 5000;
println("Player tank health is ", self.health);
thread maps\_tank_pi::conechecksamples(); // completely uncommented IW/GMI function
}

life()
{

self.health = (randomint(1000)+500);
thread maps\_tank_gmi::conechecksamples();
}
player_kill()
{
level endon("exit_tank");

self UseAnimTree(#animtree);

// green T34s
if((self.model == "xmodel/vehicle_tank_t34") || (self.model == "xmodel/vehicle_tank_t34_green_viewmodel_p") || (self.model == "xmodel/MP_vehicle_tank_t34"))
{
self.deathmodel = "xmodel/vehicle_tank_t34_destroyed";
}
else
{
// winter camoflage T34s
if((self.model == "xmodel/vehicle_tank_t34_camo") || (self.model == "xmodel/vehicle_tank_t34_viewmodel"))
{
self.deathmodel = "xmodel/vehicle_tank_t34_camo_destroyed";
}
else
{
println("Player T34 using unknown model: ",self.model," -- no deathmodel assigned.");
}
}

self.deathfx = loadfx ("fx/explosions/vehicles/t34_complete.efx");
self.deathsound = "explo_metal_rand";

self waittill( "death", attacker );
self setmodel( self.deathmodel );
self playsound( self.deathsound );
self setAnimKnobRestart( %PanzerIV_d );
playfx( self.deathfx, self.origin );
earthquake( 0.25, 3, self.origin, 1050 );
}

shoot()
{
while(self.health > 0)
{
self waittill( "turret_fire" );
self fire();
}
}

player_shoot()
{
level endon("exit_tank");
// self endon("exit_tank");

while(self.health > 0)
{
self waittill( "turret_fire" );
self fire();
//level.playertank playsound ("t34_fire");//je sais pas pourquoi il faut l'enlenver mais toujours est-il que lorsqu'elle est lue on a une erreur si elle n'est pas lue on a quand même le son.
}

}

fire()
{
if(self.health <= 0)
return;

// fire the turret // animation de tir du char
self FireTurret();

// play the fire animation
self setAnimKnobRestart( %PanzerIV_fire );
}


////accessoires du tank sur l'écran jauge de vie etc...///
tank_hud()
{
level endon("exit_tank");

level thread tank_hud_fireicon();
//level thread tank_hud_fireicon_remove();

self.maxhealth = self.health;

maxvisheight = 118; // full health bar
minvisheight = 12; // empty health bar

tankhud = newHudElem();
tankhud setShader("gfx/hud/tankhudhealthbar", 32, maxvisheight);
tankhud.alignX = "right";
tankhud.alignY = "bottom";
tankhud.x = 635;
tankhud.y = 450;

tankhud2 = newHudElem();
tankhud2 setShader("gfx/hud/tankhudback", 32, 128);
tankhud2.alignX = "right";
tankhud2.alignY = "bottom";
tankhud2.x = 635;
tankhud2.y = 450;

//level thread tank_hud_remove(tankhud, tankhud2);

if (getcvar("debug_tankgod") != "off")
while(1)
{
self waittill ("damage");
self.health = self.maxhealth;
}

while(self.health > 0)
{
level.autosavehealth = self.health / self.maxhealth;

self waittill ("damage",amount,attacker);

// println("tankdrive::tank_hud damage: ",amount);

height = (((float)self.health / (float)self.maxhealth) * (float)(maxvisheight - minvisheight)) + minvisheight;

// println("Height: ",height);

// this can happen if the player takes a bunch of damage
if(height<0)
{
height = 0;
}

tankhud setShader("gfx/hud/tankhudhealthbar", 32, height);

}

// kill tank and player // Mort du joueur et du tank
radiusDamage ( self.origin, 2, 10000, 9000);
level.player DoDamage ( level.player.health + 50, (0,0,0) );
}

tank_hud_fireicon()
{
level endon("exit_tank");

level.tankfireicon = newHudElem();
level.tankfireicon.alignX = "center";
level.tankfireicon.alignY = "middle";
level.tankfireicon.x = 590;
level.tankfireicon.y = 420;
level.tankfireicon setShader("gfx/hud/hud@fire_ready_shell.tga", 64, 64);

while (1)
{
level.tankfireicon.alpha = 1;
level.playertank waittill ("turret_fire");
level.tankfireicon.alpha = 0;
wait .5;
level.playertank playsound ("tank_reload");
while (level.playertank isTurretReady() != true)
wait .2;
}

}

//////////////////////ressources///////////////////////////////
tank_use()
{
playertank = getent("player_tank","targetname");

playertank maps\_t34_pi::init_player();//ici
playertank thread maps\_tankgun_gmi::mginit(); // spawns the playertank's MG turret //Mets une mg42 automatique sur le char
playertank.ismoving = 1;
level.playertank = playertank;
level.playertank thread maps\_treads_pi::main(); // tread fx ici

if(getcvar("debug_notank") == "off")
{
level thread put_player_in_tank();
}
}

b/ Le fichier csv.

Créez un dossier "sp" que vous mettrez dans le dossier : "soundloadspecs".

soundloadspecs/sp

La dedans un fichier .csv que vous nommerez du nom de votre map.

dialog_generic.csv
gmi_dialog_generic.csv
gmi_music.csv
gmi_sound.csv
gmi_voiceovers.csv
iw_music.csv
iw_sound.csv
iw_sound2.csv
iw_voiceovers.csv
pi_sound.csv
surface_gmi_sound.csv
wep_gmi_sound.csv

gmi_mp_vehicles_ru.csv //Pour avoir le son du char le reste étant pour tous les autres sons par defauts.

Télécharger le fichier test pour UO seulement ici

Bon jeu

Tropheus

Pour CaskamiProd et MohaaScriptLib
avec l'autorisation de l'auteur.
Tropheus ©
juillet 2006