Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Filip H

Pages: [1]
1
40k / Re: [ADDON] ROSIGMA
« on: April 29, 2022, 06:10:28 pm »
I believe this is the space hulk mission objective.

2
Help / Re: Scripting 'isFuseEnabled'
« on: February 25, 2022, 02:58:11 pm »
Code: [Select]
[25-02-2022_14-45-00] [ERROR] Error in parsing script 'newTurnItem' for 'Global Event Script': invalid variable definition after other operations: 'var int Fuse_State;'I believe this error is caused due to all variables being required to be declared before any operations (which is why var int Current_Turn; isn't throwing an error since it's before any operations).
I get no errors after editing the script to this:
Code: [Select]
extended:
  tags:
    RuleItem:
      AUTO_PRIMED_ENABLED: int
      AUTO_PRIMED_FUSE_TIME: int
      AUTO_PRIMED_GROUND_ARM: int
      AUTO_PRIMED_FIRST_TURN_ONLY: int
  scripts:
    newTurnItem:
      - offset: 52
        code: |
          var int Current_Turn;
          var int Fuse_State;
          var ptr RuleInventory Items_Inventory;
          var int Inventory_Slot;
          var int Auto_Prime;
          var int Fuse_Time;
          var int Ground_Arm;
          var int First_Turn_Only;
         
          battle_game.getTurn Current_Turn;

          item.isFuseEnabled Fuse_State;


          item.getSlot Items_Inventory;
          Items_Inventory.getType Inventory_Slot;

          item.getTag Auto_Prime Tag.AUTO_PRIMED_ENABLED;

          item.getTag Fuse_Time Tag.AUTO_PRIMED_FUSE_TIME;

          item.getTag Ground_Arm Tag.AUTO_PRIMED_GROUND_ARM;

          item.getTag First_Turn_Only Tag.AUTO_PRIMED_FIRST_TURN_ONLY;




          # If Grenade is not set for Auto Prime, Return.
          if neq Auto_Prime 1;
            return;
          end;

          # If Grenade is already armed, return
          if neq Fuse_State 0;
            return;
          end;

          # If Grenade is on ground and cannot ground arm, return
          if eq Ground_Arm 0;
            if eq Inventory_Slot INV_GROUND;
              return;
            end;
          end;

          # If Grenade can only be auto armed on first turn and it is after that, return
          if eq First_Turn_Only 1;
            if neq Current_Turn 1;
              return;
            end;
          end;

          # Set Grenade fuse to Fuse_Time
          item.setFuseTimer Fuse_Time;
          return;

3
Help / Re: Scripting 'isFuseEnabled'
« on: February 23, 2022, 08:41:26 pm »
The var int that the isFuseEnabled requires is where its return value is written.
So to do what you're trying to accomplish you'd need to do something like this:
Code: [Select]
scripts:
   newTurnItem:       
       - offset: 1
         code: |
          var int x;
          item.isFuseEnabled x; #x gets the value 0 or 1 depending on if the fuse is lit
          if eq x 0;
            <CODE>
          end;
          return;

Regarding the additional question, no, the pointer names vary between script hooks. You can find the pointers available for each hook in the script data section of the API.
For example in the newTurnItem hook, the pointer for the BattleItem is just item
Code: [Select]
Name: battle_game                             ptre      BattleGame
Name: item                                    ptre      BattleItem
Name: null                                              null     
Name: rules                                   ptr       RuleMod 
Name: side                                              int     
Name: turn                                              int
The pointer for BattleGame seems to be consistently battle_game though.

4
Help / Re: Recovering friendly spawned units?
« on: January 12, 2022, 09:14:36 pm »
Using builtInWeaponSets to add a dummy item with recoveryTransformations to change it back to the original item could probably do it.
Something like this:
Code: [Select]
units:
   - type: STR_EXAMPLE_UNIT
     builtInWeaponSets:
       - - STR_DUMMY_ITEM
items:
   - type: STR_DUMMY_ITEM
     fixedWeapon: true
     recover: true
     recoveryTransformations:
        STR_EXAMPLE_ITEM: [1]

5
Help / Re: Replacing weapon sprite depending of ammo.
« on: September 23, 2021, 01:50:40 pm »
Counter-Terrorist Operations, UNEXCOM: bureau 11 and OpenScarfCom also have scripts that do this

Pages: [1]