• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Triggered and looped creation of units:

Status
Not open for further replies.
Level 2
Joined
Jul 19, 2009
Messages
8
I am making a game, and have some problems with the trigger editor since its UI is kinda confusing. What I am basically trying to do is create a unit that's a "sniper". I already programmed his attack and skills except now I am planning to give him a "sniper scope".

This skill basically is a toggleable skill that when turned on will give him over 1000 vision only in the direction where he is facing. His normal vision radius is 500. So his vision will look like this with the skill on:

S: the sniper
O: where he can see
X: fog of war
Code:
XXXOOXXXXXXXXXXXXXXXXXXXX
XXOOOOOXXXXXXXXXXXXXXXXXX
XOOOSOOOOOOOOOOOOOOOOXXXX
XXOOOOOXXXXXXXXXXXXXXXXXX
XXXOOXXXXXXXXXXXXXXXXXXXX

Basically what I wanted to do was have the skill summon 10 invisible wards in front of the sniper thereby giving him vision in the area.

In pseudocode this is how I programmed it:

Code:
if(skill pressed == sniper scope skill)
{
     for(int counter = 1; counter is <= 10; counter++)
     {
          Create a unit (ward) at position of triggering unit with polar offset 
          (500*integerToReal(counter), directionThatUnitIsFacing) facing   
          directionThatUnitIsFacing
     }
}
For some reason this does not work. Could anyone tell me why?


Second question:

After these wards are created, is there a way to automatically add them all to a unit group so I may force them to do actions later on?



If this is not the optimal way to program this, is there a better way? The world editor interface is boggling my head.





Oh yeah, also what do you guys think is the best skill to base this skill off?

d
 
Last edited:
Level 2
Joined
Jul 19, 2009
Messages
8
Ok I got the creation of the units down, but here comes another problem:

I tried using these triggers to force the wards to jump to in front of the unit, but they both have problems:

array.jpg


This doesn't work at all. The wards stay at their original spot as if no trigger ever occurred.


------------------------------------------------------------------------------------------------------------------

unitgroup.jpg


This uses unit group. This technically works, but it is pretty obvious where the mistake lies. Since the unit group always contains the same 5 wards, the same units are being issued multiple commands, this leads to all 5 wards being placed in one location. Once again, not what I intended.

Is there another way?
 
Level 6
Joined
Jan 31, 2009
Messages
166
A few things (non of them a solotion sorry)
A) this is posted in the wrong place it should be posted hear http://www.hiveworkshop.com/forums/triggers-and-scripts-269/

B) your trigger has leaks if you don't know what those are let me direct you to this tutorial http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/basic-memory-leaks-5889/

C) to make this trigger work to best of my knowledge would require JASS and is certainly beyond my skill I might be wrong on that if I knew how to make it work I would tell you.
 
Status
Not open for further replies.
Top