wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 01-22-2010, 06:19 AM   #1
Sunwarrior25
I say!
 
Sunwarrior25's Avatar
 
Join Date: Jul 2007
Posts: 366

Submissions (3)

Sunwarrior25 will become famous soon enough (30)Sunwarrior25 will become famous soon enough (30)

Send a message via Yahoo to Sunwarrior25
Default Is it possible to check to see if...

...the target of an ability is a Unit or a Destructible (for single target spells), or would I have to do what TKoK did and make seperate abilities for each thing? (I'm trying to get one "Interact" ability for both functions).
__________________
Table:
Currently:
- Fooling around with various things.
- Staying up WAY too late.
- Fooling around with various things.
Other places to find me:
YouTube
deviantART
Twitter
uStream
Sunwarrior25 is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 01-22-2010, 08:02 AM   #2
Anachron
User
 
Anachron's Avatar
 
Join Date: Mar 2009
Posts: 1,079

Anachron will become famous soon enough (51)Anachron will become famous soon enough (51)

Default

Here you go
Collapse JASS:
if GetSpellTargetDestructable() != null then
    
    elseif GetSpellTargetUnit() != null then
    
    endif
__________________
CustomInventory [Discussion - Download] - Got Directors Cut!
CustomMissle [Discussion - [Download (not yet)] - In development!
Other systems [Spawn System] [Move System] [CustomBar] [SpellBar]
Anachron is offline   Reply With Quote
Old 01-22-2010, 06:24 PM   #3
Sunwarrior25
I say!
 
Sunwarrior25's Avatar
 
Join Date: Jul 2007
Posts: 366

Submissions (3)

Sunwarrior25 will become famous soon enough (30)Sunwarrior25 will become famous soon enough (30)

Send a message via Yahoo to Sunwarrior25
Default

Thank you! (Opens Notepad)

EDIT: It's been several months since I've seen code like this... Should I start the trigger on a 'casts an ability' event or 'is issued an order targeting an object'?
__________________
Table:
Currently:
- Fooling around with various things.
- Staying up WAY too late.
- Fooling around with various things.
Other places to find me:
YouTube
deviantART
Twitter
uStream

Last edited by Sunwarrior25 : 01-22-2010 at 06:45 PM.
Sunwarrior25 is offline   Reply With Quote
Old 01-22-2010, 07:05 PM   #4
Themerion
Brahms-fan
 
Themerion's Avatar
 
Join Date: Jan 2006
Posts: 642

Submissions (2)

Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)

Default

Starts effect of ability, unless you want to interrupt it before it's cast.
__________________
Submissions::
(v)JASS Tutorial
Covers how to make fast and safe coding for common tasks in vJASS/JASS.
Creep Respawn System
It has never been easier to respawn creep groups...
Themerion is offline   Reply With Quote
Old 01-22-2010, 07:09 PM   #5
Sunwarrior25
I say!
 
Sunwarrior25's Avatar
 
Join Date: Jul 2007
Posts: 366

Submissions (3)

Sunwarrior25 will become famous soon enough (30)Sunwarrior25 will become famous soon enough (30)

Send a message via Yahoo to Sunwarrior25
Default

Alright. Do I have to add anything in the parentheses in the code Anachron posted?
__________________
Table:
Currently:
- Fooling around with various things.
- Staying up WAY too late.
- Fooling around with various things.
Other places to find me:
YouTube
deviantART
Twitter
uStream
Sunwarrior25 is offline   Reply With Quote
Old 01-22-2010, 07:19 PM   #6
Themerion
Brahms-fan
 
Themerion's Avatar
 
Join Date: Jan 2006
Posts: 642

Submissions (2)

Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)Themerion has a spectacular aura about (114)

Default

Nope.
__________________
Submissions::
(v)JASS Tutorial
Covers how to make fast and safe coding for common tasks in vJASS/JASS.
Creep Respawn System
It has never been easier to respawn creep groups...
Themerion is offline   Reply With Quote
Old 01-22-2010, 07:20 PM   #7
Sunwarrior25
I say!
 
Sunwarrior25's Avatar
 
Join Date: Jul 2007
Posts: 366

Submissions (3)

Sunwarrior25 will become famous soon enough (30)Sunwarrior25 will become famous soon enough (30)

Send a message via Yahoo to Sunwarrior25
Default

