HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

A Better "Anti-share" script for RPGs/ and other

10-06-2009, 12:45 PM#1
shadowstrk
Hello, I'm new here, so please be gentle :$

Question 1: The important one, is an anti-item-sharing script for an RPG/ORPG.

What the previous map creator left me was...

Trigger:
Collapse Events
Unit - A unit Acquires an item
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
(Custom value of (Item being manipulated)) Equal to 0
(Custom value of (Item being manipulated)) Equal to (Player number of (Owner of (Triggering unit)))
Collapse Then - Actions
Item - Set the custom value of (Item being manipulated) to (Player number of (Owner of (Triggering unit)))
Collapse Else - Actions
Hero - Drop (Item being manipulated) from (Triggering unit)
Wait 0.70 seconds
Custom script: call DisplayFloatingText ("You cannot pick up other players items!",GetUnitLoc(GetTriggerUnit()),10,255,0, 0)

What this basically does now is checks if an item belongs to the player, if it doesn't, it will drop it.
If nobody owns it, it will "stick" the player's number onto the item.

The problem is that sometimes player's can't use these items (Archers can't use shields etc), but the script applies on them anyway.

You could say, "Well just don't apply the script for that item?", unfortunately, it's an RPG, and RPGs have shit load of items.

Question 2: I realized that the map had many... useless custom imports, for instance, a Death Knight Slardar is a good import for a model, but the portrait icon... no.
I tried looking for the portrait icon location within the unit's config, but couldn't find it.
Any pointers? (Planned to swap it out for a normal Slitheren Guard portait).

Question 3: I've noticed the previous map creator imported many icons for "disabled",
e.g. "ReplaceableTextures\CommandButtonsDisabled\DISBTNXPhoenixRobe.blp"
All of which mirror the non-disabled imports, why is this so? what are they generally used for?

Question 4::... shit I forgot it whilst writing this >.<

Thanks in advance.
10-06-2009, 01:07 PM#2
Anachron
Question 1: This isn't even a question?!

Question 2:
Quote:
I realized that the map had many... useless custom imports, for instance, a Death Knight Slardar is a good import for a model, but the portrait icon... no.
I tried looking for the portrait icon location within the unit's config, but couldn't find it.
Any pointers? (Planned to swap it out for a normal Slitheren Guard portait).
No, we are in wc3, not in SC II...

Question 3:
Quote:
I've noticed the previous map creator imported many icons for "disabled",
e.g. "ReplaceableTextures\CommandButtonsDisabled\DISBTNXPhoenixRobe.blp"
All of which mirror the non-disabled imports, why is this so? what are they generally used for?
Disabled are icons that are displayed when the menu is displayed, for example, or when the game is paused. It will show an darker version of the icon, so you can see it is disabled and you can'T do your stuff.

If you remove the DISBTN icon, you will see a green icon instead, which looks horrible.
10-06-2009, 01:13 PM#3
shadowstrk
First question was asking if there was a more efficient system.

2nd, I'll assume Models must be linked to the relevant portrait icon.

3rd... Mkay

4th, Suprisingly, when trying to test my map, I've been given a map intro with no user slots in Warcraft III, this has happened multiple times when attempting to start those demo maps in the System category.

Thanks again.

[e] 5th "call TriggerRegisterAnyUnitEvent(gg_trg_Unique_Item , EVENT_PLAYER_UNIT_PICKUP_ITEM)" - Undeclared Function? Huh?
10-06-2009, 01:51 PM#4
Anachron
Quote:
First question was asking if there was a more efficient system.
There are alot of possible systems how to do, but I think its okay.

Quote:
2nd, I'll assume Models must be linked to the relevant portrait icon.
Yeah.

Quote:
3rd... Mkay
yupp.

Quote:
4th, Suprisingly, when trying to test my map, I've been given a map intro with no user slots in Warcraft III, this has happened multiple times when attempting to start those demo maps in the System category.
Means your wc3 version is either to old or to new, because it can not load the map data.
10-06-2009, 02:28 PM#5
saw792
TriggerRegisterAnyUnitEventBJ(...)
10-07-2009, 03:34 AM#6
shadowstrk
How can I resolve problem 4 above? The map was working fine originally. (I'm using 1.24b atm).

The trigger thing (call TriggerRegisterAnyUnitEvent(gg_trg_Unique_Item , EVENT_PLAYER_UNIT_PICKUP_ITEM)) was when I changed the Unit - A unit Acquires item (bad) to Unit - A unit Acquires item. (This is a function in NewGen I believe).

I've got no clue how to solve this, unless I change it back, which supposedly leaks 12 nulls or something. Do I have to add a library?

[e] Could you please name/link some systems? (for question 1)

Thanks.
10-07-2009, 04:54 AM#7
saw792
It doesn't leak. Even so, if you're worried about it:
Collapse JASS:
function InitTrig_Unique_Item takes nothing returns nothing
  local integer i = 0
  loop
    exitwhen i == bj_MAX_PLAYER_SLOTS
    call TriggerRegisterPlayerUnitEvent(gg_trg_Unique_Item, Player(i), EVENT_PLAYER_UNIT_PICKUP_ITEM, Condition(function ReturnTrue)) //or just null for the last argument, since as I understand it doesn't leak.
    set i = i + 1
  endloop
  call TriggerAddAction(...)
endfunction
10-07-2009, 05:32 AM#8
shadowstrk
This is what I mean, left hand side, a "new" GUI thing included in the NewGen Pack, the right side, the old one.


[e] I managed to solve the map not starting problem, it was because of the triggers I changed in the above picture.