HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to stop Tome Disappearing after acquired?

12-13-2009, 03:29 PM#1
sPyRaLz
I don't know if this has been asked before but I've searched and I haven't able to find the answer looking for.

I'm trying to create an item that does not disappear when it is used upon acquisition.
Its based off a tome.

Although I've set the item to be non perishable, it still keeps disappearing. .

The workaround I've thought of is to let the item perish, then spawn a copy of it on the ground.
I would then need to set the Items 'powerup' property to 0. Unfortunately the GUI does
not seem to be able to do this. . =(
Once this has been done I can give the item to the hero and it shouldn't disappear.

Is there a custom script or any other efficient method I can use to get this effect?
Because i intend to have over 100 different items in the map i'm working on, I don't
think making 100 duplicates with just one value changed is a good fix.

Any help is greatly appreciated. Thanks in advance.
12-13-2009, 03:34 PM#2
Rising_Dusk
Give it more than one charge, or yes, make it non-perishable. You don't need to make any duplicates. If that fails, try basing it on something other than a tome, setting it to be used automatically on pickup, and not be perishable.

Also, moved to general development, this really isn't a T&S question.
12-13-2009, 03:54 PM#3
sPyRaLz
Whoops.. sorry about the incorrect section.

Heres what I've tried.
2 Charges
Non-Perishable
Used when acquired.

Result:
Item still disappears. -____________-

Oh, and i forgot to mention. I'm basing it off tomes/consumables because i need
the item to be purchasable from a shop with a full inventory..

As a reference, heres the trigger im using.
Trigger:
Replace items Copy
Collapse Events
Unit - A unit Sells an item (from shop)
Conditions
Collapse Actions
Game - Display to (All players) the text: item used.
Set TempItem = (Sold Item)
Set TempUnit = (Buying unit)
Set TempPoint = (Position of TempUnit)
Item - Remove (Item carried by TempUnit of type Weapon Slot)
Item - Create (Item-type of TempItem) at TempPoint
12-13-2009, 04:22 PM#4
DioD
just make it is not usable on pickup
12-13-2009, 04:29 PM#5
sPyRaLz
Quote:
Originally Posted by DioD
just make it is not usable on pickup

Ive tried that, it works. But only if the inventory is not full.

As you may have noticed in the trigger, In the case of a full inventory,

I need to drop the item 'Weapon slot' to make space for the item being purchased.

This is a lot more complicated than it looks. It just makes no sense as to why the item
disappears when its non-perishable in the first place..
12-13-2009, 05:45 PM#6
weaaddar
The easiest (and most awful looking) is to force the player to keep one slot empty. By having a trigger like if unit acquires item, manipulating item in slot 6, drop manipulating item.

That way when they acquire an item in slot 6 you can then trigger what you want to do like swap the weapon slot or whatever.
12-14-2009, 02:06 AM#7
sPyRaLz
Quote:
Originally Posted by weaaddar
The easiest (and most awful looking) is to force the player to keep one slot empty. By having a trigger like if unit acquires item, manipulating item in slot 6, drop manipulating item.

That way when they acquire an item in slot 6 you can then trigger what you want to do like swap the weapon slot or whatever.

Thats a good idea. Unfortunately I need all 6 slots.
1) Triggered 'Use object' Item.
2) Key Item.
(Hero limited to carry 1 key item at any one time.)
3) Attack Item
4) Defense Item
5) Support Item
6) Booster Item

All items are Set to undroppable except Key items.
Undroppable items are to be removable through triggers.


UPDATE - Just for the sake of sharing.

Problem has been solved with the use of a dummy unit with 1 inventory slot.
Heres how it was done:
1) Shops Hero Select acquisition range was set to 1.
2) Whenever player selects a Shop, Dummy unit is moved instantly to the location of the shop.
3) Items bought go into dummy units inventory.
4) Item removed from appropriate hero slot, and a duplicate of the bought item is created.
5) Remove item from dummy units inventory.

