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

[JASS] One easy question, one difficult quest

Status
Not open for further replies.
Level 14
Joined
Jul 26, 2008
Messages
1,009
Alright, I got two very easy questions.

First, how do I tell if a player is a human player? I assumed MAP_CONTROL_PLAYER_USER or w/e it is. However I just want to make sure that's right. I wasn't sure if it counted open User slots as "User" even if there's no one in them.
I simply want to make sure the unit that if the unit killed is a Human Player it rewards the killing player properly.

Second, which isn't as easy. I want a shop to sell different items/unit depending on the time of day.

I can set up the time of day change, but what I can't set up is adding and removing the items from shop stock. I've tried a number of things, none of which have worked. What's crazy about this is I have a spell in another game that you can cast on units/items and it adds them to a shop's stock.
The same command won't work here though.
(Can you even remove units/items from shop stock?)
JASS:
    if GetUnitTypeId(GetFilterUnit()) == 'nC01' or GetUnitTypeId(GetFilterUnit()) == 'grha' then
        call RemoveUnitFromStock( GetFilterUnit(), 'uC02' )
    endif

That's what I use, and it's on rect GroupEnum on bj_MapPlayable. The base unit is a shop unit. It just won't add that unit to it's stock.

Thanks :)
 
Level 11
Joined
Jun 30, 2008
Messages
580
#1

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) controller) Equal to User
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
            • Else - Actions
#2

I believe you can. Let me test some code and I'll post it for you.
 
Level 11
Joined
Jun 30, 2008
Messages
580
I tried making a test map.
And this did not work at all:

JASS:
globals
    constant unit SHOP = gg_unit_nmrk_0001
    integer i = 1
endglobals

function Actions takes nothing returns nothing
    if i == 1 then
        call RemoveItemFromStock(SHOP, 'ratf')
        call AddItemToStock(SHOP, 'pghe', 1, 1)
        set i = 2
    elseif i == 2 then
        call RemoveItemFromStock(SHOP, 'pghe')
        call AddItemToStock(SHOP, 'ratf', 1, 1)
        set i = 1
    endif
endfunction

//===========================================================================
function InitTrig_Change takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerAddAction( t, function Actions )
    call TriggerRegisterPlayerChatEvent(t, Player(0), "change", true)
endfunction
 
Status
Not open for further replies.
Top