[Help] Item to spawn a scene prop?

正在查看此主题的用户

DeepRedCee

Recruit
Hey there,

Basically I'm making a throwing item which spawns a barricade (a destructible scene prop) at the position of where it lands. This is my code so far however, it (a) does not spawn the correct scene prop (at the moment a test target dummy) and (b) seems to spawn it in a random location on the map (in the same place, most likely at 0,0,0 coords)

插入代码块:
["targetdummy", "Target Dummy", [("plank1",0)], itp_type_thrown|itp_merchandise|itp_primary ,itcf_throw_stone, 1 , weight(1)|difficulty(0)|spd_rtng(99) | shoot_speed(23) | thrust_damage(28 ,  blunt)|max_ammo(1)|weapon_length(23),imodbits_none,
[(ti_on_missile_hit, [	

(store_trigger_param_1,":thrower"),
	(try_begin),
		(set_spawn_position,reg1),
		(spawn_scene_prop,"spr_dummy_a_undestructable"),
	(try_end),
        #Graphics and sound effects below
        (play_sound_at_position,"snd_pistol_shot",pos1),
    (try_end)
])]],
 
You are using an integer register (reg1) with set_spawn_position instead of a position register (pos1).
No need for those lines to be try-blocked, either...there's no conditional. And you have a handing try_end, best to remove that, too. And you never use the thrower agent ID, so no need to record it to a local variable.
 
Thanks loads, works now :]

The whole position register/integer register thing has been confusing me for a while.

Also, is there a way to store a position register? similar to store_trigger_param ?
 
See header_triggers. If the specific trigger returns a position, like ti_on_missile_hit, it will automatically be stored in a position register as indicated in the header_triggers file (typically pos1).

You might want to check out my intro syntax thread, linked in my sig...might help get a couple terms straight.
 
A bit of topic, but Caba`drin you are awesome. Always helping people on here and ****.

Just felt like saying that :smile:
 
后退
顶部 底部