Closed yqco closed 8 years ago
Thanks for these spots, now let's see how I'll solve them.
Ok, beside the droppable glitch (which a player must FORCE it anyway, pressing a button), eveything's got fixed. Now it's time to think how to remove the Treasure Chest on the map if we opened it (a boolean script could be the solution but it requires some think atm - I guess if we apply a checker before we speak to Miller, while leaving the HQs for a mission, if TRUE = Remove so do stuff otherwise FALSE = just do stuff)
Nice that I noticed there still were portions of the old Gate tweak script on the Intermap code, so I had just to update tags (109) :smile:
I took a shot at removing the empty treasure chest at level change. It's quite tricky; the empty chest doesn't have a TID so it can't be referenced by a script. Rather than spawning the empty chest via the pickup's Inventory.PickupFlash
property, I opted to pre-spawn it in the pickup's Spawn state using A_SpawnItemEx
where it can be given a TID.
It works like this: When a chest is opened, it's replaced with a reward pickup. The reward pickup spawns an invisible empty chest alongside itself. After the player picks up the reward, the empty chest becomes visible. All three actors share the same original TID. This allows scripts to check if a chest has been opened and collected by verifying that only one actor is using the chest's TID and that its class is "EmptySupplyChest:"
// How the chest on INTERMAP is removed after it has been unlocked and collected.
script "RemoveSupplyChest" UNLOADING
{
int chest_tid = 39;
if (ThingCount(T_NONE, chest_tid) == 1 && CheckActorClass(chest_tid, "EmptySupplyChest"))
{
Thing_Remove(chest_tid);
}
}
I also generalized the SupplyChest script to allow mappers to place treasure chests without the need to assign a thing special or define a "501" script in every map. Chests automatically set their special to execute the SupplyChest script and pass in their thing arguments. Their arguments are interpreted as follows:
The optional script argument allows prize IDs to be shared without tying map-specific events to them. For example, the treasure chest on C1M1 can have the rooftop guard spawning logic moved to the map's own script file and still allow other maps to use the prize ID for 25 coins.
Pull request for more generalized treasure chests.
These changes unfortunately break the existing treasure chests. The treasure chests' action specials need to be set to zero and their arguments adjusted. In most cases the 501 script can be removed. I've gone through the maps and made these changes.
Pull request to repair treasure chests if above request is merged.
These changes are fantastic! I wrote now a message on FB Team chat but today I'll be at home only this evening (it's 11:35am where I live atm), so maybe someone else will give you an answer (Torm?)... otherwise if the team will agree with these changes, I'll merge both pull requests then. :muscle:
Very good improvements, thanks for these, I am okay with merging this.
Ok then, I'll merge these in a while :+1:
Yqco if you don't find anything relevant concerning issues, you are free to close this then. I must say thank you so much, hopefully we'll get the time to test these properly in the nearly future on mutliplayer
I've made a pull request to prevent the weapon smuggling issue. Currently, it's still possible to sneak weapons out by throwing them beyond the lines that clear the player's inventory but it's a lot more arduous than before. The pull request fixes this by preventing the training weapons from being dropped entirely. Whether the pull is merged or not, I think it's fair to close this issue.
I merge this because I like nitpicky things :tongue: I feel so satisfied when an issue is completely removed ahaha Thanks a lot Yqco, you did a great job with this fix (and the flinch script, obviously)
I consider this re-opened because we can throw grenades now that I fixed items carried from other missions. What I'll need now is a checker while we stay on HQs... Unless we are on the Training Grounds, we mustn't be able to throw grenades and also we must not lose them if their use is excluded on HQs (a JumpIf thing probably would break this, resulting that we don't throw the grenade but we use the item... and this would mean add some more issues :tongue: )
Hopefully this grenade thing is fixed... I'll close it after I'll get confirmations from other team members.
There's a cleaner way of handling the grenade state by using the Fail instruction. I was trying to fix it too. I'll upload what I've got so you can see.
Edit: Actually I'll just post the relevant bit here:
States
{
Spawn:
THRP A -1
Stop
Use:
TNT1 A 0 A_JumpIfInventory("HQ_Checker", 1, "NoThrow")
TNT1 A 0 A_JumpIf(CallACS("AstrosteinCheck"),2)
TNT1 A 0 A_FireCustomMissile("HandGrenade",0,0,0,0,FPF_NOAUTOAIM)
Stop
TNT1 A 0 A_FireCustomMissile("AstroHandGrenade",0,0,0,0,FPF_NOAUTOAIM)
Stop
NoThrow:
TNT1 A 0
Fail
}
Added, thanks. I thought for some reason it could be responsible of weird glitches, but I was wrong (I checked properly the wiki now).