HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Shops Selling Spells, Can It Be Done?!

09-28-2008, 08:42 AM#1
moo^moo^cow
hey all, i've had this crazy idea in my head for awhile and ive been playing around with it on WE but i just cant seem to make it work. What i'd like to know is, is it possible to make shops sell spells which they will cast.

For example, Goblin Laboratory sells reveal and it casts it. No problem there. But is there a way to make it cast Holy light on my hero for a fee? ive tried changing reveal as the base spell but i just cant get it to charge my hero gold for the spell. Does anyone know how i could do this?
09-28-2008, 09:34 AM#2
Belphegor666
1. Make a dummy item and when shop sells this dummy remove it from player (not sure if you have to drop remove it or just remove it).
2. Make a dummy caster (no model, max stats, invuln ) somewhere in the edge of a map. Dummy caster has all spells the spell shop sells.
3. Give control over dummy caster to player who bought it and open up appropriate spell targeting (AoE, single target, etc.).
4. When dummy caster casts a spell, return control to your hero and kill the dummy caster (just make sure he finished the spell).

This is basic really. For something more enhanced wait for the others to reply.
09-28-2008, 09:58 AM#3
moo^moo^cow
the problem with that is, youre not able to select where you want the spell to be cast. I'm actually making a hire assassin system for my map, but so far ive only managed to make the assassin cast inferno at the targeted area but the shop doesnt ask for money. im liking how well it works at the moment but if i can just make it so you have to pay to nuke someone id be over the moon.
09-28-2008, 11:20 AM#4
Anitarf
Unfortunately, we can't make spells cost resources like gold and lumber (other than a select few spells like Reveal). For spells without targets, the easy workaround is with items and triggered dummy casters that get created to cast the spell when someone buys one of those items, but I'm not sure there is a solution as simple for targetting spells.
09-28-2008, 03:54 PM#5
moo^moo^cow
ahhh thats a shame =/. Well as a work around is there anyway i can trigger it so i can prevent my "shop"/assassin from casting the nuke if the unit doesn't have the right amount of gold on them?

im pretty sure thats doable yes?
09-28-2008, 07:29 PM#6
Anitarf
I'd say it is, assuming there's a way to get the player who ordered the ability to be cast; I'm not quite sure how that would be done, though.
09-28-2008, 11:52 PM#7
Pyrogasm
If made the shop sell units instead of items you could get the unit's owner easily.

Alternatively, you might be able to get the owner by having 12 identical shops and just hiding 11 of them for each player with a GetLocalPlayer if-block. That is... if buying an item from a locally hidden shop doesn't desync the game.
09-29-2008, 12:19 AM#8
moo^moo^cow
that sounds confusing . if i made local shops sell units and instead of items means i wont be able to select points on the map where i would like to cast spells.

Seeing as its pretty darn impossible to have a shop sell spells i think its gunna require me to trigger it instead thanks for the feedback though guys very handy and its clarified for me that it cant be done by using just object editor and changing values =/.
09-29-2008, 01:41 AM#9
moo^moo^cow
ok after various tests i think i have found a solution but im stumped on one thing. Whenever i make my unit cast reveal it wont create a dummy caster at my desired location and its bugging me. please dont tell me its impossible to make a dummy unit at the point of a reveal cast =__=;.

here's my trigger:

Trigger:
Bomb Voyage
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
((Triggering unit) Equal to Hawk (Level 1) 0000 <gen>) and ((Ability being cast) Equal to Reveal)
Collapse Actions
Set CastPoint = (Target point of ability being cast)
Unit - Order Hawk (Level 1) 0000 <gen> to Move To CastPoint
Unit - Create 1 BombVoyage! for (Owner of Hawk (Level 1) 0000 <gen>) at CastPoint facing CastPoint
Set BombVoyage = (Last created unit)
Trigger - Run Bomb 2 <gen> (ignoring conditions)
09-29-2008, 02:11 AM#10
TKF
Quote:
Originally Posted by Pyrogasm
If made the shop sell units instead of items you could get the unit's owner easily
He's right. Those units could also be dummy units, like for example the ship control in missile war, those are just dummies which are detected by triggers.
09-29-2008, 02:18 AM#11
moo^moo^cow
ive never played missile war so i dont know what youre talking about sorry =/. but im a little confused im not sure if everyone misunderstood what i meant by selling a spell. What i meant was the shop charges the player a fee for it to cast a spell such as heal or blizzard. if you look at the trigger i posted in my previous post i tried making my "shop" to move to the point location where the ability reveal was used but ive had no luck with that. It won't even create a dummy unit there which i dont understand why it should be working right but its not.

---EDIT---

ok i played around with my trigger a bit and found that the problem was the target point of ability being casted. For some unknown reason, the game wouldn't register the point location where i casted reveal. so my dummy unit wouldnt appear and the shop wouldnt move at the chosen location.

---2nd EDIT---

after some searching its not possible at all. GG blizz =/. Reveal doesn't return a point value hence why i could never make my shop move to the location where reveal was casted. I had the same problem as http://hilton.vs.oiccam.com/showthre...point+location
it seems
09-29-2008, 07:56 PM#12
Bobo_The_Kodo
^^

Collapse JASS:
scope Test initializer Init

    private function Conditions takes nothing returns boolean
        return GetIssuedOrderId() == 852023
    endfunction

    private function Actions takes nothing returns nothing
        local location l = GetOrderPointLoc()
        
        call BJDebugMsg( "X:" + R2S( GetLocationX( l ) ) )
        call BJDebugMsg( "Y:" + R2S( GetLocationY( l ) ) )
        
        call RemoveLocation( l )
        set l = null
    endfunction

    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        
        call TriggerAddAction( t, function Actions )
        call TriggerAddAction( t, Condition( function Conditions ) )
        call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
        
    endfunction

endscope
09-30-2008, 01:17 AM#13
moo^moo^cow
no way.... are you serious bobo? does that actually work and if it does.. do you think you could make a GUI version of it? im not particularly good with JASS however i understand some of it for the most part. I don't know how to change the rest though to integrate it with my other triggers could you explain what parts i need to change. ^^;

P.S. what i dont understand is how? i thought reveal doesnt return a location...
09-30-2008, 04:53 AM#14
botanic
its not returning point of ability its returning point of an order

i think its in the gui under unit issued order targeting a point
09-30-2008, 05:14 AM#15
moo^moo^cow
ive tried that though... ive tried ability and order but the result was null. perhaps i wrote it wrong but could you show me how i check an order? is it meant to be:

Condition:
(Issued Order) Equal to (Order(852023))

or

Condition:
(Issued Order) Equal to (Order(String(852023)))

ive tried both and i still got nothing from it =/. Heres my trigger: everything should be working right.

Trigger:
Bomb Voyage
Collapse Events
Unit - A unit Is issued an order targeting a point
Collapse Conditions
(Issued Order) Equal to (Order((String(852023))))
Collapse Actions
Set CastPoint = (Target point of issued order)
Unit - Order Hawk (Level 1) 0000 <gen> to Move To CastPoint
Unit - Create 1 BombVoyage! for (Owner of Hawk (Level 1) 0000 <gen>) at CastPoint facing CastPoint
Set BombVoyage = (Last created unit)
Trigger - Run Bomb Voyage 2 <gen> (ignoring conditions)