| 11-03-2007, 06:16 PM | #1 |
What is wrong here? JASS:scope ForbidAllyAttack private function Conditions takes nothing returns boolean local player attacker = GetOwningPlayer(GetAttacker()) if IsUnitAlly(GetTriggerUnit(), attacker) then call IssueImmediateOrderById(GetAttacker(), OID_stop) call SimError(attacker, "attacking allies is forbidden!") endif return false endfunction //=========================================================================== public function InitTrig takes nothing returns nothing local trigger trig = CreateTrigger() call TriggerRegisterAnyUnitEventBJ( trig, EVENT_PLAYER_UNIT_ATTACKED ) call TriggerAddCondition( trig, Condition( function Conditions ) ) endfunction endscope |
| 11-03-2007, 06:20 PM | #2 |
is there something wrong? all i see is tat the inittrig wont work well cus of the public suffix.. or prefix? |
| 11-03-2007, 06:25 PM | #3 |
IsUnitAlly may be somewhat iffy. |
| 11-03-2007, 06:46 PM | #4 |
I take it you get to see the SimError message? In that case you need to stop the unit after a 0 seconds timer... |
| 11-03-2007, 06:53 PM | #5 | |
Quote:
No actually MaD[Lion] it works, it is one of the features of jasshelper. (prefix) @Griffen iffy? why? @Vex no I want to see the message, that is fine. Well I guess I was simply paranoid. |
| 11-03-2007, 07:45 PM | #6 |
I believe it is better to order the unit to move to its current position as the stop order was reported to be slower than the move order (units with fast attack speeds could hit allies). |
| 11-03-2007, 08:52 PM | #7 |
I just tested that claim about the move order and it turned out to be false, ordering unit to stop is faster. |
| 11-03-2007, 09:07 PM | #8 |
Perhaps you want not IsUnitEnemy() ? have an else clause to verify the condition is actually called. |
| 11-04-2007, 12:42 AM | #9 | |
Quote:
|
