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

Where's the trick?

Status
Not open for further replies.
Level 9
Joined
Jul 10, 2011
Messages
562
hey guys ;D

i made a spell for selling items inside of the inventory....so far its easy. now the problem...no matter which casting range i insert (tried up to 9999) i always get the error that the target isnt in range.
The spell is based on channel and its working perfectly...the only problem is that i have to drop the item i wanna sell before its possible so where's the trick?

thanks in advance

greetz clapto
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
you can do this :

when the ability casted, spawn a dummy shop (without model, selection, and pathing) of course with a normal shop abilities, then order the unit to give the item to the shop.

this is an example
  • Set tempPoint = (Position of (Triggering unit))
  • Unit - Create 1 Dummy Shop at tempPoint
  • Unit - Order (Triggering unit) to give (Item carried by (Triggering unit) in slot 1) to (Last created unit)
I hope you get the idea! :)
 
Level 9
Joined
Jul 10, 2011
Messages
562
the problem is that the ability isnt cast on the items in the inventory because they are not in range (at least the error tells that -.-) so that wouldnt work too ^^

but thanks anyway xD
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
What about creating a dummy shop at map init and then moving it right next to the hero when the spell is cast?
Or you know, move the item. That's also fine. There's no reason why it wouldn't be in range of the shop.

I use a similar method for the JASS-snippet that is aptly named "GetItemCost"
(based on Nes' more advanced version, as mine doesn't include stacks and there might be some other rubbish I didn't account for).
 
Level 9
Joined
Jul 10, 2011
Messages
562
so once again because it seems to be unclear :

i made a spell to sell items with the snippet apo suggested
the problem is that i cant target item inside the inventory of the casting unit because i get the error that the target isnt in range.

how can i fix that?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
My apologies, seems like I'm the one misunderstanding you, Clapto.
I have no idea why my spell doesn't have the error you have, I just based it off Channel (as did you), then set targets allowed to "Item" and it worked.
Didn't even change the cast range or anything.

Map attached, I hope it helps you.
 

Attachments

  • Item Sell Spell.w3x
    17.1 KB · Views: 37
Level 9
Joined
Jul 10, 2011
Messages
562
ahhh found the problem xD

stupid me....i based the unit having the spell of the human house and that unit seems to be unable to cast the spell on items in its inventory somehow....when i tried my spell with a hero it worked perfectly.

thanks for helping me guys ;D +rep^^


EDIT: okay now i ran some tests and i ran into anohter problem. it seems that buildings cant cast the spell as long as the movementspeed is 0 but when i set the movementspeed to 1 it can cast the spell but it can move too and has these annoying icons for move, patrol etc. anyone has an idea?
 
Last edited:
Level 28
Joined
Jan 26, 2007
Messages
4,789
Hmh, yet again I seem to get different results.

I opened my test-map (see previous post), created a custom building (based on the Farm) and gave it an inventory and the spell (which is now a unit-spell instead of a hero-spell).
I was able to use the ability and the items still sold as they should.

I tried making the building unable to use any items ("Data - Can Use Items = False"), but that didn't seem to have any impact.
What did make the spell fail was the data "Data - Can Drop Items = False", but that only seems logical.
 
Status
Not open for further replies.
Top