Doom Angel's Question Thread

Chocobo

White-Flower
Reaction score
409

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
"Channel", as well as "Spell Book" and "Charge Gold and Lumber", come with a special option, "Data - Order ID", which can be used to actually change the order it uses.

Which makes it rather easy to avoid any conflicts.

Now, if, for example, you have some unit with "Heal", and add a version of Channel where you set the order to "heal" too... there's a problem.

Well, there's plenty of orders to choose from.


Note: Changing "text - order string" does nothing. It doesn't do anything on Channel either.
It's no problem to have several channels on the same unit with all the same text - order string.
Provided, of course, that all "Data - Order ID"s are unique.
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
k thx for the explanation guys +Rep :)

and i still have my other question:
Though it should be rather easy to keep a list of spells the unit learns or gets from buying or so.
so from what i understand u meant to detect when u unit learns a skill and add it to variable but yet i tried it and i can't since i don't have any option to do something like:
Code:
Set Ability = (Learned Ability)
anyway to add the learned ability to a variable?
any answer?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
Code:
Events
    Unit - A unit Learns a skill
Conditions
Actions
    Custom script:   set udg_Ability = GetLearnedSkill()
    Game - Display to (All players) the text: (Name of Ability)
 
Z

Zell

Guest
Note: Changing "text - order string" does nothing. It doesn't do anything on Channel either.
It's no problem to have several channels on the same unit with all the same text - order string.
Provided, of course, that all "Data - Order ID"s are unique.
The order string can be used as sort of a classification of the spell, as with items. Let's say you gave the order string "heal" to all of your spells that heal or give a positive buff. You can then use "Conversion - Convert Order to String" to obtain the order string and do actions accordingly. This could be used for some sort of 'Divine Favour' effect from Guild Wars. But again, order string will never, ever cause a conflict if a unit has multiple spells of the same string. Only the ID is important.
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
hmm Zell there's another way for conflict with order string and that's when using issued order by trigger so if both are with same order string only one of them would run.....
____________________________

k Ace i made something and im pretty sure it's k:
Code:
Untitled Trigger 001
    Events
        Unit - A unit Learns a skill
    Conditions
    Actions
        For each (Integer A) from 1 to 5000, do (Actions)
            Loop - Actions
                Custom script:   if (udg_Ability[GetForLoopIndexA()] == null) then
                Custom script:   set udg_Ability[GetForLoopIndexA()] = GetLearnedSkill()
                Custom script:   endif
is there anyway for me to detect as well other spells?
like spell from spell book or any other way that adds skills by not learning? (not including trigger actions)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> any other way that adds skills by not learning? (not including trigger actions)

What way would that be?

As for the Spell Book, well, you know what spells are inside...
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
well k thx
just one question:
Code:
Untitled Trigger 001
    Events
        Unit - A unit Learns a skill
    Conditions
    Actions
        For each (Integer A) from 1 to 5000, do (Actions)
            Loop - Actions
                Custom script:   if (udg_Ability[GetForLoopIndexA()] == null) then
                Custom script:   set udg_Ability[GetForLoopIndexA()] = GetLearnedSkill()
                Skip Remaining Actions
                Custom script:   endif
i don't want every ability to be set so i need to stop it somehow when the "if" is true so my question is if i make 'Skip Remaining Actions' inside Integer A loop would it still skip the remaining loops as well?
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
k here's a new question:

is it possible to detect which abilitys a certain unit has?
(checking it 1 by 1 won't help i can't start checking every skill)

i don't mind either JASS or GUI solution.

+Rep Guaranteed :D

This is going to be long and painful to code, but it's doable...
It will use the idea of binary coding...

Make an ability array and set all abilities (save for dummy-only abilities) that a unit in your map COULD have to it in this order.

Ability[1] = A
Ability[2] = B
Ability[4] = C
Ability[8] = D
Ability[16] = E

The number you seek is always (sum_of_all_previous_numbers + 1)


Then set the Point value of a unit to the sum of the unit's ability handlers.
Example: My unit has Ability A, D and E -> Point value of unit = 1+8+16 = 25

Whenever a unit loses/gains a skill you substract/add that skills value to the point value of the unit.

Now comes the hard part:
To list the abilities of a unit, you must convert it's point value back into a series of numbers, which you then list.

Example:
For each Integer A: 1 -> "amount of ability codes you got from breaking point value down into bits"
Do - Action - Set tempInteger = BitsYouGotFromBreakingDownPointValueArray[Integer A]
Do - Action - Show Message ("I have the ability: " + ConvertToString(Ability name of AllAbilities[tempInteger]))


