HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

New Spell: Fear needs help

05-20-2003, 09:35 PM#1
ShadowElf2002
Im attempting to think up how using trigger actions I can FORCE the player controled unit to run, I cant simply issue an order.. or they could press stop and continue like they were. Is there some way to remove control of the unit briefly?
05-20-2003, 11:18 PM#2
ChronOmega
you can just changeowner ship to nutral passive, temporarily
05-21-2003, 12:19 AM#3
ShadowElf2002
Ok here's the only problem I have with that... it will work fine IF, there is a way to remember what player the unit was controlled by originally so that I can restore it, keep in minde this spell affects every enemy in the area, so I may need to keep track of multiple ones.
05-21-2003, 12:48 AM#4
Earth-Fury
it involves 2 arrays, that will dynamicly grow and set and restore tyhe units. verry complex. ide rather just forget about hta spell.
05-21-2003, 12:55 AM#5
ShadowElf2002
I didnt ask if you wanted me to forget abou tthe spell Earth-Fury... I asked how to do it, now if you didnt want to tell me, you could have not posted but dont post that you know but your not telling thats just rude.
05-21-2003, 12:56 AM#6
Guest
Its not complex....
05-21-2003, 01:03 AM#7
Earth-Fury
lol, it may not even be possible.
05-21-2003, 01:13 AM#8
ChronOmega
use local variables in custom text (im not gonna explain how to do that here go look around the forum)

maybe this will work, maybe it wont, who knows now me

ne ways good luck :D
05-21-2003, 01:22 AM#9
mikedogdude
Select all the units in the area of effect, and set them to a unit group, then make a trigger that every second, half second, whatever, orders that unit group to run wherever you want them to (random direction, x distance in that direction?), then when the effect wears off just set the unit group to no unit
05-21-2003, 01:46 AM#10
ShadowElf2002
mikedogdude, the problem with your idea is that it can be countered by clicking quickly in thh opposite direction, which effectively means that the spell would do nothing, so I need some way to limit the control of the unit so that they cannot simply hit their target real fast so that my order is counteracted...
05-21-2003, 12:52 PM#11
Dead-Inside
Hmm.. I have no idea how to store unit control. EF, if you don't know, shut up. And I am 99% sure it is POSSIBLE, but ... Umm.. Okay?

SpectreReturns:
Its not complex....
Would you like to elaborate?
05-22-2003, 01:49 AM#12
ShadowElf2002
So no one who knows is telling, and everyone else who thinks its can be done (like me) doesnt know how... what a lovely world we live in..
05-22-2003, 12:11 PM#13
Guest
function Trig_Run_NotOwnedByCaster takes nothing returns boolean
return ( GetOwningPlayer(GetTriggerUnit()) != GetOwningPlayer(GetFilterUnit()) )
endfunction

function Trig_Run_Actions takes nothing returns nothing
local group Affected //Everything hit
local integer NumAffected //How many hit
local unit array RunningUnit //List of units hit, so they can be matched with respective owners
local player array RunningUnitOwner //The list of those units' owners
local integer i //For loops

call GroupAddGroup( GetUnitsInRangeOfLocMatching(512, GetUnitLoc(GetTriggerUnit()), Condition(function Trig_Run_NotOwnedByCaster)), Affected ) //All affected
set NumAffected = CountUnitsInGroup(Affected) //Used for loops

set i = 1
loop
set RunningUnit[i] = GroupPickRandomUnit(Affected) //Something to reference the unit
call GroupRemoveUnitSimple( RunningUnit[i], Affected ) //So it doesn't get the same unit twice
set RunningUnitOwner[i] = GetOwningPlayer(RunningUnit[i]) //Save this so owner can be switched back
call SetUnitOwner( RunningUnit[i], Player(PLAYER_NEUTRAL_PASSIVE), false ) //So they can't control it
call IssuePointOrderLocBJ( RunningUnit[i], "move", GetRandomLocInRect(GetPlayableMapRect()) ) //Run!
set i = i + 1
exitwhen i == NumAffected
endloop

call TriggerSleepAction( 2 ) //Change this to how long you want it to run

loop
call SetUnitOwner( RunningUnit[i], RunningUnitOwner[i], true ) //Restore original owner
endloop
endfunction

