HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Created unit faces the same angle as dying unit?

07-13-2006, 06:06 PM#1
Sardius
How can I make it so a created angle faces the exact angle as the dying unit was facing?

Basicly as soon as this unit dies, a simular unit appears to take its place, but I want him to be facing the same direction...
07-13-2006, 06:21 PM#2
PipeDream
common.j is your friend, use it.
Collapse JASS:
native          CreateUnit              takes player id, integer unitid, real x, real y, real face returns unit
constant native GetUnitFacing       takes unit whichUnit returns real
native          SetUnitFacing       takes unit whichUnit, real facingAngle returns nothing //Unnecessary if you do it in CreateUnit
07-13-2006, 06:33 PM#3
Sardius
heh when it comes to scripting Im still pretty new to it... that file doesn't mean a heck of a lot to me, my only Jass experience is in designing campaign AI scripts, because what you just posted really doesn't make a whole lot of sense to me...

As I said, my Jass skills are still very newbish and I don't understand a lot of it. So I still donno what I need to do to create my unit facing the same angle as the former dying unit.
07-13-2006, 06:58 PM#4
Hemlock
Well since your not that familiar with it yet, here is an easy way in "GUI"

Trigger:
Trigger
Collapse Events
Unit - A unit Dies
Collapse Conditions
(Dying unit) Equal to "your unit"
Collapse Actions
Unit - Create 1 Peasant for Player 1 (Red) at (Position of (Dying unit)) facing (Facing of (Dying unit)) degrees

You can also make it in the same trigger but then you need to save the information of the unit you want to use before it dies in variables, like this.

Trigger:
trigger
Events
Conditions
Collapse Actions
Set angle = (Facing of "your unit")
Set point = (Position of "your unit")
Unit - Kill "your unit" <gen>
Unit - Create 1 Peasant for Player 1 (Red) at point facing angle degrees
07-13-2006, 07:21 PM#5
Sardius
Thanks, that worked perfectly.
07-14-2006, 01:36 AM#6
Daxtreme
Add in

Trigger:
Custom script: call RemoveLcation(udg_point)
07-14-2006, 02:57 AM#7
Hemlock
He could probably do that throughout his whole map then =P

And then he also would need to use a temppoint in the first trigger I wrote.