HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unit acquires an item

05-15-2007, 10:52 PM#1
DarthRevansith
I want only "Arthas" to be able to get a item, if the unit is not arthas to display a text message in the middle botton os creen in that yellow message saying that only arthas can geet the item.
and i want you guys to take a look at the trigger:
is it leakless ?
will it work ?
i don´t know if i the player group that i set will work, neither the clean in the variable, cus it´s saying to clean the point variable, but it isnt a point, so what should i use ?

Trigger:
arthas scepter
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-type of (Item being manipulated)) Equal to Aghanim's Scepter
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Triggering unit)) Not equal to Arthas (Lich King)
Collapse Then - Actions
Hero - Drop (Item being manipulated) from (Triggering unit)
Set PlayerOwnerOfScepter = (Player group((Owner of (Triggering unit))))
Game - Display to PlayerOwnerOfScepter the text: Only Arthas can use...
Custom script: call RemoveLocation(udg_PlayerOwnerOfScepter)
Collapse Else - Actions
Do nothing

thanks,
05-16-2007, 12:39 AM#2
hobo
Why not display text to player rather than force?

Trigger:
Game - Display to (Triggering player), at offset (0.00, 0.00) the text: No Item 4 you

Players don't leak, undestroyed forces do, and I believe displaytexttoforce needs to have the force destroyed after as the function doesn't do it. SO rather than mess with that, lets just skip it and use Display Text to Player.

Trigger:
arthas scepter
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-type of (Item being manipulated)) Equal to Aghanim's Scepter
Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Triggering unit)) Not equal to Arthas (Lich King)
Collapse Then - Actions
Hero - Drop (Item being manipulated) from (Triggering unit)
Game - Display to (Triggering player), at offset (0.00, 0.00) the text: Only Arthas can use...
Collapse Else - Actions
Do nothing
05-16-2007, 12:44 AM#3
DarthRevansith
is there a trigger like this ? as i can see there isn´t
05-16-2007, 12:49 AM#4
MercyfulJester
Trigger:
Game - Display to (Player group((Owner of (Hero manipulating item)))) the text: Text

Edit: Rofl, Hobo just edited. Well, he got it wrong though.
05-16-2007, 12:50 AM#5
hobo
Go to New Action, then Pick Game as action type, the first option is display text to player and it defaults to triggering player. nice eh?

If you want to get really fancy put the message between these letters |cffffcc00 --here-- |r

should look like this : |cffffcc00This message is error yellow|r

you can also set the offset to the center of the screen but different resolutions move it around so its not exactally worth it.
05-16-2007, 12:52 AM#6
MercyfulJester
Yeah, but is it the player that does the triggering? (answer: no)
05-16-2007, 12:55 AM#7
DarthRevansith
well it is not that easy for me, take a look at the iamge, it isnt the first one.

and ill try the new action you posted, but should i rvome the variables ?
Attached Images
File type: jpgimagem.JPG (48.1 KB)
05-16-2007, 12:57 AM#8
hobo
Jester The GetTriggerPlayer() Jass Function Returns a variable that is set when an event triggers. In a unitissuedorder event GetTriggerPlayer() is set to OwnerofUnit(GetTriggerUnit()) already.

EDIT: aww damn sorry about that Darth...
http://www.wc3campaigns.net/showthread.php?t=90999
Download a real worldeditor I'm using a jassnewgen3 hacked UMSWE 4.1.

Heres a custom script call for it

call DisplayTextToPlayer( GetTriggerPlayer(), 0, 0, "|cffffcc00Replace this with your error message|r" )
05-16-2007, 01:00 AM#9
DarthRevansith
i didn´t unterstand a thing, only JASS, that i´m not good.
05-16-2007, 01:02 AM#10
MercyfulJester
I'm pretty sure that it doesn't work since I've had trouble with it before. I'll test this now.

Edit: it actually works, pretty sweet.
05-16-2007, 01:08 AM#11
hobo
Trigger:
arthas scepter
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(Item-type of (Item being manipulated)) Equal to Aghanim's Scepter
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Triggering unit)) Not equal to Arthas (Lich King)
Then - Actions
Hero - Drop (Item being manipulated) from (Triggering unit)
custom script: call DisplayTextToPlayer( GetTriggerPlayer(), 0, 0, "|cffffcc00Replace this with your error message|r" )
Collapse Else - Actions
Do nothing



Jester: IT works for most events but not all, should work for all unit events. Heck yeah it's sweet, Since I switched to JASS I've learned the awesomest shorcuts!
05-16-2007, 01:10 AM#12
DarthRevansith
Quote:
Originally Posted by MercyfulJester
Trigger:
Game - Display to (Player group((Owner of (Hero manipulating item)))) the text: Text

Edit: Rofl, Hobo just edited. Well, he got it wrong though.

yeah, it works. thanks and +rep for you.

thanks too hobo, but actually you didn´t made me fix it, keep helping people.
05-16-2007, 01:14 AM#13
hobo
NO NO NO NO

The problem is DisplaytoPlayer instead of DisplaytoPlayerGROUP
see the group? Its bad bad bad! No group! just one player. Display to player group like that creates a group then sends a message to it but it doesn't destroy the group! That means it leaks..... thats bad. Display to player doesn't leak...

Get it yet?

Trigger:
custom script: call DisplayTextToPlayer( GetTriggerPlayer(), 0, 0, "|cffffcc00Replace this with your error message|r" )

is what you want.... I promise

---------------------------------------------------------------

On another note you tried to removelocation on your playergroup in the original trigger which makes no sense you wanted :

Trigger:
custom script: call DestroyForce(udg_PlayerOwnerOfScepter)

But lets display text to a single player instead of a player group (which is actually called a force) as much as possible. Better that way!
05-16-2007, 01:23 AM#14
DarthRevansith
Quote:
Originally Posted by DarthRevansith
yeah, it works. thanks and +rep for you.

thanks too hobo, but actually you didn´t made me fix it, keep helping people.

that leaks ???? O NOOOOOOOOOOOOOOOOOO -REP -REP -REP ( kiddng) !!!!!

and does your trigger work hobo, but where can i see where all the custom script funcions are ? why don´t blizz make a normal "selectionable" with them ??

and by the way, cya tomorrow, sleeping now... late here in Brazil.
05-16-2007, 01:28 AM#15
Devouring-One
I believe hobo is correct. Leaks are bad, avoid them like the plague. Besides, it seems more logical to display it to the person who picked, or attempted to pick up the item rather than the whole team.

Blizz made a list of some of the functions, this is called GUI. It is what you are using now. I would hardly call GUI "normal", it is the least like programming I have seen that is still remotely like it. JASS is programming. But you can see all, or most of them in various places. I look in JassCraft to find some, but JassCraft is, and has been for some time, obsolete.