• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Help with custom script please

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
you dont order an ability you order the rawcode (a 4 digit ASCII ability assigned to every object editor data type)
 
Level 11
Joined
Feb 23, 2009
Messages
577
How do I find the 4 digit ASCII through custom script?

And then how to use that rawcode to make the unit cast through custom script? (no target instant abil)

  • Untitled Trigger 001
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Custom script: set udg_Integer_Test = udg_Ability_A
      • Game - Display to (All players) the text: (String(Integer_Test))
  • Untitled Trigger 002
    • Events
      • Player - Player 1 (Red) types a chat message containing a as An exact match
    • Conditions
    • Actions
      • Custom script: call IssueImmediateOrderById(udg_Monster_Battling, udg_Integer_Test)
      • Game - Display to (All players) the text: (String(Integer_Test))

Why doesn't this work??
 
Last edited by a moderator:
Level 21
Joined
Mar 27, 2012
Messages
3,232
GUI has functions for that, no need for custom text.
  • Unit - Issue order targeting a unit
  • Unit - Issue order targeting a point
  • Unit - Issue order with no target
Don't be disappointed that you might not see your ability there, look for the ability that you based it on. Or anything that has the same order string(in object editor)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
First, you have to understand there are 3 types of spell target which are; Instant / Unit / Point.

Next, you have to know, we can use either String-ordered or ID-ordered (Integer).
In this example, I will show you how to order by ID.

This is an example to order unit to cast Point-target spell
Ability Used: Flame Strike

In order to order the unit to cast the spell, you must first know what are the spell ID, to get it, simply use on of these Events (depends on your Spell Target Type);
  • Events
    • Unit - A unit Is issued an order targeting an object
    • Unit - A unit Is issued an order targeting a point
    • Unit - A unit Is issued an order with no target
Since Flame Strike is Point-target spell, we'll go with;
  • Unit - A unit Is issued an order targeting a point
Example;
  • Flame Strike ID
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Custom script: local integer i = GetIssuedOrderId()
      • Custom script: call BJDebugMsg(I2S(i))
From that, I have got a '852488' as the ID of the order, now I can use that to cast Flame Strike;

  • Flame Strike Cast
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set u = Blood Mage 0000 <gen>
      • Custom script: call IssuePointOrderById(udg_u, 852488, 0,0)
To use String-ordered;
  • Flame Strike Cast
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set u = Blood Mage 0000 <gen>
      • Custom script: call IssuePointOrder(udg_u, "flamestrike", 0,0)
 
Level 11
Joined
Feb 23, 2009
Messages
577
Thank you all, but, let me clear up some stuff because those answers are just not helping ;o...

1) I ONLY use the Channel spell (insta cast/no target) so it only needs 1 function.

2) I need to find the ability's ID BEFORE he casts it lol (it's a turn based game and he won't cast anything until ordered, this is just a test trigger). I want it to check the ability ID of an ability variable (between: Ability_1, Ability_2, Ability_3 and Ability_4).

3) I don't mind using the ID or string to order, but I can't find the order until AFTER it's cast so I tried with the ID (Which is why it does not set Integer_Test to triggering ability but simply to Ability_A, my variable, which seems to work as to gathering the ID):
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Wait 0.01 seconds
      • Custom script: set udg_Integer_Test = udg_Ability_A
      • Game - Display to (All players) the text: (String(Integer_Test))
But it doesn't seem to work when I order the unit to cast it through the ID and I don't understand why:
  • Untitled Trigger 002
    • Events
      • Player - Player 1 (Red) types a chat message containing a as An exact match
    • Conditions
    • Actions
      • Custom script: call IssueImmediateOrderById(udg_Monster_1, udg_Integer_Test)
      • Game - Display to (All players) the text: (String(Integer_Test))
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Thank you all, but, let me clear up some stuff because those answers are just not helping ;o...

1) I ONLY use the Channel spell (insta cast/no target) so it only needs 1 function.

2) I need to find the ability's ID BEFORE he casts it lol (it's a turn based game and he won't cast anything until ordered, this is just a test trigger). I want it to check the ability ID of an ability variable (between: Ability_1, Ability_2, Ability_3 and Ability_4).

3) I don't mind using the ID or string to order, but I can't find the order until AFTER it's cast so I tried with the ID (Which is why it does not set Integer_Test to triggering ability but simply to Ability_A, my variable, which seems to work as to gathering the ID):
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Wait 0.01 seconds
      • Custom script: set udg_Integer_Test = udg_Ability_A
      • Game - Display to (All players) the text: (String(Integer_Test))
But it doesn't seem to work when I order the unit to cast it through the ID and I don't understand why:
  • Untitled Trigger 002
    • Events
      • Player - Player 1 (Red) types a chat message containing a as An exact match
    • Conditions
    • Actions
      • Custom script: call IssueImmediateOrderById(udg_Monster_1, udg_Integer_Test)
      • Game - Display to (All players) the text: (String(Integer_Test))

