| 04-18-2004, 06:03 AM | #1 |
Hey, u guys closed my last thread cause it said n****r. srry, but thats what the maps about. anyway, could some1 plz help me out with a trigger that does the following: if unit enters region 000, then if owner of unit is not equal player 10, then kill entering unit. thnx alot, and srry if i offended some1. but it just makes me mad sorta cause for ex. in school, blacks can call other blacks n****rs in front of administrators without getting in trouble, but if i said that i would get in big trouble. thats bull and is racist since they allow 1 groug of people 2 say it and another group cant. and im not racist aginst every1, only people who rob and kill and commit crimes! |
| 04-18-2004, 08:09 AM | #2 |
eh...but ....why are you comming with this here into the Jass forum....This is so horribly easily doable in GUI, that it hurts to write the code in jass for it.... If these are your trigger-problems, you should consider asking the people in the Triggering Haven first about your problem. KillUnit Events Unit - A unit enters Zone 1 <gen> Conditions (Owner of (Entering unit)) Not equal to (!=) Player 10 (Light Blue) Actions Unit - Kill (Entering unit) Cubasis |
| 04-18-2004, 07:31 PM | #3 |
i need 2 use jass cause i have to do this for 900 regions and it will be faster. |
| 04-19-2004, 01:32 AM | #4 | |
Quote:
i hb md tg 4 u ^_^ Code:
function Trig_keU_Conditions takes nothing returns boolean
if ( not ( GetOwningPlayer(GetEnteringUnit()) != Player(9) ) ) then
return false
endif
return true
endfunction
function Trig_keU_Actions takes nothing returns nothing
call KillUnit( GetEnteringUnit() )
endfunction
//===========================================================================
function InitTrig_keU takes nothing returns nothing
set gg_trg_keU = CreateTrigger( )
call TriggerRegisterEnterRectSimple( gg_trg_keU, gg_rct_Region_000 )
call TriggerAddCondition( gg_trg_keU, Condition( function Trig_keU_Conditions ) )
call TriggerAddAction( gg_trg_keU, function Trig_keU_Actions )
endfunction |
| 04-19-2004, 04:41 AM | #5 |
THANK YOU SO MUCH! it works great... but for future refrence, y does it have to b not eqal to player 9 when it is really player 10? also, if you give me ur bnet screen name and relam, i will put ur name on my map! thanks a bunch! |
| 04-19-2004, 04:46 AM | #6 |
Its simple. You are going to have to define those rects somewhere, so why not just do this. Now a region is something totally different than a rect. What you are going to have to do is run a function similar to this at map init. Create a global region variable named death Code:
function RunMeAtInit takes nothing returns nothing
call RegionAddRect(udg_death,gg_rct_Region_000)
call RegionAddRect(udg_death,gg_rct_Region_001)
call RegionAddRect(udg_death,gg_rct_Region_002)
call RegionAddRect(udg_death,gg_rct_Region_003)
call RegionAddRect(udg_death,gg_rct_Region_004)
endfunctionYou will have to keep doing that until all of your game generated rects (rects you physically place on the map) are put into the region death. Now here is the simple trigger to handle all of those regions. Code:
function UnitFilter takes nothing returns boolean
if (GetOwningPlayer(GetFilterUnit()) != Player(9)) then
return true
endif
return false
endfunction
function ActionFunc takes nothing returns nothing
call KillUnit(GetEnteringUnit())
endfunction
//======================================================
function InitTrig_Kill takes nothing returns nothing
set gg_trg_Kill = CreateTrigger()
call TriggerRegisterEnterRegion(gg_trg_Kill,udg_death,Filter(function UnitFilter))
call TriggerAddAction(gg_trg_Kill,function ActionFunc)
endfunction |
| 04-19-2004, 04:47 AM | #7 | |
Quote:
you do mean me right...? or the other person who posted? :( :( :( |
| 04-19-2004, 10:29 AM | #8 |
Ninja, The function "Player(integer)" takes a 0-based integer, and returns a player. Meaning: Player(0) = Player 1, Player(1) = Player 2, Player(11) = Player 12, Player(13) = Neautral Hostile (I think). Cubasis |
| 04-19-2004, 02:09 PM | #9 |
Ninja, you will save yourself many useless triggers if you make the region the way I showed you. Peon's way would have you create a trigger for each rect, wheras mine has you do all rects in 1 trigger and a function. It will save lag time also. |
| 04-19-2004, 02:25 PM | #10 |
Oh and don't forget that you need to use UMSWE to be able to create a global Region variable (a real one) Cubasis |
| 04-19-2004, 04:39 PM | #11 | |
Quote:
O M G its not "myway" I DID WHAT HE ASKED ME TO DO .. dont blame me ^_^ |
