- 好友
- 6
- 在线时间
- 0 小时
- 最后登录
- 2024-12-15
骑士
- UID
- 3398051
- 第纳尔
- 1845
- 精华
- 0
- 互助
- 48
- 荣誉
- 5
- 贡献
- 10
- 魅力
- 341
- 注册时间
- 2022-8-13
鲜花( 57) 鸡蛋( 0)
|
本帖最后由 ggfgfgf 于 2024-2-24 14:02 编辑
我写了段斩首的代码,总飘红字
mst_quick_battle_battle trigger no: 28 consequences. h
SCRIPT WARNING ON OPCODE 1710: Invalid Agent ID: -1; LINE NO: 3:
SCRIPT WARNING ON OPCODE 1720: Invalid Agent ID: -1; LINE NO: 19:
SCRIPT WARNING ON OPCODE 1721: Invalid Agent ID: -1; LINE NO: 21:
我的代码如下
cut_body = (
ti_on_agent_hit, 0, 0, [],
[
(store_trigger_param_1,":agent"),
(try_begin),
(agent_get_troop_id, ":victim_troop", ":agent"),
(ge, ":victim_troop", 0),
(neq,":victim_troop","trp_male_head"),
(neq,":victim_troop","trp_female_head"),
。。。
(set_spawn_position, pos1),
(spawn_agent, ":head_type"),
(remove_agent,reg0),
(try_end),
])
原因
1710.1720.1721分别对应如下操作
agent_get_position = 1710
store_agent_hit_points = 1720
agent_set_hit_points = 1721
而ti_on_agent_hit有3个参数
Trigger Param 1(存储器1)=被攻击者
Trigger Param 2(存储器2)=攻击者
Trigger Param 3(存储器3)=攻击伤害
Register 0(reg0)=攻击者的武器
Position Register 0(pos0)=击打的坐标
正需要进行如上操作,所以,不是代码报错,而是引擎调用报错
虽然我没调用这参数,但是引擎会默认获取,然而我已经移除了agent,自然就报错了
另外就是这个触发器复杂操作agent_deliver_damage_to_agent尽量不要用,嵌套循环容易报错,原因未知
尽量用store_agent_hit_points和agent_set_hit_points
补充关于 ti_on_agent_hit 的参数问题
ti_on_agent_hit = -28.0 #can only be used in module_mission_templates triggers
# Trigger Param 1: receiver agent no
# Trigger Param 2: dealer agent no
# Trigger Param 3: inflicted damage
# Trigger Param 4: hit bone
# Trigger Param 5: missile item kind no
# Trigger Param 6: raw damage (before being soaked by armor)
# Trigger Param 7: item modifier
# Trigger Param 8: missile item modifier
# Trigger Param 9: damage type
# Register 0: item kind no
# Register 1: hit bone
# Position Register 0: position of the blow
# rotation gives the direction of the blow
# Trigger Result: if set, damage dealt to agent
|
|