HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need Help With Few Things

07-13-2005, 03:07 PM#1
ImNotGood
Ok the things I need help with are:

1. Timer
I want to make timer, wich shows the played game time.
(If you have played 30 min, the timer shows 30:00)

2. Item
How you make it so, that unit haves Mask of Death, and if this unit picks
another mask of death, its dropped.

Thank you already.
07-13-2005, 04:26 PM#2
ppierce
I can answer #2

One Mask of Death
Events
Unit - A unit Acquires an item
Conditions
Item-type of (Item being manipulated)) Equal to Mask of Death
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item carried by Hero in slot 1)) Equal to Mask of Death
(Item-type of (Item carried by Hero in slot 2)) Equal to Mask of Death
(Item-type of (Item carried by Hero in slot 3)) Equal to Mask of Death
(Item-type of (Item carried by Hero in slot 4)) Equal to Mask of Death
(Item-type of (Item carried by Hero in slot 5)) Equal to Mask of Death
(Item-type of (Item carried by Hero in slot 6)) Equal to Mask of Death
Then - Actions
Hero - Drop (Item being manipulated) from Hero
Else - Actions
Do nothing



Basically that's it..
07-13-2005, 04:58 PM#3
oNdizZ
that wont work ppierce couse its: if ALL CONDITIONS ARE TRUE then.. else..
07-13-2005, 05:08 PM#4
ImNotGood
You tested it? Cause it don't work for me :(
Anyway thanks
07-13-2005, 05:43 PM#5
Anitarf
1) On a 1 second periodic event, increase an integer variable (seconds) by 1, when it reaches 60, set it to 0 and increase another integer variable (minutes) by 1. Then convert these two integers to strings, if a string is only one character long then add a 0 in front, and then display the two strings with a ":" in between.

2)
Code:
Event:
    A unit acquires an item
Conditions:
    //if you want this to work for only specific items, put a condition here
Actions:
    For each Integer A from 1 to 6 do actions
        loop - actions:
            If - Then - Else multiple functions
                If - Conditions:
                    (Item being manipulated) not equal to (item carried by (hero manipulating item) in slot (Integer A))
                    (Item-type of (Item being manipulated)) equal to (Item-type of (item carried by (hero manipulating item) in slot (Integer A)))
                Then - Actions:
                    Drop (item being manipulated) from (hero manipulating item)
                    Skip remaining actions
                Else - Actions:
07-14-2005, 06:56 AM#6
ImNotGood
Could you make the answer 1) just like the answer 2)?
07-14-2005, 08:56 AM#7
Anitarf
Quote:
Originally Posted by ImNotGood
Could you make the answer 1) just like the answer 2)?
No, because it's long and tedious, but at the same time very simplistic, so it would look ugly. :P Or... ok, wait a bit...

Well, here it is, first create an integer variable array called clock. Then, copy this into your map's custom script section:
Code:
//  ------------------------------
//
//  It's a Clock
//
//  ------------------------------

function CInt2S takes integer a returns string
    if a < 10 then
        return "0"+I2S(a)
    else
        return I2S(a)
    endif
endfunction

function Clock2S takes nothing returns string
    return ( CInt2S(udg_clock[3]) + ":" + CInt2S(udg_clock[2]) + ":" + CInt2S(udg_clock[1]) )
endfunction

function ClockTick takes nothing returns nothing
    set udg_clock[1] = udg_clock[1] + 1
    if udg_clock[1] >= 60 then
        set udg_clock[1] = 0
        set udg_clock[2] = udg_clock[2] + 1
        if udg_clock[2] >= 60 then
            set udg_clock[2] = 0
            set udg_clock[3] = udg_clock[3] + 1
        endif
    endif
endfunction

function ClockSecond takes nothing returns nothing
    call ClockTick()
endfunction

function ClockInit takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( t, 1.00 )
    call TriggerAddAction( t, function ClockSecond )
    set t = null
endfunction
Then, you need the following trigger:
Code:
Initialize clock
    Events
        Map initialization
    Conditions
    Actions
        Custom script:   call ClockInit()
And that's it, use the function Clock2S() to get your clock as a string, for example:
Code:
display clock
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Custom script:   call DisplayTimedTextToPlayer( Player(0), 0, 0, 1, Clock2S() )
You can use the string anywhere, as a game massage like in the example, or in a multiboard. You can write your own ClockUpdate function and call it from the ClockSecond function after it calls the ClockTick function.
07-14-2005, 06:06 PM#8
ImNotGood
Im confused :D too confused so I think I leave clock thing :D
Thx anyway
07-14-2005, 08:26 PM#9
Guest
It's not that hard.. just open your map's trigger editor, click at the top of the treeview it'll have the name of your map. Then copy and paste the functions in there. Then make the triggers below. Make a global integer array by pressing on the little yellow X button called clock and it should be real easy.
07-15-2005, 02:33 AM#10
weaaddar
Jass is japanese to most people, I generally avoid helping people because of this attitude.
07-15-2005, 02:37 AM#11
Guest
It's sad how fast people give up. He didn't even ask one question about how to implement it.. just immediately gave up.
07-15-2005, 08:59 AM#12
Anitarf
Quote:
Originally Posted by eclips)e
It's sad how fast people give up. He didn't even ask one question about how to implement it.. just immediately gave up.
Indeed. The irony is that it's a lot easier to implement than GUI, you just have to copy the text, instead of recreating the triggers like in GUI. Besides, how are you going to move forward in mapmaking if you avoid challenges like this? It doesn't require you to learn JASS... just to learn implementing it. There are many great scripts out there avaliable for you to use that are not in GUI.

Anyway, if you change your mind, here's the clock map.
07-15-2005, 09:25 AM#13
ImNotGood
Deleted