Worldedit
  Worldedit
Le site sur l'éditeur de warcraft 3 !
 
  FAQFAQ   RechercherRechercher   Liste des MembresListe des Membres    Groupes d'utilisateursGroupes d'utilisateurs   medals.php?sid=1fb6d5a19eda6b907ba679d2759aaf7dMédailles   S'enregistrerS'enregistrer 
 ProfilProfil   Se connecter pour vérifier ses messages privésSe connecter pour vérifier ses messages privés   ConnexionConnexion 
  FAQFAQ World Editor   UploadUploader une map ou une image    UploadAjouter sa map à l'annuaire   UploadConsulter l'annuaire

Initialisation de marchés

 
Poster un nouveau sujet   Répondre au sujet    Worldedit Index du Forum -> Aide sur les déclencheurs
Voir le sujet précédent :: Voir le sujet suivant  
Auteur Message
 atchalak
Membre honoraire


Inscrit le: 06 Déc 2010
Messages: 323
Sujets: 16



MessagePosté le: 04/04/22 22:42    Sujet du message: Initialisation de marchés Citer

Bonjour à ceux qui verront ça, je vois qu'il y plus grand monde dans le coin, mais au cas ou et comme j'ai besoin d'aide, autant vous en faire part ici ! Merci donc à tous ceux qui verront ça et plus encore à ceux qui prendront le temps de répondre !

Alors voilà, je suis sur un projet de map pirate, et j'ai créé un système de marché qui sont initialisés au début de la partie : je constitue ma liste des bien marchandables (au nombre de 15) et pour chaque marché j'en prend 5 au hasard. Pour garantir d'avoir 5 objets dans chaque marché, je place les types d'objets choisis à la fin de ma liste et je sélectionne sur length-a. Ensuite, sur les 5 choisit, j'en pick un au hasard qui devient le bien en surplus, et j'en pick un autre, dans ma liste de bien échangeable, de 1 à length-a, pour m'assurer qu'il ne soit pas vendu dans mon marché, celui-ci devient le bien recherché.

Ce système vise à créer un réseau de marché donc les objets vendus sont tirés au hasard chaque partie, qui proposent un bien moitié prix et un bien non-vendu qu'on y vendra plus cher.

Seulement, ma boucle d'initialisation foire et je me retrouve avec certains marchés dont l'offre et la demande ne sont pas gérés.

Voici le code :
Gui:
Trigger:
-------- Init tradeable good list --------
Set VariableSet tradeableGoods[1] = Beer Keg
Set VariableSet tradeableGoods[2] = Chocolate
Set VariableSet tradeableGoods[3] = Coffee
Set VariableSet tradeableGoods[4] = Ebony
Set VariableSet tradeableGoods[5] = Flax
Set VariableSet tradeableGoods[6] = Furs
Set VariableSet tradeableGoods[7] = Gold
Set VariableSet tradeableGoods[8] = Mahogany
Set VariableSet tradeableGoods[9] = Rum
Set VariableSet tradeableGoods[10] = Silk
Set VariableSet tradeableGoods[11] = Silver
Set VariableSet tradeableGoods[12] = Spices
Set VariableSet tradeableGoods[13] = Sugar
Set VariableSet tradeableGoods[14] = Tobacco
Set VariableSet tradeableGoods[15] = Whale oil
-------- Init markets --------
Set VariableSet Markets = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Market))
Unit Group - Pick every unit in Markets and do (Actions)
Loop - Actions
-------- init sold items --------
Collapse For each (Integer A) from 1 to 5, do (Actions)
Loop - Actions
Set VariableSet itemTypeTempId = (Random integer number between 1 and (16 - (Integer A)))
Set VariableSet itemTypeTemp = tradeableGoods[itemTypeTempId]
Neutral Building - Add itemTypeTemp to (Picked unit) with 1 in stock and a max stock of 10
Set VariableSet tradeableGoods[itemTypeTempId] = tradeableGoods[(16 - (Integer A))]
Set VariableSet tradeableGoods[(21 - (Integer A))] = itemTypeTemp
Set VariableSet itemTypeTempList[(Integer A)] = itemTypeTemp
-------- init good in surplus --------
Set VariableSet itemTypeTemp = itemTypeTempList[(Random integer number between 1 and 5)]
Set VariableSet itemTemp = (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to itemTypeTemp))
Ability - Set Tooltip of Offer  to (Offer :  + (Name of itemTemp)) for level marketNumber
Ability - Set Extended Tooltip of Offer  to (Description of itemTemp) for level marketNumber
Unit - Set level of Offer  for (Picked unit) to marketNumber
-------- init wanted goods --------
Set VariableSet itemTypeTemp = tradeableGoods[(Random integer number between 1 and 15)]
Set VariableSet itemTemp = (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to itemTypeTemp))
Ability - Set Tooltip of Demand  to (Demand :  + (Name of itemTemp)) for level marketNumber
Ability - Set Extended Tooltip of Demand  to (Description of itemTemp) for level marketNumber
Unit - Set level of Demand  for (Picked unit) to marketNumber
Set VariableSet marketNumber = (marketNumber + 1)


