Menu
Home
About
About GameGuru MAX
Demo Games
Help
Features
Education
News
Contact
Products
GameGuru MAX
GameGuru MAX DLCs
GameGuru Classic
Forums
Login
Forum Home
Search
French
/ Astuce: faire un objet "balise"
Author
Message
gib
15
Years of Service
User Offline
Joined:
30th Nov 2008
Location:
Terribilis Locus
Profile
Posted:
19th Jul 2014 09:40
Edited at:
19th Jul 2014 10:50
Link
Bonjour, n' ayant pas trouvé de moyen de se repérer dans un vaste décor, je choisis un objet pour représenter une balise (borne, croix,téléphone...etc), dans son menu contextuel "A.I MAIN" je lui attribue le fichier lua "user_balise" créé avec le code ci-dessous:
-- xxxxxxxxxxxxxx copier ci-dessousxxxxxxxxxxxxx
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Rappel: le fichier doit avoir le même nom que la fonction moins "_main" , donc ici "user_balise"
-- ICI Entité donne sa distance au joueur si infèrieure à 3000
function user_balise_init(e)
end
function user_balise_main(e)
PlayerDX = math.abs(g_Entity[e]['x'] - g_PlayerPosX);
PlayerDY = math.abs(g_Entity[e]['y'] - g_PlayerPosY);
PlayerDZ = math.abs(g_Entity[e]['z'] - g_PlayerPosZ);
PlayerDist = math.floor(math.sqrt(PlayerDX*PlayerDX+PlayerDY*PlayerDY+PlayerDZ*PlayerDZ));
if PlayerDist < 3000 and PlayerDist >2500 then Prompt("BALISE ACTIVE");
end
if PlayerDist < 2500 and PlayerDist > 150 then Prompt(PlayerDist);
end
if PlayerDist < 150 then Prompt("balise O.K");
end
-- activer la commande ci-dessous en supprimant les 2 tirets des deux lignes ci-dessous pour que la balise se détruise une fois trouvée. Pensez à enregistrer.
-- if PlayerDist < 100 then Destroy(e);
-- end
-- fin fonction
end
-- xxxxxxxxxxxxxxxxxxxxxjusqu' ici xxxxxxxxxxxxxx
PM
gib
15
Years of Service
User Offline
Joined:
30th Nov 2008
Location:
Terribilis Locus
Profile
Posted:
19th Jul 2014 10:00
Edited at:
19th Jul 2014 10:51
Link
Est-ce que quelqu'un peut me dire pourquoi mes "E" accents n'ont pas été pris en compte ?
PM
gib
15
Years of Service
User Offline
Joined:
30th Nov 2008
Location:
Terribilis Locus
Profile
Posted:
19th Jul 2014 10:23
Edited at:
19th Jul 2014 10:59
Link
Suite, ATTENTION ANNULER MES POSTS, NE PAS UTILISER LE CODE, UNE ERREUR SI TROUVE SUITE UNE MODIF DE DERNIERE MINUTE.
Bon, je crois que j' ai rectifié, mais il faut que je le teste.
NOTEZ: la manipulation des fichiers de script (lua) sont délicates,
la moindre erreur provoque des bloquages. A utiliser en connaissance de cause.
_ Bon ça marche.
PM
Back to top
Login to post a reply
Server time is:
2024-04-26 13:54:15
Your offset time is:
2024-04-26 13:54:15