• 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.

Three simple questions.

Status
Not open for further replies.
Level 1
Joined
Sep 25, 2011
Messages
5
1: How do I disable a player from controlling a certain unit?

I'm making a AoS where the 6th slot is a player, but he only controls buildings and special units, not the general creeps that spawn in the lane. How do I disable him for controlling them?

2: How do I set a unit damage to a fixed value?

For example: The 83-86 damage would be 85. Only 85.

3: How do I make mana scaling for spell damage?

I would like to make a spell hit based on my mana (10% of actual mana, etc). Can somebody explain me the simplest way to do it?
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
1/ Add the creeps that spawn in the lane to the unit group when they are spawned. Then make a trigger that when that player select the unit, if the unit is in the creep spawn unit group, then deselect the unit.
2/ Make the value damage dice and side per dice equal to 1.
3/ The simplest way to do it is through trigger :). If it is a projective spell, u must have a projective system. If it is non-projective spell, u just need to set 10% of caster mana as the variable, then cause the caster to deal damage to the target equal to that variable.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
1: How do I disable a player from controlling a certain unit?
Make them wards, this prevents the player from using abilites they have. If the player does issue them an order then you immeditly change their order back to the automatic order.

1/ Add the creeps that spawn in the lane to the unit group when they are spawned. Then make a trigger that when that player select the unit, if the unit is in the creep spawn unit group, then deselect the unit.
This does not work as selection synchronization requires time. As such there will be a latency dependant period during which the player will have them selected before the trigger can force him to deselect them. In a laggy session this can be over a second.

If you migrated to StarCraft II you can easilly do this by changing a unit field. You also have 14 usable player/computer slots and 2 dedicated computer slots which would allow you to allocate a dedicated computer slot for the spawns. Consider migrating to StarCraft II.

2: How do I set a unit damage to a fixed value?
Set unit base damage to the damage you want the unit to do minus 1. Set the dice number to 1 and sides per dice to 1 as well. The unit will now deal a non-random amount of damage (like StarCraft II units do).

3: How do I make mana scaling for spell damage?
When you get to the damage part of your trigger enchanced ability you get the mana from the caster and multiply it by 0.1 and use that as the argument for the damage amount. You may want to find a trigger enhanced ability from the spell section for this or make your own.
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
hey, i will make all of the kind of spell for him to choose. now you can delete your last 2 post to prevent confusion.

Some little note for u, Venomous:
Check every 0.02s, no need to check 0.01s (since human eyes can only see about 47 frame per second). Also, u should make the dummy projective facing the target point (or position of target) when creating them. (Some projective will have seems weird right at the cast).
The Distance u make can be changed overtime so u should check the distance every seond too (for the homing projective target only). To avoid bug, after check it, make it minus 50 to have the current distance.
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
At least show him how @@"

1. Open Object Editor
2. Go to Units Tab
3. Select any unit
4. In the unit's field, find Stats - Unit Classification
5. Tick the Ward box

By doing this, the unit's command card is all blank (but note this, you can still order it to move,attack,etc)

And since you can still order it to do something, then Joager cant use it (Joager wants the player cannot control the units).
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
Some little note for u, Venomous:
Check every 0.02s, no need to check 0.01s (since human eyes can only see about 47 frame per second). Also, u should make the dummy projective facing the target point (or position of target) when creating them. (Some projective will have seems weird right at the cast).
The Distance u make can be changed overtime so u should check the distance every second too (for the homing projective target only). To avoid bug, after check it, make it minus 50 to have the current distance.

hmm, i think it's best to delete my post. if i don't delete it, he/she might get more confusion #_#
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
That is why you should read DSG's last word in the sentence,
If the player does issue them an order then you immeditly change their order back to the automatic order.

Let's say he's heading to Point A, when Player interrupts it, when that happens, immediately force the unit to go to Point A again.

OR, you could do this in interval of 0.03 seconds, order the unit to do that action (does not lags the game, even with many units - proven by a custom Wacraft III game called Castle Fight).