Trigger:
Unit selects shop
Collapse Events
Player - Player 2 (Blue) Selects a unit
Player - Player 3 (Teal) Selects a unit
Player - Player 4 (Purple) Selects a unit
Player - Player 5 (Yellow) Selects a unit
Collapse Conditions
((Triggering unit) is in ShopGroup) Equal to True
Collapse Actions
Set TempPoint = (Position of (Triggering unit))
Set TempUnitGroup = (Units owned by (Triggering player) of type Inventory Dummy)
Set TempUnit = (Random unit from TempUnitGroup)
Unit - Move TempUnit instantly to TempPoint
Custom script: call RemoveLocation (udg_TempPoint)
Custom script: call DestroyGroup (udg_TempUnitGroup)

Trigger:
Replace items
Collapse Events
Unit - A unit Sells an item (from shop)
Conditions
Collapse Actions
-------- Init vars --------
Set TempItem = (Sold Item)
Set TempUnit = (Buying unit)
Set TempPlayer = (Owner of TempUnit)
Set TempUnitGroup = (Units owned by TempPlayer matching (((Matching unit) is A Hero) Equal to True))
Set TempUnit2 = (Random unit from TempUnitGroup)
-------- Create item for hero --------
Item - Remove (Item carried by TempUnit2 of type Weapon Slot)
Hero - Create (Item-type of TempItem) and give it to TempUnit2
Unit - Order TempUnit2 to move (Last created item) to inventory slot 3
Item - Remove TempItem
Custom script: call DestroyGroup (udg_TempUnitGroup)
12-14-2009, 07:28 AM#8
Tot
Quote:
Originally Posted by weaaddar
The easiest (and most awful looking) is to force the player to keep one slot empty. By having a trigger like if unit acquires item, manipulating item in slot 6, drop manipulating item.

That way when they acquire an item in slot 6 you can then trigger what you want to do like swap the weapon slot or whatever.

set number of slots in the "inventory-ability" (cant remember id) to 7 and force the player to leave the invisible slot empty
12-14-2009, 09:20 AM#9
sPyRaLz
Quote:
Originally Posted by Tot
set number of slots in the "inventory-ability" (cant remember id) to 7 and force the player to leave the invisible slot empty

Just checked, its 'AInv'. GUI doesn't allow me to set 7 slots.
Any idea how it can be set with a Custom trigger / JASS?
12-14-2009, 09:31 AM#10
Fledermaus
Shit + Enter on a field allows you to do any value.
12-14-2009, 11:11 AM#11
sPyRaLz
Quote:
Originally Posted by Fledermaus
Shit + Enter on a field allows you to do any value.

Very cool never knew that for 5 years using world edit.

+Rep. Thanks!

Hmm.. im getting the inventory is full message when i try to pick up the 7th item =/
12-14-2009, 12:50 PM#12
Tot
ah...sry.
made a mistake, use 2 times 'Alnv' (one with 6 slots and one with one slot)
now make the one slot inv always empty (dunno if the order of the 2 abils is important)
12-15-2009, 01:28 AM#13
sPyRaLz
Quote:
Originally Posted by Tot
ah...sry.
made a mistake, use 2 times 'Alnv' (one with 6 slots and one with one slot)
now make the one slot inv always empty (dunno if the order of the 2 abils is important)

Hmm.. I read about this method somewhere, but the poster mentioned there was a side effect of all the items disappearing but the hero still benefiting from the bonuses. Say i add 2x AInv, what condition would i use to check the 7th invisible slot?

if inventory slot 7 has item = true? (sorry this is a little made up)

edit: heres the link. Hidden Inventory Bug
12-15-2009, 01:54 AM#14
weaaddar
It seems that the invisible slot is used first. This is actually very interesting. Although I'm not sure how easy to script around it would be.

I totally might use ItemMenu around this trick.

Its completely worthless :(
You can't move the item to a real slot. nor can you do the drop item or whatever. You can remove the item, but then you lose things like attached data.
12-15-2009, 05:16 AM#15
Askhati
Hmm... If the invisible slot is always used first, and the item cannot be removed by the player from that particular slot, you could - for your RPG system - fill it with a placeholder right from the start, and then replace it later on - via triggers or somesuch - with some "inherent" item. Like biological upgrades which function as items, but should not be droppable. Or a cursed/blessed item that bonds with the hero and cannot be removed unless the hero does some specific task which removes the item via triggers and replaces it with a dummy placeholder again.

I think it has potential...