Je comprend pas exactement ce qu'il se passe, je fais mes tests sur trois marchés, et à chaque fois, ils s'initialisent dans le mauvais sens, il y en a toujours un qui n'a même pas été initialisé, et les tooltips des deux autres sont faux (comme si le 2 avait reçut le tooltip du 1e, le 3e celui du 2e et le premier aucun).

Si jamais quelqu'un a une idée, qu'il hésite pas !

Merci d'avance !
_________________
Revenir en haut
Voir le profil de l'utilisateur Envoyer un message privé MSN Messenger
 atchalak
Membre honoraire


Inscrit le: 06 Déc 2010
Messages: 323
Sujets: 16



MessagePosté le: 07/04/22 10:33    Sujet du message: Citer

j'ai trouvé la solution, si jamais quelqu'un en a besoin, la voilà :

Gui:
Trigger:
Events
Map initialization
Time - Elapsed game time is 0.10 seconds
Conditions
Collapse Actions
Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked player) slot status) Equal to Is playing
Then - Actions
Set VariableSet playerTemp = (Picked player)
Player Group - Pick every player in (All enemies of playerTemp.) and do (Actions)
Loop - Actions
Player - Make playerTemp treat (Picked player) as an Neutral
Player - Make (Picked player) treat playerTemp as an Neutral
Player - Set playerTemp.Current gold to 300
Unit - Create 1 Galion for playerTemp at (Random point in (Playable map area)) facing (Random angle) degrees
Unit - Create 1 Galion for playerTemp at (Center of testzone <gen>) facing (Random angle) degrees
Unit - Create 1 Sloop for playerTemp at (Center of testzone <gen>) facing (Random angle) degrees
Selection - Select (Last created unit) for playerTemp
Unit - For (Last created unit), Ability Drop Anchor , Disable ability: Vrai, Hide UI: Vrai
Set VariableSet boats[(Player number of playerTemp)] = (Last created unit)
Unit - Create 1 Wind for playerTemp at (Position of (Last created unit)) facing windAngle degrees
Set VariableSet winds[(Player number of playerTemp)] = (Last created unit)
Camera - Lock camera target for playerTemp to (Last created unit), offset by (0.00, 0.00) using The unit's rotation
Camera - Set playerTemp's camera Rotation to (Facing of (Last created unit)) over 1.00 seconds
Camera - Set playerTemp's camera Angle of attack to 335.00 over 1.00 seconds
Set VariableSet boatTurnSpeed[(Player number of playerTemp)] = 3.00
Else - Actions
Trigger - Turn on movement <gen>
-------- Init tradeable good list --------
Set VariableSet tradeableGoods[1] = Beer Keg
Set VariableSet tradeableGoods[2] = Chocolate
Set VariableSet tradeableGoods[3] = Coffee
Set VariableSet tradeableGoods[4] = Ebony
Set VariableSet tradeableGoods[5] = Flax
Set VariableSet tradeableGoods[6] = Furs
Set VariableSet tradeableGoods[7] = Gold
Set VariableSet tradeableGoods[8] = Mahogany
Set VariableSet tradeableGoods[9] = Rum
Set VariableSet tradeableGoods[10] = Silk
Set VariableSet tradeableGoods[11] = Silver
Set VariableSet tradeableGoods[12] = Spices
Set VariableSet tradeableGoods[13] = Sugar
Set VariableSet tradeableGoods[14] = Tobacco
Set VariableSet tradeableGoods[15] = Whale oil
-------- Init markets --------
Set VariableSet Markets = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Market))
Unit Group - Pick every unit in Markets and do (Actions)
Loop - Actions
-------- init sold items --------
Collapse For each (Integer A) from 1 to 5, do (Actions)
Loop - Actions
Set VariableSet itemTypeTempId = (Random integer number between 1 and (16 - (Integer A)))
Set VariableSet itemTypeTemp = tradeableGoods[itemTypeTempId]
Neutral Building - Add itemTypeTemp to (Picked unit) with 1 in stock and a max stock of 10
Set VariableSet tradeableGoods[itemTypeTempId] = tradeableGoods[(16 - (Integer A))]
Set VariableSet tradeableGoods[(16 - (Integer A))] = itemTypeTemp
Set VariableSet itemTypeTempList[(Integer A)] = itemTypeTemp
-------- init Offer --------
Set VariableSet itemTypeTemp = itemTypeTempList[(Random integer number between 1 and 5)]
Set VariableSet itemTemp = (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to itemTypeTemp))
Unit - Set Unit: (Picked unit)'s Integer Field: Level ('ulev') to Value: (Integer((Description of itemTemp)))
-------- init Demand --------
Set VariableSet itemTypeTemp = tradeableGoods[(Random integer number between 1 and 10)]
Set VariableSet itemTemp = (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to itemTypeTemp))
Unit - Set Unit: (Picked unit)'s Integer Field: Formation Rank ('ufor') to Value: (Integer((Description of itemTemp)))
-------- Reinit tradeable good list --------
Set VariableSet tradeableGoods[1] = Beer Keg
Set VariableSet tradeableGoods[2] = Chocolate
Set VariableSet tradeableGoods[3] = Coffee
Set VariableSet tradeableGoods[4] = Ebony
Set VariableSet tradeableGoods[5] = Flax
Set VariableSet tradeableGoods[6] = Furs
Set VariableSet tradeableGoods[7] = Gold
Set VariableSet tradeableGoods[8] = Mahogany
Set VariableSet tradeableGoods[9] = Rum
Set VariableSet tradeableGoods[10] = Silk
Set VariableSet tradeableGoods[11] = Silver
Set VariableSet tradeableGoods[12] = Spices
Set VariableSet tradeableGoods[13] = Sugar
Set VariableSet tradeableGoods[14] = Tobacco
Set VariableSet tradeableGoods[15] = Whale oil
-------- init goods value --------
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[1])) to 200
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[2])) to 400
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[3])) to 400
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[4])) to 800
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[5])) to 200
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[6])) to 200
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[7])) to 1000
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[8])) to 200
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[9])) to 300
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[10])) to 500
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[11])) to 600
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[12])) to 600
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[13])) to 700
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[14])) to 500
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[15])) to 800



