• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[General] Negative Movment Speed Bonus per Item

Status
Not open for further replies.
Level 8
Joined
Mar 23, 2007
Messages
302
Hi, i want to give a unit -50 movementspeed for every "big Stone Armor" it carries, how should i do it?

I tried -50 in a cloned Boots of Speed ability, but it just didnt work.

It did 0 reduction.

pls Help
 
Level 2
Joined
Jul 2, 2010
Messages
20
click it, press shift + enter add - then now put what u want

or

1. go to "file > preferences > and check the "allow negative number in object editor"

2. go and find the ability in the object editor and put the "-" infront of the number
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Untitled Trigger 010
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
    • Actions
      • Unit - Set (Triggering unit) movement speed to ((Current movement speed of (Triggering unit)) - 50.00)
Increase when item is lost. Give the item some ability that does nothing if you want to apply a buff icon.
 
Level 8
Joined
Mar 23, 2007
Messages
302
Hi, Ok i tried both methodes, and it just did not work. Any futher ideas?

I set the Stacking to true/false, and when carring 6 boots of speed, it still gives only the bonus/malus from 1.

The trigger methode just works for 1 boot only too -.-

greets
 
Level 4
Joined
Nov 24, 2010
Messages
61
  • SlowLoop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Set TempLoc1 = (Position of SlowedUnit)
      • Set TempLoc2 = (Position of SlowDummy)
      • Set TempLoc = (TempLoc1 offset by (1.00 x StackTime) towards (Angle from TempLoc1 to TempLoc2) degrees)
      • Custom script: call SetUnitX (udg_SlowedUnit, GetLocationX (udg_TempLoc))
      • Custom script: call SetUnitY (udg_SlowedUnit, GetLocationY (udg_TempLoc))
      • Unit - Move SlowDummy instantly to TempLoc
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: call RemoveLocation(udg_TempLoc1)
      • Custom script: call RemoveLocation(udg_TempLoc2)
One of slow kind :p
However if SlowedUnit has too much slow item, it can move backward!
 
Level 8
Joined
Mar 23, 2007
Messages
302
A yes, i changed it, cuz i used default movespeed. Now it works, but unfortunatly when the unit picks the item up while in a aura that gives ms, it will remove from (x+%) or not ?

0.02 just for a slowing item is a bit to much :)
 
Level 8
Joined
Mar 23, 2007
Messages
302
Thx for all your help, i was able to fix it.
As for futher information:
Changing the units movespeed does not calculate any %gain in it, thats why this code is able to work good with any ingame auras and & gain.

JASS:
scope BigScaleSlow initializer Init
// gain it
private function Conditions_A takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == 'rde4'
endfunction

private function Actions_A takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local item i = GetManipulatedItem()
    local integer c = 0
    local integer itemIndex = UnitInventorySize(u)
    
    loop
    exitwhen 0 > itemIndex 
        if UnitItemInSlot(u,itemIndex) != null and GetItemTypeId(i) == 'rde4' then
            set c = c + 1
        endif
        
    set itemIndex = itemIndex - 1
    endloop
    
    if GetTriggerEventId() == EVENT_PLAYER_UNIT_DROP_ITEM then
    set c = c - 1
    endif 
    
    call SetUnitMoveSpeed(u,GetUnitDefaultMoveSpeed(u)-50*c)

    set u = null
    set i = null
endfunction


private function Init takes nothing returns nothing
    local trigger trg = CreateTrigger()
    
    call TriggerAddAction(trg, function Actions_A)
    call TriggerAddCondition(trg, Condition(function Conditions_A))
    call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_DROP_ITEM )
    //call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_SELL_ITEM )
    //call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_PAWN_ITEM )    
    set trg = null
endfunction
endscope
 
Level 8
Joined
Mar 23, 2007
Messages
302
You would mind in doing this to show me how exaclty you mean? As when i would do it, i would always create locals, when condition triggers or not, what would be wrong i think. greets
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
He means this:

JASS:
scope BigScaleSlow initializer Init

private function Actions_A takes nothing returns nothing
    local unit u
    local item i
    local integer c = 0
    local integer itemIndex
    
    if GetItemTypeId(GetManipulatedItem()) == 'rde4' then
    set u = GetTriggerUnit()
    set i = GetManipulatedItem()
    set itemIndex =  = UnitInventorySize(u)
    loop
    exitwhen 0 > itemIndex 
        if UnitItemInSlot(u,itemIndex) != null and GetItemTypeId(i) == 'rde4' then
            set c = c + 1
        endif
        
    set itemIndex = itemIndex - 1
    endloop
    
    if GetTriggerEventId() == EVENT_PLAYER_UNIT_DROP_ITEM then
    set c = c - 1
    endif 
    
    call SetUnitMoveSpeed(u,GetUnitDefaultMoveSpeed(u)-50*c)

    set u = null
    set i = null
    endif
endfunction


private function Init takes nothing returns nothing
    local trigger trg = CreateTrigger()
    
    call TriggerAddCondition(trg, Condition(function Actions_A))
    call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_DROP_ITEM )
    //call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_SELL_ITEM )
    //call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_PAWN_ITEM )    
    set trg = null
endfunction
endscope



It is not necessary to do this.
 
Status
Not open for further replies.
Top