Data-lines needed to understand opoints in code:
id: 30 type: 0 file: data\bandit.dat id: 300 type: 5 file: data\criminal.dat #criminal id: 500 type: 1 file: data\specialweap.dat #specialweapFirst you've to create a new weapon file. This weapon shouldn't fall from sky (so don't give an id from 100 to 199) and need to activate a type0-object - I call it the "swordslife" - so note this opoint in every frame of your weapon:
opoint: kind: 1 x: 0 y: -10 action: 300 dvx: 0 dvy: 0 oid: 30 facing: 0 opoint_end:Then here's the code for Bandit.dat
<frame> 300 swordslife pic: 1000 state: 3005 wait: 1 next: 1000 dvx: 550 dvy: 550 dvz: 550 itr: kind: 8 x: -1500 y: 5000 w: 3000 h: 500 dvx: 301 zwidth: 500 injury: 0 itr_end: <frame_end> <frame> 301 swordslife at keeper pic: 1000 state: 3005 wait: 5 next: 1000 dvx: 550 dvy: 550 dvz: 550 bdy: kind: 0 x: -1500 y: 6000 w: 3000 h: 500 bdy_end: <frame_end> <frame> 310 call swordslife to keeper pic: 1000 state: 3005 wait: 5 next: 1000 dvx: 550 dvy: 550 dvz: 550 bdy: kind: 0 x: -1500 y: 5000 w: 3000 h: 500 bdy_end: <frame_end>and for criminal.dat:
<frame> 100 keeper waitforcheck pic: 1000 state: 3005 wait: 30 next: 101 <frame_end> <frame> 101 keeper pic: 1000 state: 3005 wait: 1 next: 102 opoint: #call-swordslife kind: 1 x: 0 y: 0 action: 310 dvx: 0 dvy: 0 oid: 30 facing: 0 opoint_end: <frame_end> <frame> 102 keeper call-swordslife pic: 1000 state: 3005 wait: 5 next: 105 itr: #wait for the message of swordalive kind: 8 x: -1500 y: 6000 w: 3000 h: 500 zwidth: 500 dvx: 100 injury: 0 itr_end: <frame_end> <frame> 105 no swordslife / act sword pic: 1000 state: 3005 wait: 1 next: 106 <frame_end> <frame> 106 no swordslife / act sword pic: 1000 state: 3005 wait: 1 next: 100 opoint: kind: 1 x: -200 y: -400 action: 0 dvx: 0 dvy: 0 oid: 500 facing: 0 opoint_end: <frame_end>Now if you want to use this weapon system in stage just note this line in stage:
id: 300 hp: 0 x: 200 act: 100 #specialweap_keeper
the x value should be in the middle of the background, not of actual phase...
Now for explanation: The keeper (criminal.dat) checks for the sword every 30 TU / every second. Therefore it try to call one of the swordlifes which are activated every TU for secure.
It activate a type0 object with an bdy at y: 5000 which reacts with the swordlife itr/kind8 at y: 5000 and calls the swordlife to the keeper. This is just to secure the keeper will not move, go outta screen or there'll be problems later.
When the Swordlife is at the keeper it has a bdy at y: 6000
This bdy can react with the itr/kind 8 in frame 102 of the Keeper. If there's a Swordlife the dvx work and it go back to frame 100 and wait for next check. If there's no Swordlife it simply go to next and activate a new sword...
Since this is used for Stage I suggest to delete the "Com" logo for computer players - you'll see it...
Keep Item in Stage |
Inspired by MH-Razen