OpenXcom Forum
OpenXcom Forks => OXCE Support => OpenXcom Extended (OXCE) => OXCE Support Y-scripts => Topic started by: Nord on September 23, 2021, 12:08:26 pm
-
I think i saw somewhere a mod, that changes sprites for loaded and empty guns in battlescape. But now i can not find nor it, nor these possibilities in ruleset or scripts.
Am i hallucinating?
-
I think it was done in 40k, but maybe they have switched to something else... I found only recolor in v30.
Maybe try some earlier 40k version?
Forum search yielded this post from Yankes: https://openxcom.org/forum/index.php/topic,4880.msg70935.html#msg70935
or here from Ohartenstein: https://openxcom.org/forum/index.php/topic,5245.msg78316.html#msg78316
-
That's it, thank you.
Oh it is good to know that i am still sane. :)
Ok. As i asked in a dead topic,
Excuse me, but i can not understand what
Code: [Select]
rules.getSpriteOffsetBigobs sprite_index temp;
doing.
Can you explain please?
(I thinked it is like "auto-adding mod offset when more than one mod is used" but looks like it is not working like that.)
I have done working script. But it stops working when i change mod load order. So i need to catch mod sprite offset.
Described command always gives me "1" in return. I think i do something wrong.
Here is a quote from my version of script:
extended:
RuleItem:
#change sprite from ammo
ALLOW_AMMO_TO_RESPRITE: int
NEW_BIGOB_FOR_WEAPON: int
CURRENT_MOD_OFFSET: RuleList
scripts:
selectItemSprite:
# Select weapon bigSprite based on ammo item
- offset: 1
code: |
var ptr BattleItem ammoItem;
var ptr RuleItem weaponRuleset;
var ptr RuleItem ammoRuleset;
var int doResprite;
var int newSprite;
var int modOffset;
if eq blit_part blit_item_big;
item.getRuleItem weaponRuleset;
weaponRuleset.getTag doResprite Tag.ALLOW_AMMO_TO_RESPRITE;
if eq doResprite 1;
item.getAmmoItem ammoItem;
ammoItem.getRuleItem ammoRuleset;
ammoRuleset.getTag newSprite Tag.NEW_BIGOB_FOR_WEAPON;
if neq newSprite 0;
set sprite_index newSprite;
ammoRuleset.getTag modOffset Tag.CURRENT_MOD_OFFSET;
rules.getSpriteOffsetBigobs sprite_index modOffset;
end;
end;
end;
return sprite_index;
items:
- type: STR_DART_GUN
tags:
ALLOW_AMMO_TO_RESPRITE: 1
- type: STR_DART_CLIP
tags:
NEW_BIGOB_FOR_WEAPON: 1154
CURRENT_MOD_OFFSET: current
Help me please.
-
Counter-Terrorist Operations, UNEXCOM: bureau 11 and OpenScarfCom also have scripts that do this
-
Counter-Terrorist Operations, UNEXCOM: bureau 11 and OpenScarfCom also have scripts that do this
I have researched them. All of them using little cheat: instead of giving plane new sprite number, they organize bigob sprites in a fixed order, and then just increase sprite index by a fixed number.
It is a way, though. And if i will not understand how to get mod sprite offset, then i can go that way and rearrange my sprites.
-
Did you finally make it work? then I look on your script it look like it should work correctly. At least looking on overall structure, probably best way to handle case like this is to check what exactly this script do using `debug_log item "some message" 132;` where you can dump most data to logs and see what steps script do.
-
I have researched them. All of them using little cheat: instead of giving plane new sprite number, they organize bigob sprites in a fixed order, and then just increase sprite index by a fixed number.
It is a way, though. And if i will not understand how to get mod sprite offset, then i can go that way and rearrange my sprites.
It may look boring and/or overwhelming to do the changes on the indexes, specially if you had an extensive amount of sprites. But tbh, the change isn't as bad as it sounds. Actually, it's easier to organize the sprite indexes when the number is the same for all three of them.
-
Did you finally make it work?
Yes, by rearranging "extraSprites" and changing "set sprite_index..." to "add sprite_index..."
Still dont understand how to get mod offset though.
You can look at working script in my "TWoTS" mod, with gas cannon for example.
-
You can look at working script in my "TWoTS" mod, with gas cannon for example.
Thanks so much for getting this working! I'm borrowing the script from your mod as long as nobody minds!