Alright. Here's what I've got. Gonna test to see if it works:
Collapse JASS:
function Trig_Interact_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A600' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Interact_Actions takes nothing returns nothing

if GetSpellTargetDestructable() != null then

        call ConditionalTriggerExecute( gg_trg_DestCheck )

    elseif GetSpellTargetUnit() != null then

        call ConditionalTriggerExecute( gg_trg_UnitCheck )

    endif

endfunction

//===========================================================================
function InitTrig_Interact takes nothing returns nothing
    set gg_trg_Interact = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Interact, Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Interact, Condition( function Trig_Interact_Conditions ) )
    call TriggerAddAction( gg_trg_Interact, function Trig_Interact_Actions )
endfunction

EDIT: It works, but the ability itself is checking to see if destructibles (like crates) are occupied by owls... What should I set the 'targets allowed' to?

EDIT2: Should I use Channel instead of Purge as a base?
__________________
Table:
Currently:
- Fooling around with various things.
- Staying up WAY too late.
- Fooling around with various things.
Other places to find me:
YouTube
deviantART
Twitter
uStream

Last edited by Sunwarrior25 : 01-22-2010 at 07:39 PM.
Sunwarrior25 is offline   Reply With Quote
Old 01-22-2010, 08:28 PM   #8
Michael Peppers
Lepus?
 
Michael Peppers's Avatar
 
Join Date: Jan 2009
Posts: 1,308

Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)

Default

Quote:
Originally Posted by Sunwarrior25
Alright. Here's what I've got. Gonna test to see if it works:
Collapse JASS:
function Trig_Interact_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A600' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Interact_Actions takes nothing returns nothing

if GetSpellTargetDestructable() != null then

        call ConditionalTriggerExecute( gg_trg_DestCheck )

    elseif GetSpellTargetUnit() != null then

        call ConditionalTriggerExecute( gg_trg_UnitCheck )

    endif

endfunction

//===========================================================================
function InitTrig_Interact takes nothing returns nothing
    set gg_trg_Interact = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Interact, Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Interact, Condition( function Trig_Interact_Conditions ) )
    call TriggerAddAction( gg_trg_Interact, function Trig_Interact_Actions )
endfunction

EDIT: It works, but the ability itself is checking to see if destructibles (like crates) are occupied by owls... What should I set the 'targets allowed' to?

EDIT2: Should I use Channel instead of Purge as a base?

Uhm, can we see UnitCheck and DestCheck?
Targets allowed should be: "Air, Land, Neutral, Ally, Alive, Mechanical unit, Friend, Organic, Object (and *maybe* Enemy)" (if I got what you mean)

Anyway...
Collapse JASS:
function Trig_Interact_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 'A600')
endfunction
It's better this way
__________________
Projects:Tutorials: Competitive AI Step by Step with AI Editor (Pending)
Resources: [AI Script] Michael Peppers's Melee AI template (Pending)

Last edited by Michael Peppers : 01-22-2010 at 08:33 PM.
Michael Peppers is offline   Reply With Quote
Old 01-22-2010, 08:52 PM   #9
Sunwarrior25
I say!
 
Sunwarrior25's Avatar
 
Join Date: Jul 2007
Posts: 366

Submissions (3)

Sunwarrior25 will become famous soon enough (30)Sunwarrior25 will become famous soon enough (30)

Send a message via Yahoo to Sunwarrior25
Default

NOTE: You have been redirected in order for our attachments to be made available to you. This will only last two minutes; these measures where taken to avoid hotlinking and bandwidth theft.
To avoid these restrictions Log in or Register

DestCheck and UnitCheck are currently both GUI triggers with a debug message. I'll expand them later to have the loops/arrays and stuff that determine what messages/events the player gets by clicking on this or that unit. (Checking first for specific units/destructibles, and then for unit/destructible-type if the 'Interact' ability isn't used on any specific unit (and maybe finishing it off with a "..." message to the player if I forgot to add a unit/destructible-type to the list.))
Both of these GUI triggers are initially off.
Trigger:
Collapse DestCheck
Events
Conditions
Collapse Actions
Game - Display to (All players) the text: You are interacting...
Collapse UnitCheck
Events
Conditions
Collapse Actions
Game - Display to (All players) the text: You are talking to ...

EDIT: Like this? Click image for larger version