What we meant is that you can use a function that prints the command. That way you will know what order string to use.

If it's based on channel, then just use the same thing that's in"Text - Order String - Use/Turn On". For channel it is "channel".

You can change that to work with different order strings('Human Sorceress - Slow' is 'slow')
 
Level 11
Joined
Feb 23, 2009
Messages
577
I meant that they are all based off channel. But there is a lot of abils with each a different spell ID, which needs to be retrieved in-game and then used as a string or integer (w/e works is good for me) to be plugged in the instant/non target cast order.

(There is a huge pool of abilities that it could cast)
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
I meant that they are all based off channel. But there is a lot of abils with each a different spell ID, which needs to be retrieved in-game and then used as a string or integer (w/e works is good for me) to be plugged in the instant/non target cast order.

(There is a huge pool of abilities that it could cast)

So you would need name-order pairs. Which essentially means making 2 variable arrays. 1 for names and 1 for orders.
You can make the arrays fill automatically or define every value yourself. I don't really see any other way.
In that case the trigger would loop through all possible strings(names) and if it finds one that matches, then it orders the order from another array and the same index.
AbilityName[378] orders AbilityOrder[378]
 
Press Ctrl+D in WE Object Editor and you should see raw data of objects as well as all fields and anything else related to it.

Blizzard use 0-9 A-Z values to code huge integers. Because it's known that bigger base reduce number length.

For example let's write 15 as:

15 -> 10 as base (0-9)
1000 -> 2 as base (0,1)
F -> 16 as base (0-9 A-F)

and so on.

Btw all you need is this:
http://www.thehelper.net/threads/order-ids.148097/
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
-Kobas- said:
Blizzard use 0-9 A-Z values to code huge integers. .
This might be off-topic, but I'd like to correct you here.
Blizzard uses ASCII codes. These do indeed contain 0-9 and A-Z, but also 220 more characters (a-z, brackets, many other symbols).
There's an aptly named site called asciitable where you can see all the characters with their decimal value.

It's a base-256 system. To convert them to decimal, you can use this post as a guide.

Also, "base (0-9)" is oftentimes called "decimal", or "base-10", right? Then isn't 15 just 15 in base-10? (And not 10).
 
Level 11
Joined
Feb 23, 2009
Messages
577
So you would need name-order pairs. Which essentially means making 2 variable arrays. 1 for names and 1 for orders.
You can make the arrays fill automatically or define every value yourself. I don't really see any other way.
In that case the trigger would loop through all possible strings(names) and if it finds one that matches, then it orders the order from another array and the same index.
AbilityName[378] orders AbilityOrder[378]

That is what I feared, I wanted to find a simpler way.


Stop complicating your life and use string orders, there's a reason they exist.

That's just dumb and doesn't help anything, especially not my problem. And I would love to use string orders if they could be found BEFORE cast.



That's actually more complicated and will take more processing time than using pairs (abil = order).



If anyone knows of another way besides a dummy getting the ability, then trying to cast them all until he finds which ability he has through the order (which is "upside down" if u ask me) it would be great!...




All of this put aside, why doesn't this work:?

  • Untitled Trigger 002
    • Events
      • Player - Player 1 (Red) types a chat message containing a as An exact match
    • Conditions
    • Actions
      • Custom script: call IssueImmediateOrderById(udg_Monster_1, udg_Integer_Test)
      • Game - Display to (All players) the text: (String(Integer_Test))
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Stop complicating your life and use string orders, there's a reason they exist.

Read through the problem until you find out what he was asking for.

That is what I feared, I wanted to find a simpler way.




That's just dumb and doesn't help anything, especially not my problem. And I would love to use string orders if they could be found BEFORE cast.




That's actually more complicated and will take more processing time than using pairs (abil = order).



If anyone knows of another way besides a dummy getting the ability, then trying to cast them all until he finds which ability he has through the order (which is "upside down" if u ask me) it would be great!...

You don't even need to try to cast them all, that's bad practice.

You make a loop. It loops through all possible abilities and every time checks if this is the right ability. When it reaches the right one, THEN it shoots actions.

And I'm afraid that there really is no other way than pairs. Although you might be able to make it easier with hashtables(instead of a arrays).
 
Level 11
Joined
Feb 23, 2009
Messages
577
Thanks Xonok,

I'm probably just going to save the possible cast strings into a hashtable for every neutral as they get any ability, probably faster processing than making a loop (though more work).

This is what I'm doing (in case anyone has a better method to do this than what I just said):

Upon Neutral's turn to act, it chooses 1 out of 4 array abilities (Ability_1 -> Ability_4), then casts it. It's a Pokemon game so in case you don't know, there are a TON of abilities.
 
Status
Not open for further replies.
Top