//===========================================================================
function InitTrig_Run takes nothing returns nothing
set gg_trg_Run = CreateTrigger( )
call TriggerAddAction( gg_trg_Run, function Trig_Run_Actions )
endfunction


//===========================================================================
function InitTrig_Run takes nothing returns nothing
set gg_trg_Run = CreateTrigger( )
call TriggerAddAction( gg_trg_Run, function Trig_Run_Actions )
endfunction



Sorry, no time to test or explain. Events and conditions sold separately, but I'll bet you can get those. :gsmile:
05-22-2003, 01:23 PM#14
Vexorian
Sorry But I don't Understand anything about custom text!

Region A = Region with the size of the Aoe

I'll skip Events and conditions
Actions:
Center region "A" on (position of Triggering unit)
N = 0
CastingPlayer = Owner of triggering unit
Pick every Unit in region "A" and do Run Set the Guys (gen)
Timer run timer "Timer" as a ....

Set the Guys (gen)
Condition Owner of Picked unit is enemy of Casting Player
Actions:
N = N + 1
Unit(N) = Picked Unit
Player(N) = Owner of Picked Unit
Change owner of Picked Unit to Neutral PAssive Do not change colors
Order Issue Picked unit an order - Move to ...

Trigger
Events
Timer "Timer" gets to zero (Can't Remember the right event)
Actions
For Each Integer A from 1 to N do Give Unit(Integer A) To Player(Integer A)
05-22-2003, 08:42 PM#15
Guest
Yours will only work if there is only one of those spell triggers going at once. Multiple will overwrite the variables. It may not happen that often, but a lot of units will change hands when two players cast that at about the same time.

I made some mistakes in mine. Here is a tested and working version. Events and conditions are included. Just change the order for the spell on the second line and how long you want them in neatral mode on the wait line.

function Trig_Run_Conditions takes nothing returns boolean
if ( not ( OrderId2StringBJ(GetIssuedOrderIdBJ()) == "roar" ) ) then
return false
endif
return true
endfunction

function Trig_Run_NotOwnedByCaster takes nothing returns boolean
return ( GetOwningPlayer(GetTriggerUnit()) != GetOwningPlayer(GetFilterUnit()) )
endfunction

function Trig_Run_Actions takes nothing returns nothing
local group Affected //Everything hit
local integer NumAffected //How many hit
local unit array RunningUnit //List of units hit, so they can be matched with respective owners
local player array RunningUnitOwner //The list of those units' owners
local integer i //For loops

set Affected = GetUnitsInRangeOfLocMatching(512, GetUnitLoc(GetTriggerUnit()), Condition(function Trig_Run_NotOwnedByCaster))
set NumAffected = CountUnitsInGroup(Affected) //Used for loops

set i = 1
loop
set RunningUnit[i] = GroupPickRandomUnit(Affected) //Something to reference the unit
call GroupRemoveUnitSimple( RunningUnit[i], Affected ) //So it doesn't get the same unit twice
set RunningUnitOwner[i] = GetOwningPlayer(RunningUnit[i]) //Save this so owner can be switched back
call SetUnitOwner( RunningUnit[i], Player(PLAYER_NEUTRAL_PASSIVE), false ) //So they can't control it
call IssuePointOrderLocBJ( RunningUnit[i], "move", GetRandomLocInRect(GetPlayableMapRect()) ) //Run!
exitwhen i == NumAffected
set i = i + 1
endloop

call TriggerSleepAction( 2 ) //Change this to how long you want it to run

set i = 1
loop

call SetUnitOwner( RunningUnit[i], RunningUnitOwner[i], true ) //Restore original owner
exitwhen i == NumAffected
set i = i + 1
endloop
endfunction

//===========================================================================
function InitTrig_Run takes nothing returns nothing
set gg_trg_Run = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Run, Player(0), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Run, Player(1), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Run, Player(2), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Run, Player(3), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Run, Player(4), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Run, Player(5), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Run, Player(6), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Run, Player(7), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Run, Player(8), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Run, Player(9), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Run, Player(10), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Run, Player(11), EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( gg_trg_Run, Condition( function Trig_Run_Conditions ) )
call TriggerAddAction( gg_trg_Run, function Trig_Run_Actions )
endfunction

In the event for player 8, it changed the 8 ) to a 8)... You probably want to change that back after you copy it.