| 05-31-2006, 06:08 PM | #1 |
Hi all pls Help me please, I n help for trigger"How I meet in the trigger, then one player there isn't in game else remove a unit (there is nt a unitin map terrain but only I create the unit)??? Thx |
| 05-31-2006, 06:19 PM | #2 |
Let me translate. Hi everyone, please help me. I need help on a trigger to do this: "If one player isn't in the game do something, else remove a unit (Assuming I created the unit)?" Thanks! ________________________________________________ Well, Bomber! If my translation was correct, then I can indeed help you! JASS://"If one player isn't in the game do something, else remove a unit (Assuming I created the unit)?" function MyFunc takes nothing returns nothing local unit createdUnit = CreateUnit(whichPlayer, whichUnitType, whereX, whereY, whatFacing) if GetPlayerSlotState(whichPlayer) == PLAYER_SLOT_STATE_PLAYING then //Do some stuff else call RemoveUnit(createdUnit) endif endfunction I tossed in a bunch of undeclared variables, I know. They were there to keep with syntax and just show you what you'd need to do. You would have to fill in whatever values for those vars based on what you want to happen. |
| 05-31-2006, 06:30 PM | #3 |
can you attac the image in this thread please I do hard know ^^ ? Image please |
| 05-31-2006, 06:34 PM | #4 |
The image? What image? I just posted in jass tags a rough outline for what you should do (Assuming I understood what you were asking). |
| 05-31-2006, 06:41 PM | #5 |
It s hard O_O waooo ![]() |
| 05-31-2006, 06:47 PM | #6 |
Do you work in GUI or jass? (I would imagine probably GUI) If you work in gui I could rewrite that to make a little more sense for you. |
| 05-31-2006, 06:52 PM | #7 |
aaaaaaaaaaa ok I searched the jass convert I now I write your text my compare is this : function Myfunc takes nothing returns nothing endfunction JASS://=========================================================================== function InitTrig_P1_Copia takes nothing returns nothing set gg_trg_P1_Copia = CreateTrigger( ) call TriggerAddAction( gg_trg_P1_Copia, function Trig_P1_Copia_Actions ) endfunction Edited by Blade.dk. Reason: Please use jass tags when posting jass code. |
| 05-31-2006, 06:56 PM | #8 |
Here is a good place to start learning how to work in jass. |
| 05-31-2006, 08:57 PM | #9 | |
Quote:
I think there is an easier way the requires only one action in GUI Trigger: ![]() Event -
![]() Map initialization
![]() Condition- N/A
![]() Action-
![]() Player group - Select all players and do ( if player slot status is equal to is playing then ((If player is user) then do nothing/ else pick every unit in playable map area and remove triggering player(if I remember correctly i'm at work at the moment) from game)) / else do nothing.
![]()
![]() Trigger - Turn off this triggerEDIT: it took a few hours to come up with the working version that I needed in my game to reduce the amount of lag in the map. This will save you literally hours of work with JASS |
| 05-31-2006, 11:02 PM | #10 |
That long line of GUI is the reason I prefer Jass. :P |
| 06-01-2006, 02:24 AM | #11 |
well its one action that replaces 4 lines of jass. You can reduce it to not unclude the player is user thing but I felt that narrows it down to the specified units. |
| 06-01-2006, 03:34 AM | #12 |
Well... Take that line and convert it to jass. Tell me how long it is. :P |
| 06-01-2006, 11:55 AM | #13 |
ums In player group I don t search Select all players and do ( if player slot status is equal to is playing then ((If player is user) then do nothing/ else pick every unit in playable map area and remove triggering player(if I remember correctly i'm at work at the moment) from game)) / else do nothing. it hard this I prefer JASS ^^ but it hard I read |
| 06-01-2006, 12:41 PM | #14 |
Use variables: player p - the player the unit si created for if he is playing integer id - the id/rawcode of the unit you want to create for the player real x,y - the coordinates where the unit will be created JASS:function CreateUnitForPlayerIfIsPlaying takes player p,iteger id,real x,real y,real face returns unit //The last lines tell you what info the function needs and what it returns if GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING then //check if the player isate is the right one set bj_lastCreatedUnit=CreateUnit(p,id,x,y,face) //the creation of the unit return bj_lastCreatedUnit //Here you can refer to via GetLastCreatedUnitBJ() //returnning a value, but only if the condition is fullfilled, and skipping all reamaining actions(similar to GUI) endif set bj_lastCreatedUnit=null returns null endfunction You just must check if the last Created unit is not null. You can refer to GUI via this trigger: Trigger: CustomScript:call CreateUnitForPlayerIfIsPlaying(udg_someplayer,...) |
| 06-01-2006, 01:15 PM | #15 |
Soulprovider, not only does your trigger leak, it also doesn't work. User refers to if the slot is set as a user in the player properties - so if no player is there, it will still be a user. Trigger: ![]() Events:
![]() Whatever
![]() Conditions:
![]() Whatever
![]() Actions:
![]() For each integer A from 1 to 12
![]() Loop
![]() If:
![]() Player(integer A) Is playing is equal to false
![]() Then:
![]() Set TempGroup = Units owned by Player(integer A)
![]() Unit group - Pick every unit in TempGroup and remove (picked unit)
![]() Custom Script: call DestroyGroup(udg_TempGroup)
![]() Else: |
