HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

help with this trigger

04-27-2003, 04:32 PM#1
SkylineGT[FB]
i got help on how to do this trigger and the guy(Marsara) told me how to do it. but i really dont understand how it works. so could some one help me? heres the triggers.
here is the thread

Originally posted by MarSara
Well first you are have to create an array of Unit-Groups, call it Creeps for now, and create an integer and call it Level for now (Level will only be used in 1 trigger). Next, at 1 second elapsed time set Creeps[1] to contain all the creeps that are of level 1, set Creeps[2] to all the creeps that are of level 2, and so on. Then create this trigger:

Code:
code:
Events:
    - Player X types a chat message containing " " as a SubString
Condtions:
    - Substring( (EnteredChatString), 1, 6) == "level "
    - Substring( (EnteredChatString), 10,15) == " creep"
    * The numbers here may be off by 1 or 2.
Actions:
    - set Level = ConvertStringToInteger( SubString( (EnteredChatString), 7, 9) )]

    - if( Level < 1 OR Level > 10 ) then
        - Skip Remaining Actions

    - Create 1, UnitTypeOf( RandomUnitFromUnitGroup( Creep[Level], PlayerX, <Region>, Default Building Facing Degrees)
Oh, sorry... and forgot to mention you will have to create an area that has all the creeps types in it, dividing that into 10 regions, each region containing all the creeps of each level, (you can HIDE and PAUSE these creeps if you need to). If you dont have the space on your map for these units there is another way to do it, but harder (requires more variables).
Code:
code:
Events:
    - Elapsed Time is 1 second
Condtions:
    - None -
Actions:
    - PickEveryUnitInRegion(CreepRegionLevel1 AndDo AddPickedUnitTo Creep[1])
    - PickEveryUnitInRegion(CreepRegionLevel2 AndDo AddPickedUnitTo Creep[2])
    - PickEveryUnitInRegion(CreepRegionLevel3 AndDo AddPickedUnitTo Creep[3])

    (continue on for levels 4 - 10)
04-27-2003, 04:38 PM#2
SektorGaza
its pretty simple trigger.. which part you don't understand?
04-27-2003, 04:45 PM#3
SkylineGT[FB]
the first one.
04-27-2003, 04:49 PM#4
DaKaN
the top code takes any entered chat string and breaks it up into seperate parts using substring, and if the 2 parts that are broken up are = to certin words, then perform an action

Take this for example:

Create 1 Gnoll Player 5

use substrings to check the systax of the sentence:

Substring(GetEnteredChatString, 1,6) == Create
char's 1 though 6 must spell Create (case sensitive)

set howmany = Substring(GetEnteredChatString, 8,8)
would set the interger varible = to 1 since the digit 1 is in the char spot 8

and so on
04-27-2003, 04:52 PM#5
SkylineGT[FB]
what does the conditon on the first one do. witht he 1, 6?
04-27-2003, 04:56 PM#6
SektorGaza
in the first one you have to create a integer variable named "Level"

then the trigger goes like this

event
player enters chat <empty string> as a substring

condition
substring(entered chat string)1,6) = "level " (its 6 characters long)
substring(entered chat string)9,15)=" creep" (that goes after the number you enter

so for example you can enter "level 10 creep"
the condition will check if those words "level" and "creep" exist in your entry.

action
set Level(the created variable) = convert string to integer(substring(enteredchatstring)7,8))

-that sets the variable Level some number that player entered

then he checks so that number is not less than 1 or larger than 10

then he creates the random creep of the level that player entered


thats all for the first trigger.

and the second trigger is initialization trigger.
he creates another variable of array unit group I think named "creep"

and he does

event
game time elapsed 1 second.

action

he takes all the units in regions made by you and he puts them in creep array one by one.


I dont know whats that for... but anyway that's it i guess
04-27-2003, 05:03 PM#7
SkylineGT[FB]
i think that this is the trigger that i cant do right:
if( Level < 1 OR Level > 10 ) then
- Skip Remaining Actions

how do i do this one? its the second action in the first trigger.
BTW, when u guys did the (7, 8 ) it came out as a smiley8)

another trigger that i need help on is this: ok, there is 8 hero units in a region. one belonging to each player 1-8. there is 4 rings with 2 regions in each. then there is a trigger that randomly selects a unit and puts that unit in a region. so now the 8 heros r randomly moved to a region in one of the rings. but now this is were i need help. how do i move the camra view for player one to his hero, and player 2 camra to his hero and all the way up to 8?
04-27-2003, 05:16 PM#8
SektorGaza
lololol oops

ok

how to do that action.... its easy


if

click condition

click OR

then you have to do integer comparison

if level less than 0

then go to the other one

if level greater than 10

then press ok ok, then where it say do action there you select skip all remaining actions.

else do nothing
04-27-2003, 07:21 PM#9
SkylineGT[FB]
the trigger doesnt seem to be working. unless im not typing the message right(i think that i am), sumthing is wrong. here is a screen of my trigger:
04-27-2003, 07:54 PM#10
SektorGaza
here


oh yeah and dont forget there is a space there

"level "

and

" creep"

you dig?
04-27-2003, 08:03 PM#11
DaKaN
cant tell, but unles you have a space in the condition after the workd "level" that will never be true because "level" is not = to the substring of the entered chat string of 1-6 "level " would be either add a space to the conditon after the word, or change the substring to 1,5
04-27-2003, 08:20 PM#12
SektorGaza
there is a space aftter level
and a space before creep
04-27-2003, 11:56 PM#13
SkylineGT[FB]
ooohhh, when u guys were doing the trigger above, i thought that u accedntily made those spaces. dam, alright, thx.

[edit] it still doesnt work. i typed level 1 creep but it didnt do anyting.
04-28-2003, 12:50 AM#14
DaKaN
it woudlnt do anything with the above attachment you posted because 10-15 in "level 1 creep" doesnt spell creep

the word creep is in spots 9 to 14
04-28-2003, 12:57 AM#15
SkylineGT[FB]
so i have to change the 2nd conditon to 9, 13?