• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

item sticking (saving) script help

Status
Not open for further replies.
Level 5
Joined
Jun 25, 2009
Messages
50
I am currently trying to get this to run. At first it seemed quite possible to make it work. PROBLEM, for some reason it doesn't work. i was using the custom variables (not actually in variables but a per item integer). are these not working?? because when i made the individual variables it didn't work and remained the default 0. not only that but this also didn't work.

setting custom value
event player loses item

set item custom value = playernumber(ownerof(triggeringunit))

grabbing item trigger

(not exact but close)
event unit is issued an order targeting an object
if (targeted item variable equal to playernumber(ownerof(triggeringunit)))

then do nothing

else if (targeted item custom variable not equal to 0)

then display to all players (player name is trying to steal player names item)
unit force order(triggering unit) == stop
 
Level 5
Joined
Jun 25, 2009
Messages
50
THIS IS THE ONE WITH CUSTOM ITEM VALUES

Event: player acquires an item
  • Item - Make (Item being manipulated) Vulnerable
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Player number of (Owner of (Triggering unit))) Not equal to (Custom value of (Item being manipulated))
    • Then - Actions
      • Game - Display to (All players) for 10.00 seconds the text: ((Name of (Owner of (Triggering unit))) + ( is attempting to take an item that belongs to + (Name of (Player((Custom value of (Item being manipulated)))))))
      • Hero - Drop (Item being manipulated) from (Triggering unit)
    • Else - Actions
Event: Player loses item
  • Item - Make (Last dropped item) Invulnerable
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Custom value of (Last dropped item)) Equal to 0
    • Then - Actions
      • Item - Set the custom value of (Item being manipulated) to (Player number of (Owner of (Triggering unit)))
    • Else - Actions
 
Last edited:
Level 8
Joined
Aug 4, 2006
Messages
357
He's right. I'd just like to point out there's a better way to do your second trigger:
  • Item - Make (Item being manipulated) Invulnerable
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Custom value of (Item being manipulated)) Equal to 0
    • Then - Actions
      • Item - Set the custom value of (Item being manipulated) to (Player number of (Owner of (Triggering unit)))
    • Else - Actions
And your condition for the first trigger would be better as:
  • (Player number of (Owner of (Triggering unit))) Not equal to (Custom value of (Item being manipulated))
 
Level 5
Joined
Jun 25, 2009
Messages
50
PROBLEM: this causes wc3 to fatals when you first pickup an item.
trigger:
  • If (((Item being manipulated) is invulnerable) Equal to True) then do (Item - Make (Item being manipulated) Vulnerable) else do (Do nothing)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Player number of (Owner of (Triggering unit))) Not equal to (Custom value of (Item being manipulated))
    • Then - Actions
      • Game - Display to (All players) for 10.00 seconds the text: ((Name of (Owner of (Triggering unit))) + ( is attempting to take an item that belongs to + (Name of (Player((Custom value of (Item being manipulated)))))))
      • Hero - Drop (Item being manipulated) from (Hero manipulating item)
    • Else - Actions
 
Status
Not open for further replies.
Top