disable unit explosions
disable unit explosions
is there a script call to not make things blow apart and instead keep the wreckage on the map?
trying to write a new script mission that uses crashed transports but we need to be able to make a pile of parts all around the map so people can hunt the debris piles that are left when it goes down
trying to write a new script mission that uses crashed transports but we need to be able to make a pile of parts all around the map so people can hunt the debris piles that are left when it goes down
Re: disable unit explosions
I believe in the stats you can choose what 'effect' is played when something is destroyed (I don't know the stats well enough to know where this is defined though).
You could disable the effect, causing units to just disappear when destroyed, and on eventDestroyed() place a feature object that would be a wreck of a unit that looks similar to what was destroyed.
It wouldn't be perfect, but it would allow you to experiment with the idea of wrecks to see whether they are something that should be pursued further.
Question is, how will wrecks be recovered? If they are placed as feature object, which seems most logical approach, how would trucks (or other special unit) recover or recycle them? Even if placed as an object owned by player who's unit was destroyed, there would still be issue of how to recover/recycle it, and also the issue that enemy would start targeting the wrecks blowing them up before you have chance to get them.
If we do mange to get wrecks working, it would be interesting to see if the scavs could be updated to gather abandoned wrecks -- it could give them a power bonus or act like a scav-only artifact.
You could disable the effect, causing units to just disappear when destroyed, and on eventDestroyed() place a feature object that would be a wreck of a unit that looks similar to what was destroyed.
It wouldn't be perfect, but it would allow you to experiment with the idea of wrecks to see whether they are something that should be pursued further.
Question is, how will wrecks be recovered? If they are placed as feature object, which seems most logical approach, how would trucks (or other special unit) recover or recycle them? Even if placed as an object owned by player who's unit was destroyed, there would still be issue of how to recover/recycle it, and also the issue that enemy would start targeting the wrecks blowing them up before you have chance to get them.
If we do mange to get wrecks working, it would be interesting to see if the scavs could be updated to gather abandoned wrecks -- it could give them a power bonus or act like a scav-only artifact.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: disable unit explosions
we would just monitor where the player is at and once they hit the same tile then they found it, but this would be really slow so we need to have some kind of hotspot trigger to make it work faster
Re: disable unit explosions
Well, there is one way, but it could get quite bloaty...
Code: Select all
// requires WZ 3.2
var wreckRecoverDist = 1; // num tiles unit must be from wreck to recover it
function eventDestroyed(victim) {
var
x1 = Math.max(0, victim.x - wreckRecoverDist),
y1 = Math.max(0, victim.y - wreckRecoverDist),
x2 = Math.min(mapWidth, victim.x + wreckRecoverDist),
y2 = Math.min(mapHeight, victim.y + wreckRecoverDist),
area = {x: x1, y: y1, x2: x2, y2: y2, type: AREA},
id = "Wreck"+victim.id;
addLabel(area, id); // I'm not sure if this will work, maybe it only accept game objects?
var wreck = addObject(......); // create wreck object here
this["eventArea"+id] = function(collector) {
recoverWreck(id, wreck, collector);
}
resetArea(id, ALL_PLAYERS); // or victim.player if only owning player is allowed to collect
}
function recoverWreck(id, wreck, collector) {
// id = label name of AREA associated with wreck
// wreck = wreck game object
// collector = droid object that collected the wreck
// (you could do something like check the collector is a truck or some other special droid if desired)
removeLabel(id); // should hopefully free the AREA object associated with wreck label
delete this["eventArea"+id]; // delete area event listener associated with the wreck
removeObject(wreck); // delete wreck object from map
// then give collector.player whatever it is they get for collecting wreck
}
Last edited by aubergine on 22 Jan 2013, 09:15, edited 1 time in total.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: disable unit explosions
BTW, I really hope you get it working, would love to see how it turns out!!
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
- Goth Zagog-Thou
- Regular
- Posts: 1582
- Joined: 06 Jan 2007, 08:08
- Location: Delta Base
- Contact:
Re: disable unit explosions
Oooooh. Salvaging? Really?!
Wooooooot!
Wooooooot!
Re: disable unit explosions
It all hinges on whether this works:
Although if it doesn't I dare say Per will be able to work some magic to make it happen
By adding the wrecks as features, they're less likely to get shot at (even in 3.1.0 and above where droids will shoot at blocking features again) -- in a battle, the droids will be focussing on shooting at enemy units. And depending on whether the area trigger is set to ALL_PLAYERS or victim.player, salvaging could feasibly take place during battle.
I still think trucks should be required to do salvaging though, so in the script example above this code:
Would become:
Also, I think there'd need to be some sort of timed wreck degradation but not sure how that would be achieved with current JS API. *goes off to check* Nope, can't find anything that would suit, not for feature objects anyway (if we used droid object we could perhaps use setDroidExperience() as a hacky way of working out how long until it disappears, but then you get all issues with droid objects being attacked by enemies -- which would be nuts in a battle).
We'd prolly need a setHealth(obj, health) function and then we could have a timer that would iterate through all wrecks, reducing their health every second or so, until it reaches 0 at which point the object disappears. Would require some additional infrastructure as when a wreck disappears due to non-retrieval you'd have to clear down the label, area event handler, etc.
EDIT: Hrm, we'd also need to deal with wrecks being destroyed -- ie. clear down label, area event listener, etc.
Code: Select all
addLabel(area, id); // I'm not sure if this will work, maybe it only accept game objects?
By adding the wrecks as features, they're less likely to get shot at (even in 3.1.0 and above where droids will shoot at blocking features again) -- in a battle, the droids will be focussing on shooting at enemy units. And depending on whether the area trigger is set to ALL_PLAYERS or victim.player, salvaging could feasibly take place during battle.
I still think trucks should be required to do salvaging though, so in the script example above this code:
Code: Select all
this["eventArea"+id] = function(collector) {
recoverWreck(id, wreck, collector);
}
Code: Select all
this["eventArea"+id] = function(collector) {
if (collector.type != DROID || collector.droidType != DROID_CONSTRUCT) {
resetArea(id, ALL_PLAYERS); // wait until a truck comes to collect
} else {
recoverWreck(id, wreck, collector);
}
}
We'd prolly need a setHealth(obj, health) function and then we could have a timer that would iterate through all wrecks, reducing their health every second or so, until it reaches 0 at which point the object disappears. Would require some additional infrastructure as when a wreck disappears due to non-retrieval you'd have to clear down the label, area event handler, etc.
EDIT: Hrm, we'd also need to deal with wrecks being destroyed -- ie. clear down label, area event listener, etc.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: disable unit explosions
Oh, and if this sort of thing works for wrecks, we'll be able to use similar code approach for things like artifacts and oil barrels, or anything else for that matter.
You could then do crazy stuff like treating indestructible boulders as a resource type, sending trucks in to collect them heh. Or artifacts dropped from destroyed base structures disappearing after a while if not collected (same with oil drums).
It's a shame buildings owned by the map player (player 99) can't be transferred to players -- otherwise you could have a way to capture log cabins and other map features, at which point they could be usable structures for some purpose. I imagine that would be superb for planned cam0 (Scavenger Wars) where your troops could occupy buildings and turn them in to barracks or labs, etc.
You could then do crazy stuff like treating indestructible boulders as a resource type, sending trucks in to collect them heh. Or artifacts dropped from destroyed base structures disappearing after a while if not collected (same with oil drums).
It's a shame buildings owned by the map player (player 99) can't be transferred to players -- otherwise you could have a way to capture log cabins and other map features, at which point they could be usable structures for some purpose. I imagine that would be superb for planned cam0 (Scavenger Wars) where your troops could occupy buildings and turn them in to barracks or labs, etc.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: disable unit explosions
addLabel() currently doesn't support areas/positions/groups, since I saw no need for that when I made it. But it won't be hard to add (just a bit of extra code).
If you want to "transfer" a feature building to a player, just remove it without a destruction effect and replace it with a player structure building that looks exactly the same. Requires you to modify wrf/pie/stats files, though.
If you want to "transfer" a feature building to a player, just remove it without a destruction effect and replace it with a player structure building that looks exactly the same. Requires you to modify wrf/pie/stats files, though.
Re: disable unit explosions
*salivating* Yes, please update addLabel() so it can be used to register non-game-objects, and removeLabel() so it frees RAM taken by associated non-game-objects (if applicable).
Would it be possible to get a setHealth(droid, health) function while you're there?
Would it be possible to get a setHealth(droid, health) function while you're there?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: disable unit explosions
now we are talking!
can it also be possible to add a screen shake call as well?
when we have satellites falling from the sky and they make a crater on impact we want the effect of screen shake to notify everyone
can it also be possible to add a screen shake call as well?
when we have satellites falling from the sky and they make a crater on impact we want the effect of screen shake to notify everyone
Re: disable unit explosions
You might be able to emulate screen shake using centerView() or camerasSlide() and changing the tile it's on every 100ms for say 1second?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: disable unit explosions
Fixed addLabel() to be able to add any type of label. removeLabel() already supported this.
@Originway: I think most people have screen shake disabled... For good reason.
@Originway: I think most people have screen shake disabled... For good reason.
Re: disable unit explosions
Screen shake is annoying when repetitive, but for a one-off event, eg. in a campaign mission, I guess it would be OK.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: disable unit explosions
was thinking it adds dramatic flairaubergine wrote:Screen shake is annoying when repetitive, but for a one-off event, eg. in a campaign mission, I guess it would be OK.