I forgot the most efficient way to break down a binary-ish number into the bits, but it's out there on Google ;)


2 problems:
Many abilities = Point values like 1.244.224.353.535 could occur, and I don't know the WE limit for it.
Setting the point values in WE for each unit may be time-absorbing, but only needs to be done once though.


EDIT: If point values have a limit, you could create 2 more arrays:

UnitType_AllUnitsThatCOULDBeInMyMap[1] = Unit Type 1
UnitType_AllUnitsThatCOULDBeInMyMap[2] = Unit Type 2
etc

Integer_ValueForUnitType[1] = "number that would be the point value for this unit type"
Integer_ValueForUnitType[2] = "number that would be the point value for this unit type"
etc.
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
thx but i already found a solution for the ability thing (as u see see at posts above)
and also i was speaking about abilitys which are i dunno about them not abilitys i do know about....

so i only need to know is if skip remaining actions also work for loops (skip remaining loops as well)
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
thx but i already found a solution for the ability thing (as u see see at posts above)
and also i was speaking about abilitys which are i dunno about them not abilitys i do know about....

so i only need to know is if skip remaining actions also work for loops (skip remaining loops as well)

Just set LoopIntegerA to MaxAmountOfLoops and it will end the loop.

Code:
Untitled Trigger 001
    Events
        Unit - A unit Learns a skill
    Conditions
    Actions
        For each (Integer A) from 1 to 5000, do (Actions)
            Loop - Actions
                Custom script:   if (udg_Ability[GetForLoopIndexA()] == null) then
                Custom script:   set udg_Ability[GetForLoopIndexA()] = GetLearnedSkill()
                Set Integer A = 5000
                Custom script:   endif
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
just so u know u can't just do:
Code:
Set Integer A = 5000
u need to use custom script:
Code:
Custom script:  set GetForLoopIndexA() = 5000
and i already thought of it be4 and i planned to use it in case of the skip is not possible, not that i realy need it but i wanna know if it's possible (i have this question bugging me long time)
so anyway any1 answer this little question? :)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> set GetForLoopIndexA() = 5000

???

You can't assign a value to a function call...


set bj_forLoopAIndex = 10000

or, even simpler:
exitwhen true
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
set bj_forLoopAIndex = 10000
k thx for for letting me know.
exitwhen true
when the if\then\else is true?
i don't want every ability to be set so i need to stop it somehow when the "if" is true so my question is if i make 'Skip Remaining Actions' inside Integer A loop would it still skip the remaining loops as well?
i still got this question (i know i have other ways but i wanna know :p)
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
k thx for for letting me know.

when the if\then\else is true?

i still got this question (i know i have other ways but i wanna know :p)

Code:
E - 5.00 seconds in game
C - none
A - For each Integer A from 1 to 10
   L
       A - Show message "Loop nr." + Integer A + "is being run"
       A - If Integer A = 5, then Skip Remaining Actions, else Do Nothing

If this shows 5 lines of text, it works; if it shows 10, it doesn't.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> when the if\then\else is true?

...


Code:
loop
    ...some actions, or maybe no actions at all, as you need it
    exitwhen <condition>
    ...some actions, or maybe no actions at all, as you need it
endloop

"exitwhen" evaluates its condition.
If the result is "true", it breaks out of whatever loop it is in.

"exitwhen true" ends loops instantly.
The condition, "true", is always true...


"Skip remaining" instantly returns from whatever function it is in.

With the trigger from post #137 for example, the trigger would end with the skip action.
(Assuming an integer can be set to null...)


1.
For each integer A from 1 to 10
- Skip remaining actions
Game - Display to (All players) the text: "You will never see this"

2.
For each integer A from 1 to 10
- Custom script: exitwhen true
Game - Display to (All players) the text: "This text will show"
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
2.
For each integer A from 1 to 10
- Custom script: exitwhen true
Game - Display to (All players) the text: "This text will show"
so exitwhen true would skip only the next loop right?

the trigger would end with the skip action.
k thx
only 1 more issue:
if i skip the loop can i continue the actions beyond the loop?
i mean as skiping only the loops of integer A and continue with actions outside the loop
(im pretty sure not but i gotta ask it)
 
I

IKilledKEnny

Guest
if i skip the loop can i continue the actions beyond the loop?


Most certainly. When setting exitwhen = true you exit the loop, however, the rest of the trigger remains unchanged becuase you did not do anything but making the loop's exit condition to true.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top