• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Spell] how can i make an ability change owner of a building to the player activating it

Status
Not open for further replies.
Level 10
Joined
Jun 6, 2007
Messages
392
I don't know that map. How is the activating done, simply by approaching the building? In that case, you could use an event "unit within range", condition "triggering unit is a hero" and action "change ownership of 'building' to owner of triggering unit and change colour".
 
Level 21
Joined
Mar 2, 2010
Messages
3,069
spellforce is a game released for pc. the activation is done through an ability on the building that cause the building to change from 1 building to another.(in my map i have diner which change into diner extorted with the extort ability or the diner taken over with the take over ability.)
 
Level 7
Joined
Sep 11, 2013
Messages
220
Hmm.. If the HERO lets the BUILDING cast an ABILITY: It would change the OWNER of the BUILDING and it would also change the BUILDING to another type of BUILDING?

Set the BUILDING to NEUTRAL and let it sell an ITEM which is the ABILITY.

This is for changing the owner of the BUILDING:

Event: Unit sells an item (from shop).
Condition: Item type of sold item is equal to ITEM (Ability to change owner)
Action: Change ownership of selling unit to owner of buying unit and change color.

This is for changing the BUILDING to another BUILDING:

Event: Unit sells an item (from shop)
Condition: Item type of sold item is equal to ITEM (Diner Extort)
Action: -Change ownership of selling unit to owner of buying unit and change color.
-Replace selling unit (Diner) with a DINER EXTORT.

I hope this would help.. Just try one of those if you want :)
 
Level 21
Joined
Mar 2, 2010
Messages
3,069
i found a different solution but now the map have corrupted to the point where it doesnt work anymore. what i did was that i added the hero to a variable as it was selected by select unit then changing owner of the diner to owner of the unit stored in the variable. it worked the first time i tested it but it havent worked since. could you help me fix it.
 
Level 21
Joined
Mar 2, 2010
Messages
3,069
i didnt ask for an item based solution. i asked for a solution to the trigger that didnt work.(worked once but never again.) seems that i got closer to finding out what is causing it though. the hero isnt added to the variable and therefore the other trigger doesnt fire either.
 
Level 7
Joined
Sep 11, 2013
Messages
220
Y look for a hard way when there is a easier way? The triggers i added works fine, especially with the ITEMS.

I tested your triggers and it did not work, it did not change OWNERSHIP and I dont think it replaced the Diner into the others.

Dont PM me about me harrasing you, im just trying to help, if you dont want my help then dont use it, i'll delete it from my pastebin.
 
Level 21
Joined
Mar 2, 2010
Messages
3,069
i did say that i didnt want that kind of solution. i dont need any more leaks in my map and that solution is leaky. i created my own solution but something prevents the hero from being added to the unit variable. i just tested the solution the other user provided and that doesnt even work properly.(extort doesnt change owner.)
 
there was a script here I think that counters item leak or something...

also, if my understanding of your plan was correct, I think it can bug especially if this is a multiplayer map

this is your method right?

1) When a hero is selected, set it to a variable
2) When the ability is activated, fetch the owner of the unit stored on the variable

now what if Player 1 selects hero, Player 2 selects hero afterwards, then player 1 activates the building ability? this set-up will mean that the building will belong to P2 since he selected his hero after player 1 did...
 
Level 21
Joined
Mar 2, 2010
Messages
3,069
the building functions a bit like a shop so it have the select unit ability. i need that ability to add the hero to a variable. i can easily use a condition to add the hero to a player specific variable. what bugged was that the second time i saved the trigger it no longer added the hero to the variable. you are welcome to look at the map to help me diagnose the issue.
 
Then why not just use that select unit ability as the change owner ability??? that will be easier since you can just trigger the change when the ability is used, and you can easily catch the target too... you can simply check if the current owner is Player neutral so that it will only trigger when the building is still owned by that...

if it's a separate ability, the above bug that I posted can still happen you know... since other players can still use the select unit ability before the first player gets to use the change owner ability...

if you can't use the select unit ability as the change owner ability, the item way will be the sure-way to do this... you could also opt to use units instead of items...
 
Level 21
Joined
Mar 2, 2010
Messages
3,069
the way it works in gangland is that the hero unit communicates with the store manager in the diner. the hero can choose between 2 options: extort and take over. extort gives partial control but other players can still take control take over gives complete control and then other players have to actually kill the store manager. i had to do some changes to make it work with warcraft 3 so the building replace the store manager but still sends people carrying money to the HQ. when i first tried to make select unit add a hero to a variable it worked perfectly but when i saved it a second time it stopped working.
 
Level 7
Joined
Sep 11, 2013
Messages
220
Ok here: The reason why i didnt make EXTORT change OWNERSHIP is because I read its DESCRIPTION (The one you placed in the ABILITY) which said something this: "It gives INCOME BUT DOES NOT GIVE YOU CONTROL" so I thought that only the DINER TAKEN should change the OWNERSHIP but you can just actually COPY AND PASTE or ADD a TRIGGER in the ACTIONS:

Change Ownership of Selling Unit to Owner of Buying Unit. There, no problem.

[EDIT] Ok I will try to help you in your way.
So when any Player goes near the DINER they can use the EXTORT and TAKE OVER ability?

Then when a Payer uses the EXTORT ability it gives control to whoever goes near the Diner Extort and uses the EXTORT ability?

And if he chooses the TAKE OVER ability it gives full control only to ONE player?
 
Last edited:
But really, why not make the ability just target the hero... That will work nicely, + it will avoid any of the bugs I mentioned above

Or you can opt to detect player selection event, if the selected unit is the shop, register the player to a variable, then check ALL other player's selections, if they contain the shop, clear selection for them to ensure the bug I mentioned won't happen
 
Level 21
Joined
Mar 2, 2010
Messages
3,069
certain buildings have an ability that is called extort and an ability that is called take over. after the extort ability is used the building change owner but retains the take over ability and can be taken over by anybody within range that activates the take over ability. after the take over ability have been used the only way to retake it is to destroy it which respawns it as neutral.(the respawn i should be able to handle myself though.)
 
Level 6
Joined
Mar 30, 2014
Messages
230
dude you have a bunch of problems in your life i saw lots of threads from you all about your problems?
 
Status
Not open for further replies.
Top