HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Several question regarding spells, triggers, unit editing

05-28-2004, 07:18 PM#1
SektorGaza
Run mode ability

I need to make a running ability which will work when the ability "running mode" is clicked, the unit runs faster and his mana drains. The running mode will be clicked off when either there's not enough mana to continue or the running mode is clicked off and the unit will walk regular speed.

Ok, here's what i tried. I tried to make immolation ability and when clicked, the mana would go down which in triggers I would add a speed aura.
This method is buggy since it takes time for aura to dissapear and appear and kills the whole thing.

Then I tried to use the ability from the speed potion, but then I don't know how to trigger for mana to decrease and switch off ability when mana completes.

Well any idea or complete idea would be appreciated.


Ok, questions number 2

Is it possible to make a shop controled by player which will allow other players to buy items while the money goes to the owner of the shop? And when pawned items, the money is taken from shop owner..

If not, does anyone have any good ideas for such merchant trading. I need
this for my current map where my merchant will be able to produce certain items and put them up for trade. And I don't want to simply put out the items on the ground or inventory so that the players can see what the items are and then ask the merchant for trade.


Question number 3

I need this for the same map. I need to be able to pawn items to certain units, but the unit doesn't have an inventory, nor the unit is a shop of any kind (doesn't point arrow when you come close to them).

I need this for my drug dealing work. Basically you can run around selling drugs to NPC, etc.

I have stable ideas about this on, but it would certainly make it easier if I can just sell the items likea shop.

Thank you for your input.


edit: One mroe question regarding JaSS

I need to use local variable in certain function, but can't get it to work
fist i make

local integer pNUM =getTriggering Player etc. etc.

but then I need to use it in GUI for array index. And it gives me all kinds of errors when I just put this integer in the array index.

What am I doing wrong?
05-28-2004, 08:49 PM#2
johnfn
Ok then... This shouldnt be too hard...

Run mode ability:
Instead of going to all that work, make another unit with faster speed and have a trigger take away mana every second. Thats it :-)

Second question. It can be done by triggers, I think. You should use generic unit events, like a unit sells and item and a unit buys an item, to determine who gets the money.

Question #3: I cant think of any way to do this except use chat events like -sell 02 (representing the slot). Hmmm...

JASS question: shouldnt that be a player variable? either that or you want to convert it to an integer, like so: GetConvertedPlayerId(GetTriggerPlayer())
05-28-2004, 10:18 PM#3
Milkman
Question 1: Do a dummy abilty that can be turned on and off and when its on, start a trigger that has a 0.5 second periodic event that takes away for instance 5 mana. OR, make the spell a transform spell, but with no art just transform into another unit with higher speed and then you add the -mana triggers. A periodic event is never good to have, i know that but since it will only be on during the small time that the spell is going on it wont be too much to worry about. I hope.
05-28-2004, 10:34 PM#4
SektorGaza
1. No no, when unit is replaced, it takes some time. I need idea with no unit replacement since this skill will be used duing a race and can't take up time at all. (maybe even unaffect players walking while clicking the skill)
But thanx guys

2. Alrite, thanx I'll try that

3.Ok, nevermind, i'll think of somethin

4. I meant getplayernumber etc.. don't worry it's an integer
Just don't know if I am allowed to use the local integer inside a trigger without a separate function that calls for it. Since triggers have different functions, and I need to use the integer in them, do I have to use a function to ask for my local integer?
Ok, if this won't get answered, I will post my errors.
05-29-2004, 12:01 AM#5
johnfn
Quote:
Originally Posted by SektorGaza
1. No no, when unit is replaced, it takes some time. I need idea with no unit replacement since this skill will be used duing a race and can't take up time at all. (maybe even unaffect players walking while clicking the skill)
But thanx guys

Incorrect. It takes virtually no time (none detectable by you, anyway) People use this for spells all the time. Try it out and if you dont like it (maybe Im wrong, I dunno) then you can always use the trigger to increase movement speed...
05-29-2004, 12:14 AM#6
SektorGaza
if this was a spell while the unit is standing, i would have no problems, but
it's while the unit is running, I can't have it to stop, then change unit, then to go on.. and during that race the button would have to be clicked many times, switched off back and forth, I pretty much know it wouldn't work..

however, I will try it and tell u
05-29-2004, 03:22 AM#7
Shimrra
Could this trigger work? "Set Variable[(Player number of (PlayerObject))] = Value"

If not, convert the entire trigger to Jass. Create the local as the first thing in the actions part. Try, "local integer pNUM = GetConvertedPlayerId(PlayerObject())" Then, when the time comes, use "set VarName = Var2Name[pNUM]"

NOTE: PlayerObject represents a player object like Triggering Player, Owner of Unit, etcetera. Use whichever is appropriate to your trigger.
05-29-2004, 06:25 AM#8
SektorGaza
Welll ok, let me explain what the trigger itself is.

It's a trigger that picks up when a player hero dies. I need it for revival.
The truth be told, I don't really need to use local ints here, but since I'm
learning Jass a bit, this is the first trigger I wanted to use local for simple
reason to minimise all the damn clicking in GUI.

ok, on to the trigger

this is the Jass i input at the beginning of GUI trigger

local integer pNum= GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))

and then as trigger goes along , the first error i get,well actually bunch of errors, so i will post the whole trigger converted into jass

Code:
 // Trigger: Hero Dies
//===========================================================================
function Trig_Hero_Dies_Conditions takes nothing returns boolean
    if ( not ( IsUnitType(GetDyingUnit(), UNIT_TYPE_HERO) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Hero_Dies_Func002Func001C takes nothing returns boolean
    if ( not ( udg_status_Bandit[returninteger(pNum)] > 1 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Hero_Dies_Func002C takes nothing returns boolean
    if ( not ( udg_PlayersChosenCareers[returninteger(pNum)] == 1 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Hero_Dies_Actions takes nothing returns nothing
    local integer pNum= GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))
    if ( Trig_Hero_Dies_Func002C() ) then
        if ( Trig_Hero_Dies_Func002Func001C() ) then
            call DisplayTimedTextToPlayer( ConvertedPlayer(returninteger(pNum)), 0, 0, 10.00, "TRIGSTR_121" )
            call TriggerSleepAction( 10.00 )
            call ReviveHeroLoc( GetDyingUnit(), GetRectCenter(gg_rct_Rect_013), false )
        else
            call RemoveUnit( GetDyingUnit() )
            call CreateNUnitsAtLoc( 1, 'e001', ConvertedPlayer(returninteger(pNum)), GetPlayerStartLocationLoc(ConvertedPlayer(returninteger(pNum))), bj_UNIT_FACING )
        endif
    else
    endif
endfunction

//===========================================================================
function InitTrig_Hero_Dies takes nothing returns nothing
    set gg_trg_Hero_Dies = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(0), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(1), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(2), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(3), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(4), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(5), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(6), EVENT_PLAYER_UNIT_DEATH )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Hero_Dies, Player(7), EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Hero_Dies, Condition( function Trig_Hero_Dies_Conditions ) )
    call TriggerAddAction( gg_trg_Hero_Dies, function Trig_Hero_Dies_Actions )
endfunction

notice lines like
if ( not ( udg_status_Bandit[returninteger(pNum)] > 1 ) ) then

where I insterted pNum in the index of the array.. and i get errors here and all other bunch of players.