J'ai bien rework le système, les tooltips c'était naze alors maintenant j'utilise un spell qui récupère des integer values que j'initialise dans ce trigger. Ca marche très bien !
_________________
Revenir en haut
Voir le profil de l'utilisateur Envoyer un message privé MSN Messenger
 atchalak
Membre honoraire


Inscrit le: 06 Déc 2010
Messages: 323
Sujets: 16



MessagePosté le: 07/04/22 10:33    Sujet du message: Citer

j'ai trouvé la solution, si jamais quelqu'un en a besoin, la voilà :

Gui:
Trigger:
Events
Map initialization
Time - Elapsed game time is 0.10 seconds
Conditions
Collapse Actions
Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked player) slot status) Equal to Is playing
Then - Actions
Set VariableSet playerTemp = (Picked player)
Player Group - Pick every player in (All enemies of playerTemp.) and do (Actions)
Loop - Actions
Player - Make playerTemp treat (Picked player) as an Neutral
Player - Make (Picked player) treat playerTemp as an Neutral
Player - Set playerTemp.Current gold to 300
Unit - Create 1 Galion for playerTemp at (Random point in (Playable map area)) facing (Random angle) degrees
Unit - Create 1 Galion for playerTemp at (Center of testzone <gen>) facing (Random angle) degrees
Unit - Create 1 Sloop for playerTemp at (Center of testzone <gen>) facing (Random angle) degrees
Selection - Select (Last created unit) for playerTemp
Unit - For (Last created unit), Ability Drop Anchor , Disable ability: Vrai, Hide UI: Vrai
Set VariableSet boats[(Player number of playerTemp)] = (Last created unit)
Unit - Create 1 Wind for playerTemp at (Position of (Last created unit)) facing windAngle degrees
Set VariableSet winds[(Player number of playerTemp)] = (Last created unit)
Camera - Lock camera target for playerTemp to (Last created unit), offset by (0.00, 0.00) using The unit's rotation
Camera - Set playerTemp's camera Rotation to (Facing of (Last created unit)) over 1.00 seconds
Camera - Set playerTemp's camera Angle of attack to 335.00 over 1.00 seconds
Set VariableSet boatTurnSpeed[(Player number of playerTemp)] = 3.00
Else - Actions
Trigger - Turn on movement <gen>
-------- Init tradeable good list --------
Set VariableSet tradeableGoods[1] = Beer Keg
Set VariableSet tradeableGoods[2] = Chocolate
Set VariableSet tradeableGoods[3] = Coffee
Set VariableSet tradeableGoods[4] = Ebony
Set VariableSet tradeableGoods[5] = Flax
Set VariableSet tradeableGoods[6] = Furs
Set VariableSet tradeableGoods[7] = Gold
Set VariableSet tradeableGoods[8] = Mahogany
Set VariableSet tradeableGoods[9] = Rum
Set VariableSet tradeableGoods[10] = Silk
Set VariableSet tradeableGoods[11] = Silver
Set VariableSet tradeableGoods[12] = Spices
Set VariableSet tradeableGoods[13] = Sugar
Set VariableSet tradeableGoods[14] = Tobacco
Set VariableSet tradeableGoods[15] = Whale oil
-------- Init markets --------
Set VariableSet Markets = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Market))
Unit Group - Pick every unit in Markets and do (Actions)
Loop - Actions
-------- init sold items --------
Collapse For each (Integer A) from 1 to 5, do (Actions)
Loop - Actions
Set VariableSet itemTypeTempId = (Random integer number between 1 and (16 - (Integer A)))
Set VariableSet itemTypeTemp = tradeableGoods[itemTypeTempId]
Neutral Building - Add itemTypeTemp to (Picked unit) with 1 in stock and a max stock of 10
Set VariableSet tradeableGoods[itemTypeTempId] = tradeableGoods[(16 - (Integer A))]
Set VariableSet tradeableGoods[(16 - (Integer A))] = itemTypeTemp
Set VariableSet itemTypeTempList[(Integer A)] = itemTypeTemp
-------- init Offer --------
Set VariableSet itemTypeTemp = itemTypeTempList[(Random integer number between 1 and 5)]
Set VariableSet itemTemp = (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to itemTypeTemp))
Unit - Set Unit: (Picked unit)'s Integer Field: Level ('ulev') to Value: (Integer((Description of itemTemp)))
-------- init Demand --------
Set VariableSet itemTypeTemp = tradeableGoods[(Random integer number between 1 and 10)]
Set VariableSet itemTemp = (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to itemTypeTemp))
Unit - Set Unit: (Picked unit)'s Integer Field: Formation Rank ('ufor') to Value: (Integer((Description of itemTemp)))
-------- Reinit tradeable good list --------
Set VariableSet tradeableGoods[1] = Beer Keg
Set VariableSet tradeableGoods[2] = Chocolate
Set VariableSet tradeableGoods[3] = Coffee
Set VariableSet tradeableGoods[4] = Ebony
Set VariableSet tradeableGoods[5] = Flax
Set VariableSet tradeableGoods[6] = Furs
Set VariableSet tradeableGoods[7] = Gold
Set VariableSet tradeableGoods[8] = Mahogany
Set VariableSet tradeableGoods[9] = Rum
Set VariableSet tradeableGoods[10] = Silk
Set VariableSet tradeableGoods[11] = Silver
Set VariableSet tradeableGoods[12] = Spices
Set VariableSet tradeableGoods[13] = Sugar
Set VariableSet tradeableGoods[14] = Tobacco
Set VariableSet tradeableGoods[15] = Whale oil
-------- init goods value --------
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[1])) to 200
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[2])) to 400
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[3])) to 400
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[4])) to 800
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[5])) to 200
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[6])) to 200
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[7])) to 1000
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[8])) to 200
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[9])) to 300
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[10])) to 500
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[11])) to 600
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[12])) to 600
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[13])) to 700
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[14])) to 500
Item - Set the custom value of (Random item in initItems <gen> matching ((Item-type of (Matching item)) Equal to tradeableGoods[15])) to 800



J'ai bien rework le système, les tooltips c'était naze alors maintenant j'utilise un spell qui récupère des integer values que j'initialise dans ce trigger. Ca marche très bien !
_________________
Revenir en haut
Voir le profil de l'utilisateur Envoyer un message privé MSN Messenger
Montrer les messages depuis:   
Poster un nouveau sujet   Répondre au sujet    Worldedit Index du Forum -> Aide sur les déclencheurs Toutes les heures sont au format GMT + 1 Heure
Page 1 sur 1

 
Sauter vers:  
Vous ne pouvez pas poster de nouveaux sujets dans ce forum
Vous ne pouvez pas répondre aux sujets dans ce forum
Vous ne pouvez pas éditer vos messages dans ce forum
Vous ne pouvez pas supprimer vos messages dans ce forum
Vous ne pouvez pas voter dans les sondages de ce forum


Powered by phpBB © 2001, 2005 phpBB Group
Traduction par : phpBB-fr.com