HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Variable help.

11-02-2003, 05:25 PM#1
Jedi_r8
I want a unit (shadowhunter) to switch projectile type and damage in a map. Its after he completed a quest. The condition and such works fine but just before i start a series of special effects i want to replace the unit with another unit with a different projectile type and damage.
Before i start the special effects, i do this action:

Unit -Replace Shadow Hunter 0053 <gen> with a Shadow Hunter using The old unit's life and mana (Shadow Hunter is the other unit i want)
Wait 0.10 seconds
Set ShadowHunter = (Last replaced unit)
Unit - Order ShadowHunter to move to (Center of Region 001 <gen>)

And then i continue to use the vaiable ShadowHunter in the special effects and the rest of the trigger. Example:
Special Effect - Create a special effect attached to the weapon of ShadowHunter using Abilities\Weapons\FarseerMissile\FarseerMissile.mdl

In-game the trigger stops immideatly after i replaced the shadowhunter with the new shadowhunter. Anyone knows what im doing wrong?
11-02-2003, 05:28 PM#2
Ligature
Maybe you need to get rid of the Wait action between where you replace the unit and where you set your variable... Wait actions do funny things sometimes.

(EDIT) my theory is that this particular Wait is interrupting the "last replaced unit" function so it doesn't recognize the replace action.
11-02-2003, 05:35 PM#3
Jedi_r8
I put that Wait there when it did not work at first, some triggers dont work if you put wait in front of them. Unfortunatly it did not work without Wait either. emote_confused
11-02-2003, 05:46 PM#4
Ligature
OK.. I don't think you need the Wait, first of all, but here's an idea:

Put Game Text messages in like this:

Game - Display to all players the text: Now Displaying ShadowHunter
Game - Display to all players the text: (Convert Unit-Type to String: Unit type of ShadowHunter)

put them directly After the "Set ShadowHunter = Last replaced Unit"

then test the map, and if the second Text message is empty, the trigger isn't working because of the way you're setting the variable...

I honestly don't think it's the variable, because I don't see anything wrong with the script you've posted...
11-02-2003, 06:09 PM#5
SourGummiWorm
when you set the variable to last replaced unit, that is setting it to the unit you just replaced (the one that is gone now) not the one created... that would be "replacing" unit.. however I am not sure there is a replacing unit variable, so try last created or something isntead...
11-02-2003, 06:39 PM#6
Jedi_r8
Hmm, that makes sense, i tried with last created unit first though, and that did not work so i changed to last replaced unit. :(
11-02-2003, 07:15 PM#7
Ligature
I'm pretty sure "Last Replaced Unit" is the correct function. Look down at the bottom of the unit selection window when you've hilited "Last Replaced Unit" in the function drop-down and you'll see that the grey text says:

"This is the last unit created via a 'Unit - Replace' trigger action."