At least in Castle Fight, this is how it's done.
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
Not really. We dont detect when the projective hit but we create our own projective (a dummy unit actually) and order it to move to the target. When the distance between it and the target is 0 then we do our spell.
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
Just wondering, what do you mean by a projectile system?
I know how to alter the damage of spells but I never realised that there was a way to detect when the projectile hit (if that's what you meant).

here i make a triggered firebolt, you could create a new one on your own, or just CnP this and configure it to fit your need :D

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Melee Game - Create starting units (for all players)
      • Hashtable - Create a hashtable
      • Set hash = (Last created hashtable)
  • Triggered Firebolt
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Firebolt
    • Actions
      • Set tempDamage = (0.10 x (Mana of (Triggering unit)))
      • Set tempPoint = (Position of (Triggering unit))
      • Set TargetLoc = (Position of (Target unit of ability being cast))
      • Set tempUnit = (Target unit of ability being cast)
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at tempPoint facing Default building facing degrees
      • Unit Group - Add (Last created unit) to tempGroup
      • Set DummyLoc = (Position of (Last created unit))
      • Set tempAngle = (Angle from DummyLoc to TargetLoc)
      • Set tempDistance = ((Distance between DummyLoc and TargetLoc) - 100.00)
      • Set tempSpeed = 30.00
      • Set HandleId = (Key (Last created unit))
      • Hashtable - Save tempDamage as (Key Damage) of HandleId in hash
      • Hashtable - Save tempDistance as (Key Distance) of HandleId in hash
      • Hashtable - Save tempSpeed as (Key Speed) of HandleId in hash
      • Hashtable - Save tempAngle as (Key Angle) of HandleId in hash
      • Hashtable - Save Handle OftempUnit as (Key Unit) of HandleId in hash
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Moving Missile <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Moving Missile <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_tempPoint)
  • Moving Missile
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in tempGroup and do (Actions)
        • Loop - Actions
          • Set HandleId = (Key (Picked unit))
          • Set tempDamage = (Load (Key Damage) of HandleId from hash)
          • Set tempDistance = (Load (Key Distance) of HandleId from hash)
          • Set tempSpeed = (Load (Key Speed) of HandleId from hash)
          • Set tempAngle = (Load (Key Angle) of HandleId from hash)
          • Set tempUnit = (Load (Key Unit) of HandleId in hash)
          • Set DummyLoc = (Position of (Picked unit))
          • Set CurrentDistance = (CurrentDistance + tempSpeed)
          • Set tempPoint3 = (DummyLoc offset by tempSpeed towards tempAngle degrees)
          • Unit - Move (Picked unit) instantly to tempPoint3
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CurrentDistance Greater than or equal to tempDistance
            • Then - Actions
              • Trigger - Turn off (This trigger)
              • Unit - Cause (Picked unit) to damage tempUnit, dealing tempDamage damage of attack type Spells and damage type Normal
              • Unit - Add a 0.10 second Generic expiration timer to (Picked unit)
              • Unit Group - Remove (Picked unit) from tempGroup
              • Custom script: call RemoveLocation(udg_DummyLoc)
              • Custom script: call RemoveLocation(udg_TargetLoc)
              • Custom script: call RemoveLocation(udg_tempPoint3)
              • Set CurrentDistance = 0.00
            • Else - Actions
hope it help :D
 

Attachments

  • Triggered Firebolts.w3x
    18.9 KB · Views: 30
Last edited:

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
Venomous, I remember that I told u dont check every 0.01s since it unnecessary. Also, it can be create with Unit Indexer too. Ur trigger has a problem: When the 2 fire bolt casted at the same time, after 1 reaching the target, the other will stop.
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
Venomous, I remember that I told u dont check every 0.01s since it unnecessary. Also, it can be create with Unit Indexer too. Ur trigger has a problem: When the 2 fire bolt casted at the same time, after 1 reaching the target, the other will stop.

i will keep it my way, i'm sorry. when i read thread about this, someone said that it's okay to have a 0.01 seconds periodic if it's only temporary (less than 2 seconds to be exact). I always use 0.03s when it comes to a long period of trigger.

what's wrong with hashtable ? what will happen if i use hashtable instead of Unit Indexer ? i always use Unit Indexer as you know, but for this, i want to use hashtable for a better understanding of the trigger and less import (since Unit Indexer needs to be imported).

the chance of 2 fire bolt being cast at the same time is really rare, since it's really fast and i can't catch it up. Yes, i have met that situation twice, but it's still working as intended. it doesn't need any projectiles, you can just change the model of the firebolt. the most important thing for this is the damage based on mana of caster

if you don't trust me, download the map and test it.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
1) Would you mind if they are unclickable? This trick will make them unclickable (so they cannot be controlled by anyone), yet they will fight normally:
  • Unit - Create unit
  • Unit - Add Unknown Chaos to (last Created Unit)
  • Custom script: call UnitAddAbility( bj_lastCreatedUnit, 'Aloc' )
  • Custom script: call UnitRemoveAbility( bj_lastCreatedUnit, 'Aloc' )
I'll go over this real quick:
1) Create an ability based on "Chaos" (human\units), remove the techtree requirement and set "Data - new unit type" to the unit-type of the creep (do this for every creep-type you have).
2) When spawning creeps, just spawn the regular footman for both sides (the unit type will change anyway).
3) Now give them the chaos-ability. This will transform their unit-type to what the Chaos-ability says.
4) Add- and remove the ability "Locust" (this can only be done by JASS, but the code I've given should work properly).

When all is said and done, you've got an uncontrollable creep that will fight normally and is still owned by the correct player.


2) I haven't seen it yet, so here is the actual formula:
(Base + Number) - (Base + (Number * Sides) )​
So as the rest said, if you set Number and Sides to 1, the damage will be "Base+1 - Base+1".
Anyway, could be useful if you wanted other damage-stuff (like 1-100 damage, or 50-60 or whatever).