Name:	TargetOptions.jpg
Views:	23
Size:	24.3 KB
ID:	47612
Collapse JASS:
function Trig_Interact_Conditions takes nothing returns boolean
    return (GetSpellAbilityId() == 'A600')
endfunction

function Trig_Interact_Actions takes nothing returns nothing

if GetSpellTargetDestructable() != null then
        set udg_CheckDest = GetSpellTargetDestructable()
        call ConditionalTriggerExecute( gg_trg_DestCheck )

    elseif GetSpellTargetUnit() != null then
        set udg_CheckUnit = GetSpellTargetUnit()
        call ConditionalTriggerExecute( gg_trg_UnitCheck )

    endif

endfunction

//===========================================================================
function InitTrig_Interact takes nothing returns nothing
    set gg_trg_Interact = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Interact, Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Interact, Condition( function Trig_Interact_Conditions ) )
    call TriggerAddAction( gg_trg_Interact, function Trig_Interact_Actions )
endfunction
__________________
Table:
Currently:
- Fooling around with various things.
- Staying up WAY too late.
- Fooling around with various things.
Other places to find me:
YouTube
deviantART
Twitter
uStream

Last edited by Sunwarrior25 : 01-22-2010 at 09:00 PM.
Sunwarrior25 is offline   Reply With Quote
Old 01-22-2010, 09:09 PM   #10
Michael Peppers
Lepus?
 
Michael Peppers's Avatar
 
Join Date: Jan 2009
Posts: 1,308

Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)

Default

Quote:
Originally Posted by Sunwarrior25
DestCheck and UnitCheck are currently both GUI triggers with a debug message. I'll expand them later to have the loops/arrays and stuff that determine what messages/events the player gets by clicking on this or that unit. (Checking first for specific units/destructibles, and then for unit/destructible-type if the 'Interact' ability isn't used on any specific unit (and maybe finishing it off with a "..." message to the player if I forgot to add a unit/destructible-type to the list.))
Both of these GUI triggers are initially off.
Trigger:
Collapse DestCheck
Events
Conditions
Collapse Actions
Game - Display to (All players) the text: You are interacting...
Collapse UnitCheck
Events
Conditions
Collapse Actions
Game - Display to (All players) the text: You are talking to ...

Ah, ok
Quote:
Originally Posted by Sunwarrior25
EDIT: Like this? Attachment 47612
Uhm... may bad, uncheck debris, check decoration, but maybe destructible interaction is simply hardcoded in some skills, gotta test.
Quote:
Originally Posted by Sunwarrior25
Collapse JASS:
function Trig_Interact_Conditions takes nothing returns boolean
    return (GetSpellAbilityId() == 'A600')
endfunction

function Trig_Interact_Actions takes nothing returns nothing

if GetSpellTargetDestructable() != null then
        set udg_CheckDest = GetSpellTargetDestructable()
        call ConditionalTriggerExecute( gg_trg_DestCheck )

    elseif GetSpellTargetUnit() != null then
        set udg_CheckUnit = GetSpellTargetUnit()
        call ConditionalTriggerExecute( gg_trg_UnitCheck )

    endif

endfunction

//===========================================================================
function InitTrig_Interact takes nothing returns nothing
    set gg_trg_Interact = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Interact, Player(0), EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Interact, Condition( function Trig_Interact_Conditions ) )
    call TriggerAddAction( gg_trg_Interact, function Trig_Interact_Actions )
endfunction
Fine, also use TriggerExecute() instead of ConditionalTriggerExecute(), it's faster... well, unless you need conditions later on
__________________
Projects:Tutorials: Competitive AI Step by Step with AI Editor (Pending)
Resources: [AI Script] Michael Peppers's Melee AI template (Pending)
Michael Peppers is offline   Reply With Quote
Old 01-22-2010, 09:30 PM   #11
Sunwarrior25
I say!
 
Sunwarrior25's Avatar
 
Join Date: Jul 2007
Posts: 366

Submissions (3)

Sunwarrior25 will become famous soon enough (30)Sunwarrior25 will become famous soon enough (30)

Send a message via Yahoo to Sunwarrior25
Default

