• 🏆 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!

random point and region attack

Status
Not open for further replies.

007

007

Level 6
Joined
May 3, 2009
Messages
175
i have 2 problems:

if i use the event "create ... at random point in region ..." the units always appears at the same place, although i thought "random" meant it appears in a random place every time and not always in one place, which was once chosen raqndomly. is there any way i can have it appear somewhere else every time?


if a unit has region attack (im not sure if its called like that in english, but i mean that a unit has range attack, which deals damage to all units within ... range of the point where the unit attacked), even though the region is only 80, the enemy of the attacking unit even gets damaged (only a bit though) if it is about 800 away from the attacked point. how can i solve that?
i have another problem with this attack. if the attacked unit is running, the attacking unit sometimes shoots exactly to the point where the unit is running and not where it is right now, although it usually works like this.
 
Level 11
Joined
Jun 20, 2009
Messages
880
You have to do this:

1. Create a Point variable called "Location"
Then trigger this:

Actions:
  • Set Location = Random point in region
  • Create 1 Unit on Location
Then add Custom Script:
  • call RemoveLocation(udg_Location)

This way the random location really is random.

2. I think you mean Area of Effect?
There is these following values in Object Editor:
Combat - Attack 1 - Area of Effect (Full damage)
Combat - Attack 1 - Area of Effect (Medium damage)
Combat - Attack 1 - Area of Effect (Small damage)


Edit those values to get smaller or bigger AoE.

3. In Object Editor, there is:
Combat - Attack 1 - Projectile Homing Enabled

If you set it to True, the bullet will follow the unit.
If you set it to False, the bullet wont follow, and will hit the location where unit was when bullet was shot.
 

007

007

Level 6
Joined
May 3, 2009
Messages
175
1. the "call RemoveLocation". what is it for? do i have to somehow reset the random point?

2. i already edited the area of effect values and i set the projectile homing to false. but the problem is still there.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
if i use the event "create ... at random point in region ..." the units always appears at the same place, although i thought "random" meant it appears in a random place every time and not always in one place, which was once chosen raqndomly. is there any way i can have it appear somewhere else every time?

exit WE and play your map in a normal way, OR UNCHECK the 'Fixed Random Seed' in, File >>> Preferences >>> Test Map
 

007

007

Level 6
Joined
May 3, 2009
Messages
175
what am i supposed to do with that? i read the first few posts, but they just contain stuff like setting variables. i wont read all of the 60 pages there.
which leak am i supposed to clean anyway? if you call it a leak that the random-trigger does not do something randomly, you can hardly blame me for it.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
By referring to Kala's post, you can see the usage of cleaning Point-type leak
  • Custom script: call RemoveLocation(udg_*YourVariableName*)
So basically, it works ONLY for Point-type variable
Other leak needs other way to clean it (Unit Group leak, Player Leak and so on)
Maybe you DIDN'T SET your Region ?
I mean, did you SET any Region by using the Region Palette ?
If you didn't do that, the function will be null, returning a null function which resulting in creating at the origin coordinate in the map (which is (0, 0))
A test map attached, basically I was just rephrasing what Kala did, in an easier way (test map)
Enjoy~
 

Attachments

  • Random Spawn.w3x
    12.2 KB · Views: 42

007

007

Level 6
Joined
May 3, 2009
Messages
175
never mind about the random point.

but why does a unit "A" get damaged by unit "B", whose area of effect is 80, when A is about 1000 away from the atacked point of B?
 

007

007

Level 6
Joined
May 3, 2009
Messages
175
... just read my first post. there i said that i mean the area of the attack and not of an ability. why doesnt that work properly?
 

007

007

Level 6
Joined
May 3, 2009
Messages
175
if a unit has region attack (im not sure if its called like that in english, but i mean that a unit has range attack, which deals damage to all units within ... range of the point where the unit attacked), even though the region is only 80, the enemy of the attacking unit even gets damaged (only a bit though) if it is about 800 away from the attacked point. how can i solve that?
i have another problem with this attack. if the attacked unit is running, the attacking unit sometimes shoots exactly to the point where the unit is running and not where it is right now, although it usually works like this.

isnt there anyone who knows what could have caused this?
 
Level 15
Joined
Oct 16, 2010
Messages
941
Don't triple post (wait a few days before bumping) and try and be nicer to people who are trying to help you.

Please upload the map, right now this could be any number of things and i'd rather find the problem then just takes random guesses (like Maker said)
 
Status
Not open for further replies.
Top