TwoVenomous: using 0.01 strains the game, try to avoid that :).
0.03 is still very smooth and it's 3 times slower. You can use 0.01 in some extreme cases where you want to game to respond very quickly, but 0.03 (also 0.03125) is the generally accepted norm.

Hashtables are sweet, but you only need 1 hashtable for all systems/spells. I'm trying to introduce the variable "globalHashtable" here (every time I create a system for someone else, I use that one), but doesn't seem to help a lot.
And this isn't about what 'you' do, because you won't be using that spell ;). Someone with little knowledge of hashtables will just create them all over the place, instead of keeping it to the 1 you already gave him.
 
Last edited:
Level 12
Joined
Sep 11, 2011
Messages
1,176
TwoVenomous: using 0.01 strains the game, try to avoid that :).
0.03 is still very smooth and it's 3 times slower. You can use 0.01 in some extreme cases where you want to game to respond very quickly, but 0.03 (also 0.03125) is the generally accepted norm.

Hashtables are sweet, but you only need 1 hashtable per system/spell. I'm trying to introduce the variable "globalHashtable" here (every time I create a system for someone else, I use that one), but doesn't seem to help a lot.
And this isn't about what 'you' do, because you won't be using that spell ;). Someone with little knowledge of hashtables will just create them all over the place, instead of keeping it to the 1 you already gave him.

the only sweet thing is your words, hehe :p
thanks, i will change that. i just happened to read a thread about this, and they said it's okay to use 0.01s periodic if it's only temporary. well, some said that it's dangerous. so as long as we could avoid it, we should, right ?

@Versae if you already have a hashtable on your trigger, my "Map Initialization" trigger doesn't need to be created. since you only need one hashtable for all the things on your map.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Haha, I wouldn't say it's dangerous though :D. It's just not necessary. If 2 things do the same thing but one of them requires more operations per second, you should pick the other one.
The main advantage of every 0.02 seconds is that it's easier to calculate the speed/second (0.03 is pretty annoying at that, which is the reason I use 0.03125 in JASS).

Versae: yeah, making missiles has become pretty easy with the introduction of hashtables :).

By the way: I've made a mistake in my previous post. I meant to say you only ever need 1 hashtable in your map, but I ended up saying you need 1 for every spell/system you make.
So just so you know: don't do that :). A single hashtable can support all your systems and spells (as TwoVenomous rightly said).
(Edited my previous post).
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
(since human eyes can only see about 47 frame per second).
This is wrong. Cones and Rods are analoge devices with Rods being able to detect single photons (Yes, a single photon) and cones requiring many photons. This means there is no limit to the number of samples they can produce per second next to the rate at which they replensish the sensor (very bright). They then go through a prepass filter made of various types of neuron which converts them from an analoge signal into a pulse train, which is how neurons function, before sending down the optic nerve to your brain.

This gives you the following limits to the rate of your vision.
1. The frequency of the pulse train that neurons can process.
2. The frequency response of the prepass filter that converts the analogue signal into a pusletrain.
3. Any frequency filters applied by the brain.

This all stems about because light comes in the form of single photons and not a constant stream. The random nature of photons means that averages are required which is a large part of the prepass filter in the eye itself.

Due to the differences between cones (needing many photons) and rods (needing a single photon) your actual resolution rate varies depending on where an item is in your vision. Your central vision which is entirly cones will resolve things at up to about 60 Hz (past which it is hard to spot a difference). Your edge vision which is entirly rods will resolve much higher frequencies with some saying as high as 200 Hz in the right circumstances.

You can notice this in poorly lit places where if you look at a florescent tube with your central vision it will appear as a continious light source but if you look at one with your edge vision you will notice that it is flickering on and off very quickly (which is what they actually should look like if viewed in slow motion). Same goes for old CRT displays.

The actual restriction to update smoothness in WC3 is 60 FPS as that is the average frame rate WC3 and displays work at. Anything higher will waste processing resources and anything lower will cause visual discontiuities.

Let's say he's heading to Point A, when Player interrupts it, when that happens, immediately force the unit to go to Point A again.
You need to wait until the order is issued as the event fires after the order is registered but before it is issued to the unit. This is usually done with a timer of duration 0 seconds (yes, that is a valid timeout) to allow the function to complete, order to be issued but imediatly run the re-order function.
 

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
O.O. Dr Super Good, do u really think it's necessary to say about the neutron and proton here? :)). Though it may be helpful sometimes but there's no need to make it so complicated here.
 
Status
Not open for further replies.
Top