• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Is there some form of an 'Upgrade' Event?

GT500

Refugee
Hi Folks,


In XML we can used events such as Destroy, Harvest and Fall such as:
<drop event="Destroy" name="resourceCloth" count="1"/>

Is there some form of event that can hook into a Block Upgrade such as:
<drop event="Upgrade" name="resourceCloth" count="1"/>

Basically I would like to drop something into a persons inventory when a block is upgraded, but I am not sure if there is an event I can piggy back on to do that, or maybe there is a clever work around that someone knows about.

I appreciate any insight if anyone has some.
Thanks.
 
Can you upgrade it to a loot container with X item guaranteed to be in it, and then when you take the item out, it downgrades to the actual block you want it to be?
 
Can you upgrade it to a loot container with X item guaranteed to be in it, and then when you take the item out, it downgrades to the actual block you want it to be?
I have to admit, that was a creative idea :)


That would not work in the plan I had in mind, but I do love the suggestion :)
 
You can do something like:

<buff name="captureNailgunUpgrade" hidden="true" remove_on_death="false" >
<effect_group>
<requirement name="HoldingItemHasTags" tags="nailgun"/>
<triggered_effect trigger="onSelfUpgradedBlock" action="CallGameEvent" event="actionToAddItemToPlayer"/>
<effect_group>
</buff>
give the player the buff on startup, and code the action event to AddItem to player's inventory

Don't know if you have specific blocks in mind though, if so, you may be able to use
<triggered_effect trigger="onSelfUpgradedBlock" action="CallGameEvent" event="actionToAddItemToPlayer" TriggerHasTags="cobblestone"/>
but
1) I don't know if the TriggerHasTags requirement is associated with onSelfUpgradedBlock (it does work with onSelfDamagedBlock & onSelfDestroyedBlock)
2) you would need to add the Tag Property to the blocks (which is simple), 'cobblestone' in the example above.


maybe you could also do
<effect_group>
<requirement name="HoldingItemHasTags" tags="nailgun"/>
<requirement name="ItemHasTags" tags="cobblestone" target"other"/>
<triggered_effect trigger="onSelfUpgradedBlock" action="CallGameEvent" event="actionToAddItemToPlayer"/>
<effect_group/>
Add the buff to player at startup, add Tag property to cobblestone and code AddItem Event
Just throwing a couple thoughts out there for testing
cheers
 
Last edited:
just an edit, because I've not used the TriggerHasTags requirement, the syntax may be:
<requirement name="HoldingItemHasTags" tags="nailgun"/>
<requirement name="TriggerHasTags" tags="cobblestone" />
<triggered_effect trigger="onSelfUpgradedBlock" action="CallGameEvent" event="actionToAddItemToPlayer"/>

I dont know if its part of the <requirement> element or the <triggered_event> element.
cheers
 
Thanks for the ideas.


Maybe it would not have been worth the effort, but my plan was to give resources back through all the standard upgrades.

So:
- When you upgrade a wood block to cobblestone, you get wood back (to represent the wood that was there before the upgrade)
- Then when you upgrade a cobblestone block to concrete, you get cobblestone back (to represent the cobblestone that was there before the upgrade)
- Then when you upgrade a concrete block to steel, you get concrete back (to represent the concrete that was there before the upgrade)

I guess it was a way so that it did not feel like you were wasting all the resources going through the block upgrade stages vs just building concrete or steel block out of the gate :)
 
Back
Top