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

A Multitude of Questions

Status
Not open for further replies.
Level 3
Joined
Jan 8, 2011
Messages
70
Hello everyone, i have a few questions for a map that i'm making. +rep to anyone who can help and recognition in my map if you help enough :)

1. I have a gold building (provides gold every few seconds) which is buildable by 'survivors' (1 per player), but i don't know how to limit the players to one of these buildings.

2.

a. I am creating a lumber system in which you can recruit 'elementals' from a lumber mill which turn into trees. Depending on what elemental it is, it turns into a different tree. So each elemental is essentially a seed, so you can create a tree wherever you want and then harvest from it with workers. How would i change the elemental into a tree, say if i used a spell like transform.

b. I would also like to remove the ability to harvest lumber from the trees placed in the map as scenery. These trees are from the felwood tileset.

c. How could i change the amount of lumber a worker gathers from a different tree, so more expensive trees allow the worker to gather more lumber. If possible i'd like the workers to harvest at the same speed from each tree, so they get 10 from one tree, and 20 from another but it takes the same amount of time.

3. Finally, how could i create a spell or item that allows your character to destroy trees (if possible doodads too) over a period of about 10 seconds?

I know these are long explanations, so please ask me to clarify if need be. I would just like to point out i am asking for help to do these anyway possible but preferably as GUI.

Thanks alot :D
 
Level 13
Joined
May 11, 2008
Messages
1,198
Hello everyone, i have a few questions for a map that i'm making. +rep to anyone who can help and recognition in my map if you help enough :)

1. I have a gold building (provides gold every few seconds) which is buildable by 'survivors' (1 per player), but i don't know how to limit the players to one of these buildings.
it depends how you want to make the building. i think an easy way to accomplish it is to place the building as a unit at a location when the builder using a skill to build that one building at a point on the ground. this just popped into my head. there may be other ways to do it.anyway, just make a trigger after the skill has been used then remove it from the unit.
2.

a. I am creating a lumber system in which you can recruit 'elementals' from a lumber mill which turn into trees. Depending on what elemental it is, it turns into a different tree. So each elemental is essentially a seed, so you can create a tree wherever you want and then harvest from it with workers. How would i change the elemental into a tree, say if i used a spell like transform.
you can simply replace the unit with a tree.
here is a snippet of a piece of code i wrote that makes tree:
Code:
if pv ==99 then//night elf unit
return CreateDestructable('B00E',ux,uy,GetRandomReal(0.00, 359.99),GetRandomReal(0.33, 1.33),GetRandomInt(1, 3) )
elseif pv ==96 then//corruptedneu
return CreateDestructable('B00D',ux,uy,GetRandomReal(0.00, 359.99),GetRandomReal(0.33, 1.33),GetRandomInt(1, 3) )
elseif pv ==98 then//bloodelf
return CreateDestructable('B00B',ux,uy,GetRandomReal(0.00, 359.99),GetRandomReal(0.33, 1.33),GetRandomInt(1, 3) )
elseif pv ==94 then//undead  
return CreateDestructable('B00B',ux,uy,GetRandomReal(0.00, 359.99),GetRandomReal(0.33, 1.33),GetRandomInt(1, 3) )
elseif pv ==87 then//icey creature
return CreateDestructable('B00A',ux,uy,GetRandomReal(0.00, 359.99),GetRandomReal(0.33, 1.33),GetRandomInt(1, 3) )
elseif pv ==95 then//watercreature
return CreateDestructable('B00C',ux,uy,GetRandomReal(0.00, 359.99),GetRandomReal(0.33, 1.33),GetRandomInt(1, 3) )
elseif pv ==97 then//nagacreature
return CreateDestructable('B00C',ux,uy,GetRandomReal(0.00, 359.99),GetRandomReal(0.33, 1.33),GetRandomInt(1, 3) )
elseif pv ==93 then//humanunitkillsit
return CreateDestructable('B006',ux,uy,GetRandomReal(0.00, 359.99),GetRandomReal(0.33, 1.33),GetRandomInt(1, 10) )
elseif pv ==92 then//orcunitkillsit
return CreateDestructable('B005',ux,uy,GetRandomReal(0.00, 359.99),GetRandomReal(0.33, 1.33),GetRandomInt(1, 10) )
elseif pv != 89 then//fire creature notkillsit...
return CreateDestructable('B009',ux,uy,GetRandomReal(0.00, 359.99),GetRandomReal(0.33, 1.33),GetRandomInt(1, 3) )
else//firecreaturekillsit
return CreateDeadDestructable('B00F',ux,uy,GetRandomReal(0.00, 359.99),GetRandomReal(0.33, 1.33),GetRandomInt(1, 10) )
i'm actuallly no longer using this code in my map for the moment, i got rid of the idea that i was using it for(treants dying turning into trees).
what you should be concerned with here is the CreateDestructable functions and the values that they take
ux,uy isthe point the unit was at. B005, B009 and those other integers are tree raw codes. then we have facing direction real, size real, and a variance integer. i think most the trees have either 10 or 3 types of variants.

