HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How do I cancel a Scroll of Town Portal in-progress?

01-16-2011, 07:15 AM#1
Dr. Cheis
As I approached the end of the project I was working on, I realized to my horror that the player was able to completely screw up all my cinematics involving heroes by activating a town portal scroll right before the cinematic begins. The problem is that the TP scroll freezes the hero in place and makes it unable to perform any actions. I can move the hero to a location, but if the scroll is still casting when the cinematic tells the hero to move somewhere, the order will be ignored. Ordering the unit to stop doesn't stop the teleport, and neither does pausing and then unpausing the hero, so I'm looking for a trigger to abort the TP scroll before cinematics begin. Does anybody know how I can accomplish this?
01-16-2011, 08:31 AM#2
jrhetf4xb
Just trigger the scroll itself and you'll get rid of that.
01-16-2011, 11:27 AM#3
Anitarf
This is odd, I was quite convinced that if you tell your hero to TP in a melee game and then order him to do something else, the TP will get cancelled. If that doesn't work, I'm not sure how you could fix your problem other than hide the original hero and temporarily create a new one for the cinematic.
01-16-2011, 04:37 PM#4
2-P
Quote:
Originally Posted by Anitarf
I was quite convinced that if you tell your hero to TP in a melee game and then order him to do something else, the TP will get cancelled.
I think this used to be possible in older versions, but it's not possible anymore.

Removing (or dropping) the tp scroll from the inventory will cancel the teleport, so just do that at the very beginning of your cinematic. (This works since the scroll stays in the inventory until the hero teleports)
01-16-2011, 08:11 PM#5
Dr. Cheis
Quote:
Removing (or dropping) the tp scroll from the inventory will cancel the teleport, so just do that at the very beginning of your cinematic. (This works since the scroll stays in the inventory until the hero teleports)

This seems to work, although it makes my job more difficult. The problem is, the event "uses an item" only triggers after the scroll finishes casting. "Begins channeling a spell" works to detect the TP scroll, but I can't use "event response - item being manipulated" with it, meaning I'd need to remove every scroll and then replace all but one of them (otherwise I end up possibly removing a scroll not being used and not canceling the teleport). Other than being annoying to do on my end, so far it looks like this will work. :)

EDIT: It looks like using "drop item" will cause the scroll being used to be destroyed rather than placed on the ground, so I don't have to worry about replacing all but one of the scrolls.

EDIT 2: I don't think there's any way to put the item into a specific inventory slot, so all the TP scrolls will get moved up into the top slots when the trigger runs. Because I'd like every single cinematic to not disrupt the player's inventory organization, I'll have to create a separate trigger to track when the TP scroll activates, then set a boolean to true that my cinematic will check before forcing the scrolls to drop.
01-16-2011, 09:38 PM#6
2-P
If you don't want to mess up the inventory organization you could remove all items and give them back in the right order.
01-16-2011, 10:24 PM#7
Anitarf
There is this script that allows you (among other things) to place items in specific slots on a unit (it works by adding temporary items to the unit to fill up all the slots up to the desired one, then adding the item and removing the temporary ones).
01-17-2011, 01:30 AM#8
Dr. Cheis
Quote:
If you don't want to mess up the inventory organization you could remove all items and give them back in the right order.
I was mainly concerned with empty inventory spaces. Say you have a scroll in the number 7 spot on the keypad, a potion of healing in the number 4 spot on the keypad, and a scroll on the number 2 slot on the keypad, doing that would result in a potion of healing in the number 7 spot and the scroll in the number 8 spot. (What I mean is the hotkeys associated with those inventory spots).

Quote:
There is this script that allows you (among other things) to place items in specific slots on a unit (it works by adding temporary items to the unit to fill up all the slots up to the desired one, then adding the item and removing the temporary ones).

Goodness, I'm afraid I wouldn't even know where to begin with this. I don't even have the vocabulary to describe what it is you linked, let alone use it. If I understand it right though, it would add to the "items obtained" counter in the scorescreen, which I consider to be more of a problem than a hero's inventory being re-arranged.
01-17-2011, 02:05 AM#9
Anitarf
Quote:
Originally Posted by Dr. Cheis
Goodness, I'm afraid I wouldn't even know where to begin with this. I don't even have the vocabulary to describe what it is you linked, let alone use it. If I understand it right though, it would add to the "items obtained" counter in the scorescreen, which I consider to be more of a problem than a hero's inventory being re-arranged.
I am not entirely familiar with how that scorescreen counter works, does it go up whenever you pick up an item? In that case, couldn't players inflate it by dropping and picking up an item a lot? If it only works when you pick up an item for the first time, then there's no problem, ItemUtils reuses the temporary items so the most a player's items score would ever go up would be 5, not sure how much of a difference that makes in your map.
01-17-2011, 03:15 AM#10
Dr. Cheis
I'm pretty sure it only goes up the first time the player picks up an item, and dropping it or passing it to a new hero doesn't increase the total. I think you can get around it by switching the hero to a different player control before giving it new items, then switching back, but I would expect that could mess up a bunch of other things if a hero changes ownership and back again (for example, the things I can think of are pending orders from other units targeting the hero, the hero's position on the "hero icon" corner in the game, cause the upkeep bell to ring if the food total drops below and then above the upkeep cutoff for a new tier).

I'd rather create the situation where if the player goes the whole mission having only purchases 2 scrolls of town portal, with one of them stored in the bottom-right inventory slot, then uses one of them right before the cinematic, his scrolls are re-arranged, then create a situation where the scorescreen says he acquired more than 2 items. Technically, neither one is really a big deal, but the latter is inaccurate feedback for the player while the former is just an inconvenience for the player after he does something that pretty much the only reason he'd be likely to do it is to try to screw up the cinematic in the first place.
01-20-2011, 09:39 PM#11
[VDM]Amn
for all cinematics, use temporary units

so no matter what those units are doing your cinematic will never fail