• 🏆 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!

Give item to hero

Status
Not open for further replies.
Level 15
Joined
Feb 9, 2006
Messages
1,598
Hello!
I'm just wondering.
If I make the game create an item and give it to a hero every 15 seconds, and it comes to a point where the inventory is full, what will happen?
I know that the item won't appear anywhere, but will it cause lag after a while? Or does the game understand that the inventory is in fact full and cancel the order?
 
Level 19
Joined
Oct 29, 2007
Messages
1,184
Try the same trigger every 0.01 seconds of game time. Then play your map and let it run a while (5-30 minutes). Come back and look at the fps/cpu performance and compare it to what you had before. If it isn't drastically decreased this should harmless. :p
 
Level 18
Joined
Nov 1, 2006
Messages
1,612
I remember hearing that periodic events can cause lag on their own and that timers are better to use. I'm currently not on a computer with WE or JassCraft or else those would be actual scripts below but you get the idea.

Periodic Events like "Every 15 seconds do Actions" should instead use Timers, like

Trigger X

Event: Time elapsed = 5.00 seconds

Actions: Set udg_Timer1 as a Repeating Timer that expires every 15.00 seconds

Trigger Y

Event: udg_Timer1 Expires

Actions: Create item and Give item to Hero

And actually, from what I recall whenever I create an item and give it to a Hero with a full inventory, the item is created in the position of that Hero. Also from what I've learned in WE, it's not that smart. It will always follow the order you give it unless there are conditions involved.

You can always create your own counting system to recognize when the inventory is full too. Here's a simple example:

Trigger A

Event:

Unit Acquires Item

Actions:

Set udg_Constant = udg_Constant + 1

Trigger B

Event:

Unit Drops Item

Actions:

Set udg_Constant = udg_Constant - 1

And that way on your Trigger Y you can add the condition

Condition: udg_Constant not equal to 6
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
The iems should be dropped on the floor and if left running too long, lag will occur due to excessive numbers of items. Graphic lag may also be noticable soonder if viewing too many items on the screen at once. Remember that if you are going to have huge numbers of items that it is best to impliment some kind of virtual item storage or item decay system to reduce excessive resource demands that items can place in large numbers.
 
Status
Not open for further replies.
Top