b. I would also like to remove the ability to harvest lumber from the trees placed in the map as scenery. These trees are from the felwood tileset.
you should be able to do that by making the object invulnerable, if i'm not mistaken. if it doesn't work maybe there's a way to make them be an environment doodad instead of a destructable. i'm not sure about that.
c. How could i change the amount of lumber a worker gathers from a different tree, so more expensive trees allow the worker to gather more lumber. If possible i'd like the workers to harvest at the same speed from each tree, so they get 10 from one tree, and 20 from another but it takes the same amount of time.
edit the appropriate harvest abilities. there are many, and you can copy some of them and make your own, if you so choose.
3. Finally, how could i create a spell or item that allows your character to destroy trees (if possible doodads too) over a period of about 10 seconds?
hmm...haven't tried to do that. do this have more to do with harvesting? well, if you look at the tree hp just deal damage(i think magic damage or any other damage works fine) each second according to 1/10 of the tree hp. you can also edit how much lumber trees have by editing their hp, by the way. just keep in mind you cannot edit the lumber of a tree or it's hp just by clicking on it in the map like you could a gold mine. you have to edit the object's hp itself in the object editor. remember if you needed a version of a tree with more or less hp you just need to copy it and edit the copies.
I know these are long explanations, so please ask me to clarify if need be. I would just like to point out i am asking for help to do these anyway possible but preferably as GUI.

Thanks alot :D

if you have further questions let me know, i tried just quoting you and posting answers in green.
 
Level 3
Joined
Jan 8, 2011
Messages
70
Thanks alot, the answers are really great.

For number 1, just clarifying, i should change the 'gold building' into a spell and remove once done? What about if the gold building is destroyed, how do i bring it back?

I know nearly nothing about code too, so if you could, would you show me how i could implement that into my map?

Otherwise, the advice is great, +rep :D
 
Level 13
Joined
May 11, 2008
Messages
1,198
Thanks alot, the answers are really great.

For number 1, just clarifying, i should change the 'gold building' into a spell and remove once done? What about if the gold building is destroyed, how do i bring it back?

I know nearly nothing about code too, so if you could, would you show me how i could implement that into my map?

Otherwise, the advice is great, +rep :D

use the UnitAddAbility function to give back the ability again if the building unit is killed. simple. if everyone has just one survivor, i would save the survivors in a unit array. so survivorunit[0] would be owned by player red, and it would be the survivor, and so you can get owner of the dying unit(the building)and if it's Player(0) then UnitAddAbility(unit whichunit, integer abilityid) then unitwhichunit becomes survivorunit[0] elseif so on and so on until you've gone through all the players that are survivors.

anyway, i didn't recommend use a summon spell for the gold building(unless you want it for the dummy spell, that's ok i guess, then you just need the x,y of the casting unit andperhaps a facing of the casting unit instead of a point on the ground.), use the CreateUnit function to make the goldbuilding.

but if your intent isn't to make the survivor rebuild the building but to make the building revive on it's own, you can simply add a timer when the unit dies and call back a function when the timer ends to createthe unit all over again. it's probably a little complicated for you to work with timers, if you want an example, i'll be sure to send one over. but for the moment try to just instantly create the building when it dies, if that works, we can take it from there.
 
Status
Not open for further replies.
Top