How to get a Widget to unitcreated
Moderator: Moderators
- bobthedinosaur
- Blood & Steel Developer
- Posts: 2702
- Joined: 25 Aug 2004, 13:31
How to get a Widget to unitcreated
If I want a widget that runs on a unitcreated trigger how do I go about doing that, since unit created is synced and widgets are not?
Re: How to get a Widget to unitcreated
widget:UnitCreated(...)
Voila. Widgets aren't limited to unsynced callins or callouts. They just can't use functions which change synced data, i.e. SetUnitPosition, but they have no trouble reading the sycned data, i.e. GetUnitPosition, or using some of the synced callins, i.e. :GameFrame, Unit_____, etc.
Voila. Widgets aren't limited to unsynced callins or callouts. They just can't use functions which change synced data, i.e. SetUnitPosition, but they have no trouble reading the sycned data, i.e. GetUnitPosition, or using some of the synced callins, i.e. :GameFrame, Unit_____, etc.
- bobthedinosaur
- Blood & Steel Developer
- Posts: 2702
- Joined: 25 Aug 2004, 13:31
Re: How to get a Widget to unitcreated
you don't want curly braces there, you want parenthesesSpring.SelectUnitArray{unitArray[1]}
- bobthedinosaur
- Blood & Steel Developer
- Posts: 2702
- Joined: 25 Aug 2004, 13:31
Re: How to get a Widget to unitcreated
they didn't really help either. Plus that code works just fine from where I ripped it from.
Re: How to get a Widget to unitcreated
SelectUnitArray takes a unit array, so you would use: 'Spring.SelectUnitArray(unitArray)'.
- bobthedinosaur
- Blood & Steel Developer
- Posts: 2702
- Joined: 25 Aug 2004, 13:31
Re: How to get a Widget to unitcreated
Ah yes. You are correct. That makes it work just fine.
Re: How to get a Widget to unitcreated
You can use UnitCreated only on your own units right? Or can you read synced data no matter?They just can't use functions which change synced data
Re: How to get a Widget to unitcreated
You can read synced data, ie unit positions but it is limited to what the player sees:
When used in a widget, UnitCreated, UnitDestroyed and similiar callins only "see" what the player sees.
ie your own units, allied units and enemy units that are Created/Destroyed in your LOS.
For spectators, the widget "sees" everything, same for replays.
When used in a widget, UnitCreated, UnitDestroyed and similiar callins only "see" what the player sees.
ie your own units, allied units and enemy units that are Created/Destroyed in your LOS.
For spectators, the widget "sees" everything, same for replays.
Re: How to get a Widget to unitcreated
So there isn't a way to use UnitFinished to count some other team's units? Other than using a gadget..
Re: How to get a Widget to unitcreated
enemy = no, unless the units are always visible or something
allies = yes
you can check if uniteam == local players team, or what do you mean?
allies = yes
you can check if uniteam == local players team, or what do you mean?
Re: How to get a Widget to unitcreated
Well I work on a mod and I want to count the units of the bot(the enemy bot) in a widget. In that way a user can disable and enable it on her/his own preference. So even if all users have the same widget that is located in the mod there isn't a way to use synced read?
Re: How to get a Widget to unitcreated
Widget are "helper" scripts, that players are free to grab or code themselves. Since you can have a widget and your opponent not, what widgets can do is severly limited to make sure they won't allow for cheats & exploits. As a typical exemple, if widgets could know about enemy units, then within hour we'd have a widget to display every units on the map, useable in any mod, without opponent knowing about it. That'll ruin all the games!
Gadget are parts of the mod, they can't be removed or added from a mod without making a new mod, and so they are given full power to change the simulation and the gameplay.
Gadget are parts of the mod, they can't be removed or added from a mod without making a new mod, and so they are given full power to change the simulation and the gameplay.