Quote:
Uhm... may bad, uncheck debris, check decoration, but maybe destructible interaction is simply hardcoded in some skills, gotta test.
I would, but crates/cages/levers/gates are classified as "debris" by default (probably meaning they can be attacked), whereas the thrones (Frozen and King's), Rockin' Arthas, the Naga Ruins Circle, and the custom grass doodads I'm using are classified as decoration.
Quote:
also use TriggerExecute() instead of ConditionalTriggerExecute(), it's faster... well, unless you need conditions later on
I will need conditions later on

EDIT: Yeah, tested it ingame with "debris" checked...
Click image for larger version

Name:	WC3ScrnShot_012210_163424_01.jpg
Views:	24
Size:	119.3 KB
ID:	47614
That crate is neither a tree, nor does it contain an owl...

EDIT2: I am so totally going to add an easter egg of this when we finally get this working...

EDIT3: I was hoping it wouldn't come to this thought, but I may have to make a dummy unit for every destructible (not counting trees) in my map...
__________________
Table:
Currently:
- Fooling around with various things.
- Staying up WAY too late.
- Fooling around with various things.
Other places to find me:
YouTube
deviantART
Twitter
uStream

Last edited by Sunwarrior25 : 01-22-2010 at 09:46 PM.
Sunwarrior25 is offline   Reply With Quote
Old 01-22-2010, 10:03 PM   #12
Michael Peppers
Lepus?
 
Michael Peppers's Avatar
 
Join Date: Jan 2009
Posts: 1,308

Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)

Default

Quote:
Originally Posted by Sunwarrior25
EDIT: Yeah, tested it ingame with "debris" checked...
Attachment 47614
That crate is neither a tree, nor does it contain an owl...

EDIT2: I am so totally going to add an easter egg of this when we finally get this working...

EDIT3: I was hoping it wouldn't come to this thought, but I may have to make a dummy unit for every destructible (not counting trees) in my map...
Whoops, so with "owl" you meant... "owl" =D

Check tree... you may want to change base ability, then... maybe "Sentinel" would be the best base ability for it.
__________________
Projects:Tutorials: Competitive AI Step by Step with AI Editor (Pending)
Resources: [AI Script] Michael Peppers's Melee AI template (Pending)

Last edited by Michael Peppers : 01-22-2010 at 10:03 PM.
Michael Peppers is offline   Reply With Quote
Old 01-22-2010, 10:47 PM   #13
Sunwarrior25
I say!
 
Sunwarrior25's Avatar
 
Join Date: Jul 2007
Posts: 366

Submissions (3)

Sunwarrior25 will become famous soon enough (30)Sunwarrior25 will become famous soon enough (30)

Send a message via Yahoo to Sunwarrior25
Default

Sentinel works!
... to a point: Click image for larger version

Name:	WC3ScrnShot_012210_174301_01.jpg
Views:	22
Size:	121.0 KB
ID:	47615
It now plays the "You are interacting..." message, but places an owl on that destructible. Trying to use the ability on the same destructible twice is a no-go due to an owl already being in that tree crate.
__________________
Table:
Currently:
- Fooling around with various things.
- Staying up WAY too late.
- Fooling around with various things.
Other places to find me:
YouTube
deviantART
Twitter
uStream
Sunwarrior25 is offline   Reply With Quote
Old 01-22-2010, 11:02 PM   #14
Michael Peppers
Lepus?
 
Michael Peppers's Avatar
 
Join Date: Jan 2009
Posts: 1,308

Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)Michael Peppers is a jewel in the rough (188)

Default

Quote:
Originally Posted by Sunwarrior25
Sentinel works!
... to a point: Attachment 47615
It now plays the "You are interacting..." message, but places an owl on that destructible. Trying to use the ability on the same destructible twice is a no-go due to an owl already being in that tree crate.
Erm... did you set the Owl number to 0?
__________________
Projects:Tutorials: Competitive AI Step by Step with AI Editor (Pending)
Resources: [AI Script] Michael Peppers's Melee AI template (Pending)
Michael Peppers is offline   Reply With Quote
Old 01-22-2010, 11:15 PM   #15
Sunwarrior25
I say!
 
Sunwarrior25's Avatar
 
Join Date: Jul 2007
Posts: 366

Submissions (3)

Sunwarrior25 will become famous soon enough (30)Sunwarrior25 will become famous soon enough (30)

Send a message via Yahoo to Sunwarrior25
Default

Yes. I now have infinite owls.
__________________
Table:
Currently:
- Fooling around with various things.
- Staying up WAY too late.
- Fooling around with various things.
Other places to find me:
YouTube
deviantART
Twitter
uStream
Sunwarrior25 is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 07:22 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services