Posté le: 09/05/09 12:28 Sujet du message: hyperespace
Bonjour
Il y a quelques jours, j'ai testé une map nommé "stargate galactic conflict". Dans cette map, un sort ma beaucoup intéressé: l'hyperespace
Je vous explique:
Lorsqu'un vaisseau veut entrer en hyperespace, il cible l'endroit ou il veux en sortir. Selon la distance, il consomme plus ou moins de carburant(bois). Devant lui se créé une fenêtre d'hyperespace(un portail), puis il fonce dedans, ce qui le fait devenir invincible, l'empêche d'attaquer, et le fait allé à très grande vitesse jusqu'à la prochaine fenêtre d'hyperespace, situé à la zone cible du sort. De plus, certaines unités disposant d'une certaine compétence peuvent emprunter la fenêtre d'hyperespace créé par un autre vaisseau.
Je suis pose que c'est un declencheur JASS extrêmement compliqué, alors quelqu'un serait il comment faire?
Merci d'avance _________________
Inscrit le: 22 Nov 2007 Messages: 677 Sujets: 27 Spécialité en worldedit: Jamais sortir ses projets ?
Posté le: 09/05/09 12:35 Sujet du message:
Mauvaise endroit pour posté sa.
Et le Jass n'a l'air d'apporté rien de plus que les variable local (aussi accessible par certain moyen en GUI) qui serait utile dans se cas , mais même l'emploi d'une "structure" serait suffisant et accessible en GUI.
Désolé, je pensais pas que le GUI pouvait faire ça :p
Comme j'ai vue "fonction JASS", je pensais que c'était ici, alors encore une fois désolé^^
Bon maintenant, je vais cherché moi même vue que c'est du GUI
Ah et merci aussi :p _________________
Inscrit le: 22 Nov 2007 Messages: 677 Sujets: 27 Spécialité en worldedit: Jamais sortir ses projets ?
Posté le: 09/05/09 12:45 Sujet du message:
C'est pas non plus hyper simple a faire , si tu n'en a aucune idée de comment faire tu peut laissé tombé le fait de le faire par tes propre moyen.
Sinon essaye de voir si les portail de warcraft ne peuvent pas te satisfaire , se serait plus simple a réalisé mais moins flexible (ont peut pas par exemple faire qu'ont passe le portail seulement si ont a une compétence sans que sa devienne le gros bordel). _________________
endglobals
//=================================================
private function filter takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_FLYING)==false and IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false and IsUnitType(GetFilterUnit(),UNIT_TYPE_DEAD)==false
endfunction
//=================================================
private struct jumpdmg
unit target
real angle
integer distance
integer i
destructable p1
destructable p2
real x1
real y1
real x2
real y2
endstruct
//=================================================
private function Action takes nothing returns nothing
local timer t = GetExpiredTimer()
local jumpdmg js = GetTimerData(t)
local real newX = GetUnitX(js.target) + SPEED*Cos(js.angle)
local real newY = GetUnitY(js.target) + SPEED*Sin(js.angle)
local sound son2 = gg_snd_ShimmeringPortalDeath
if (js.i < js.distance) and GetUnitState(js.target, UNIT_STATE_LIFE) > 0 then
set js.i = js.i + 1
call SetUnitPosition(js.target, newX, newY)
else
call SetUnitPathing( js.target, true)
call SetUnitInvulnerable(js.target, false)
call UnitRemoveAbility( js.target, HYP)
call KillDestructable(js.p2)
call SetSoundPosition(son2, js.x1,js.y1, 0.00)
call SetSoundVolume(son2, 200)
call StartSound(son2)
call KillDestructable(js.p1)
call SetSoundPosition(son2, js.x2,js.y2, 0.00)
call SetSoundVolume(son2, 200)
call StartSound(son2)
call SetUnitState(js.target, UNIT_STATE_LIFE, GetUnitState(js.target,UNIT_STATE_LIFE)-GetRandomReal(10.00,0.20*GetUnitState(js.target,UNIT_STATE_MAX_LIFE)) )
call ReleaseTimer(t)
call js.destroy()
endif
set son2 = null
endfunction
//=================================================
private function jumpdamage takes unit u, real x1, real y1, real x2, real y2 returns nothing
local timer t = NewTimer()
local jumpdmg js = jumpdmg.create()
local real a = GetUnitFacing(u)
local sound son = gg_snd_ShimmeringPortalBirth
call SetUnitPathing( u, false)
set js.target = u
set js.angle = Atan2((y2 -y1), (x2 - x1))
set js.distance =R2I(SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/SPEED)
set js.i = 0
set js.x1 = x1+400.00*Cos(js.angle)
set js.y1 = y1+400.00*Sin(js.angle)
set js.x2 = x2-200.00*Cos(js.angle)
set js.y2 = y2-200.00*Sin(js.angle)
set js.p1 = CreateDestructable('OTsp',js.x1,js.y1,a,1.00,0)
call SetDestructableAnimation(js.p1,"birth")
call SetSoundPosition(son, js.x1,js.y1, 0.00)
call SetSoundVolume(son, 200)
call StartSound(son)
set js.p2 = CreateDestructable('OTsp',js.x2,js.y2,a,1.00,0)
call SetDestructableAnimation(js.p2,"birth")
call SetSoundPosition(son, js.x2,js.y2, 0.00)
call SetSoundVolume(son, 200)
call StartSound(son)
call PolledWait(7.00)
call SetUnitInvulnerable(js.target, true)
call UnitAddAbility(js.target, HYP)
call SetUnitFacing(js.target, a)
call SetTimerData(t, js)
call TimerStart (t, TIMEOUT, true, function Action )
set u = null
set son = null
endfunction
//=================================================
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000' or GetSpellAbilityId() == 'A01V'
endfunction
//=================================================
private function Actions takes nothing returns nothing
local unit u1 = GetTriggerUnit()
local real x1 = GetUnitX(u1)
local real y1 = GetUnitY(u1)
local real x2 = 0.00
local real y2 = 0.00
set udg_point = GetSpellTargetLoc()
set x2 = GetLocationX(udg_point)
set y2 = GetLocationY(udg_point)
call RemoveLocation(udg_point)
call jumpdamage(u1,x1,y1,x2,y2)
set u1 = null
endfunction
//=================================================
public function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerAddAction(t, function Actions)
endfunction
endscope
merci tout le monde mais j'ai un petit problème avec ton hyper-espace !
enfaite quand je met ca dans mon declencheur, ça marche pas sa me fait une erreur ( ligne 21 attend un nom de variable et puis sa me surligne cette ligne set gg_trg_hyperespace = CreateTrigger( ) )
donc voila jai vraiment besoin de ce code pour ma carte et j'ai vraiment besoin d'aide svp aidez moi !
sinon apres ce probleme je rique d'en avoir dautres .?
Si oui que dois-je creer variables, region, unité, sort ?
library_once TimerUtils
//*********************************************************************
//* TimerUtils (Blue flavor)
//* ----------
//*
//* To implement it , create a custom text trigger called TimerUtils
//* and paste the contents of this script there.
//*
//* To copy from a map to another, copy the trigger holding this
//* library to your map.
//*
//* (requires vJass) More scripts: htt://www.wc3campaigns.net
//*
//* For your timer needs:
//* * Attaching
//* * Recycling (with double-free protection)
//*
//* set t=NewTimer() : Get a timer (alternative to CreateTimer)
//* ReleaseTimer(t) : Relese a timer (alt to DestroyTimer)
//* SetTimerData(t,2) : Attach value 2 to timer
//* GetTimerData(t) : Get the timer's value.
//* You can assume a timer's value is 0
//* after NewTimer.
//*
//* Blue Flavor: Slower than the red flavor, it got a 408000 handle id
//* limit, which means that if more than 408000 handle ids
//* are used in your map, TimerUtils might fail, this
//* value is quite big and it is much bigger than the
//* timer limit in Red flavor.
//*
//********************************************************************
//================================================================
globals
private constant integer MAX_HANDLE_ID_COUNT = 408000
// values lower than 8191: very fast, but very unsafe.
// values bigger than 8191: not that fast, the bigger the number is the slower the function gets
// Most maps don't really need a value bigger than 50000 here, but if you are unsure, leave it
// as the rather inflated value of 408000
endglobals
//=================================================================================================
private function H2I takes handle h returns integer
return h
return 0
endfunction
//It is dependent on jasshelper's recent inlining optimization in order to perform correctly.
function SetTimerData takes timer t, integer value returns nothing
debug if(H2I(t)-MIN_HANDLE_ID>=MAX_HANDLE_ID_COUNT) then
debug call BJDebugMsg("SetTimerData: Handle id too big, increase the max handle id count or use gamecache instead")
debug endif
set data[H2I(t)-MIN_HANDLE_ID]=value
endfunction
function GetTimerData takes timer t returns integer
debug if(H2I(t)-MIN_HANDLE_ID>=MAX_HANDLE_ID_COUNT) then
debug call BJDebugMsg("GetTimerData: Handle id too big, increase the max handle id count or use gamecache instead")
debug endif
return data[H2I(t)-MIN_HANDLE_ID]
endfunction
//==========================================================================================
globals
private timer array tT
private integer tN = 0
private constant integer HELD=0x28829022
//use a totally random number here, the more improbable someone uses it, the better.
endglobals
//==========================================================================================
function NewTimer takes nothing returns timer
if (tN==0) then
set tT[0]=CreateTimer()
else
set tN=tN-1
endif
call SetTimerData(tT[tN],0)
return tT[tN]
endfunction
//==========================================================================================
function ReleaseTimer takes timer t returns nothing
if(t==null) then
debug call BJDebugMsg("Warning: attempt to release a null timer")
return
endif
if (tN==8191) then
debug call BJDebugMsg("Warning: Timer stack is full, destroying timer!!")
//stack is full, the map already has much more troubles than the chance of bug
call DestroyTimer(t)
else
call PauseTimer(t)
if(GetTimerData(t)==HELD) then
debug call BJDebugMsg("Warning: ReleaseTimer: Double free!")
return
endif
call SetTimerData(t,HELD)
set tT[tN]=t
set tN=tN+1
endif
endfunction
Inscrit le: 23 Aoû 2007 Messages: 7143 Sujets: 147 Spécialité en worldedit: le troll, le flood, la vulgarité, mon coeur balance Médailles: 2 (En savoir plus...)
Posté le: 09/05/09 22:07 Sujet du message:
Et aussi utiliser un son dans l'éditeur, mais il faut qu'Apocalypse précise lequel, s'il ne s'agit pas d'un son importé.
Il faut aussi remplacer l'entier 'A01N' par celui de ta compétence bidon qui servira à lancer le déclencheur, idéalement une compétence basée sur "canaliser".
Sinon je pense pas que cela soit une bonne idée d'utiliser quelque chose que tu ne comprends pas, plutôt qu'essayer de le faire toi même et éventuellement te faire aider, mais c'est toi qui voit. _________________
Dernière édition par Troll-Brain le 09/05/09 22:10; édité 3 fois
Déjà fais... j'y comprends absolument rien XD
Ça doit venir du fait que je suis nul en anglais :p
Sinon le progame JASS new gen pack... ça sert à quoi? _________________
library_once TimerUtils
//*********************************************************************
//* TimerUtils (Blue flavor)
//* ----------
//*
//* To implement it , create a custom text trigger called TimerUtils
//* and paste the contents of this script there.
//*
//* To copy from a map to another, copy the trigger holding this
//* library to your map.
//*
//* (requires vJass) More scripts: htt://www.wc3campaigns.net
//*
//* For your timer needs:
//* * Attaching
//* * Recycling (with double-free protection)
//*
//* set t=NewTimer() : Get a timer (alternative to CreateTimer)
//* ReleaseTimer(t) : Relese a timer (alt to DestroyTimer)
//* SetTimerData(t,2) : Attach value 2 to timer
//* GetTimerData(t) : Get the timer's value.
//* You can assume a timer's value is 0
//* after NewTimer.
//*
//* Blue Flavor: Slower than the red flavor, it got a 408000 handle id
//* limit, which means that if more than 408000 handle ids
//* are used in your map, TimerUtils might fail, this
//* value is quite big and it is much bigger than the
//* timer limit in Red flavor.
//*
//********************************************************************
//================================================================
globals
private constant integer MAX_HANDLE_ID_COUNT = 408000
// values lower than 8191: very fast, but very unsafe.
// values bigger than 8191: not that fast, the bigger the number is the slower the function gets
// Most maps don't really need a value bigger than 50000 here, but if you are unsure, leave it
// as the rather inflated value of 408000
endglobals
//=================================================================================================
private function H2I takes handle h returns integer
return h
return 0
endfunction
//It is dependent on jasshelper's recent inlining optimization in order to perform correctly.
function SetTimerData takes timer t, integer value returns nothing
debug if(H2I(t)-MIN_HANDLE_ID>=MAX_HANDLE_ID_COUNT) then
debug call BJDebugMsg("SetTimerData: Handle id too big, increase the max handle id count or use gamecache instead")
debug endif
set data[H2I(t)-MIN_HANDLE_ID]=value
endfunction
function GetTimerData takes timer t returns integer
debug if(H2I(t)-MIN_HANDLE_ID>=MAX_HANDLE_ID_COUNT) then
debug call BJDebugMsg("GetTimerData: Handle id too big, increase the max handle id count or use gamecache instead")
debug endif
return data[H2I(t)-MIN_HANDLE_ID]
endfunction
//==========================================================================================
globals
private timer array tT
private integer tN = 0
private constant integer HELD=0x28829022
//use a totally random number here, the more improbable someone uses it, the better.
endglobals
//==========================================================================================
function NewTimer takes nothing returns timer
if (tN==0) then
set tT[0]=CreateTimer()
else
set tN=tN-1
endif
call SetTimerData(tT[tN],0)
return tT[tN]
endfunction
//==========================================================================================
function ReleaseTimer takes timer t returns nothing
if(t==null) then
debug call BJDebugMsg("Warning: attempt to release a null timer")
return
endif
if (tN==8191) then
debug call BJDebugMsg("Warning: Timer stack is full, destroying timer!!")
//stack is full, the map already has much more troubles than the chance of bug
call DestroyTimer(t)
else
call PauseTimer(t)
if(GetTimerData(t)==HELD) then
debug call BJDebugMsg("Warning: ReleaseTimer: Double free!")
return
endif
call SetTimerData(t,HELD)
set tT[tN]=t
set tN=tN+1
endif
endfunction
endlibrary
Ça me donne 49 erreurs... c'est des unités à rajouté etc, ect? _________________
Toutes les heures sont au format GMT + 1 Heure Aller à la page 1, 2Suivante
Page 1 sur 2
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