I'm currently making a mod, and i want to add in the armed civilian to act out as an Officer unit. I've tried multiple times of Iscripting the civilian to have a weapon using the armed civ GRP but all i got were crashes. So if anyone could, tell, PM, or give me the Iscript so the armed civ will work correctly.
Thank you.
None.
STF mod creator, Modcrafters.com admin, CampaignCreations.org staff
Dear Pandut:
Well, what did you write for the Iscript code? The crashes are most likely caused by either a missing animation, or a nonexisting frame call. With attacks, you have three seperate animations for both ground and air. They are the initial attack, continued attack, and back to idle from attack. When, precisely, does it crash?
After some re-reading of the text i found the crashing problem, i spelt CivilianGndAttkp instead of CivilianGndAttkRpt.
Anyhoo, The armed civ wont attack, it will go to its target but wont fire (Yes, i assigned it a weapon)
This is the script i used:
# ----------------------------------------------------------------------------- #
# This is a decompile of the iscript.bin file 'data\scripts\iscript.bin'
# created on: Sat Apr 12 17:51:54 2008
# ----------------------------------------------------------------------------- #
# ----------------------------------------------------------------------------- #
# This header is used by images.dat entries:
# 221 Civilian (neutral\civilian.grp)
.headerstart
IsId 67
Type 12
Init CivilianInit
Death CivilianDeath
GndAttkInit CivilianGndAttkInit
AirAttkInit [NONE]
Unused1 [NONE]
GndAttkRpt CivilianGndAttkRpt
AirAttkRpt [NONE]
CastSpell [NONE]
GndAttkToIdle CivilianGndAttkToIdle
AirAttkToIdle [NONE]
Unused2 [NONE]
Walking CivilianWalking
WalkingToIdle CivilianWalkingToIdle
SpecialState1 [NONE]
.headerend
# ----------------------------------------------------------------------------- #
CivilianInit:
imgul 222 0 0 # CivilianShad (neutral\nciShad.grp)
goto CivilianGndAttkInit
CivilianWalkingToIdle:
playfram 0x77 # frame set 7
CivilianLocal01:
waitrand 63 75
randcondjmp 128 CivilianLocal00
goto CivilianLocal01
CivilianLocal00:
turnrand 3
goto CivilianWalkingToIdle
CivilianDeath:
playsndbtwn 276 277 # Terran\MARINE\TMaDth00.WAV, Terran\MARINE\TMaDth01.WAV
imgol 242 0 0 # Unknown242 (terran\marine.grp)
wait 1
end
CivilianGndAttkInit:
playfram 0x00 # frame set 0
wait 1
playfram 0x11 # frame set 1
wait 1
playfram 0x22 # frame set 2
CivilianGndAttkToIdle:
playfram 0x11 # frame set 1
wait 1
playfram 0x00 # frame set 0
wait 1
goto CivilianWalkingToIdle
CivilianGndAttkRpt:
wait 1
nobrkcodestart
playsnd 10 # Misc\Explo1.wav
attackwith 1
playfram 0x33 # frame set 8
wait 1
playfram 0x22 # frame set 9
wait 1
playfram 0x33 # frame set 8
wait 1
playfram 0x22 # frame set 9
wait 1
playfram 0x33 # frame set 8
wait 1
playfram 0x22 # frame set 9
wait 1
nobrkcodeend
gotorepeatattk
ignorerest
CivilianWalking:
move 4
wait 1
playfram 0x00 # frame set 0
move 4
wait 1
playfram 0x11 # frame set 1
move 4
wait 1
playfram 0x22 # frame set 2
move 4
wait 1
playfram 0x33 # frame set 3
move 4
wait 1
playfram 0x44 # frame set 4
move 4
wait 1
playfram 0x55 # frame set 5
move 4
wait 1
playfram 0x66 # frame set 6
move 4
wait 1
playfram 0x77 # frame set 7
goto CivilianWalking
Keep in mind that i'm a noob Iscripter before you respond, ive only edited unit weapon Iscripts so far so this is kind of a big step fpr me.
None.
STF mod creator, Modcrafters.com admin, CampaignCreations.org staff
Dear Pnadut:
Go to the AI tab in Units.dat. Use the Marine's AI as an example.
Ah i see. So now the armed civ will face its target but still wont attack...
None.
OK, first off: half your comments are wrong. Fix them, or delete them. Faulty comments can throw even a good coder off.
Second off, have you followed your script to see what it
should do? Because when I follow it, I just see it jump to the idle section (i.e. endless waiting) and never use the attack. When you're writing your script, especially if it doesn't work, you should follow it to see where it actually goes...
Take a look at your attack section without any spaces (to get my point across):
CivilianGndAttkInit:
playfram 0x00 # frame set 0
wait 1
playfram 0x11 # frame set 1
wait 1
playfram 0x22 # frame set 2
playfram 0x11 # frame set 1
wait 1
playfram 0x00 # frame set 0
wait 1
goto CivilianWalkingToIdle
Also, why does your init script go into your attack script? If that's unintentional, fix it. If it's intentional, then comment it so that people who help you know what you're thinking.
And here's a hint: if you want to know what your iscript is doing, use reasonable header names that suit that block of code. The decompiler just uses names like local00 because it has no clue what the script is trying to do. Names like civilianidle and civilianrandturn do a far better job then local00 and local01.
None.
Thanx Laser
The armed civ will now attack its target but its using the wrong animation. I need it to fire the gun its holding, not its hand
Anyhoo, this is my current working Script
# ----------------------------------------------------------------------------- #
# This is a decompile of the iscript.bin file 'data\scripts\iscript.bin'
# created on: Tue Apr 15 15:39:34 2008
# ----------------------------------------------------------------------------- #
# ----------------------------------------------------------------------------- #
# This header is used by images.dat entries:
# 221 Civilian (neutral\civilian.grp)
.headerstart
IsId 67
Type 12
Init CivilianInit
Death CivilianDeath
GndAttkInit CivilianGndAttkInit
AirAttkInit [NONE]
Unused1 [NONE]
GndAttkRpt CivilianGndAttkRpt
AirAttkRpt [NONE]
CastSpell [NONE]
GndAttkToIdle CivilianGndAttkToIdle
AirAttkToIdle [NONE]
Unused2 [NONE]
Walking CivilianWalking
WalkingToIdle CivilianWalkingToIdle
SpecialState1 [NONE]
.headerend
# ----------------------------------------------------------------------------- #
CivilianInit:
imgul 222 0 0 # CivilianShad (neutral\nciShad.grp)
CivilianWalkingToIdle:
playfram 0x77 # frame set 7
CivilianLocal01:
waitrand 63 75
randcondjmp 128 CivilianLocal00
goto CivilianLocal01
CivilianLocal00:
turnrand 3
goto CivilianWalkingToIdle
CivilianDeath:
playsndbtwn 276 277 # Terran\MARINE\TMaDth00.WAV, Terran\MARINE\TMaDth01.WAV
imgol 242 0 0 # Unknown242 (terran\marine.grp)
wait 1
end
CivilianWalking:
move 4
wait 1
playfram 0x00 # frame set 0
move 4
wait 1
playfram 0x11 # frame set 1
move 4
wait 1
playfram 0x22 # frame set 2
move 4
wait 1
playfram 0x33 # frame set 3
move 4
wait 1
playfram 0x44 # frame set 4
move 4
wait 1
playfram 0x55 # frame set 5
move 4
wait 1
playfram 0x66 # frame set 6
move 4
wait 1
playfram 0x77 # frame set 7
goto CivilianWalking
CivilianGndAttkInit:
playfram 0x00 # frame set 0
wait 1
playfram 0x11 # frame set 1
wait 1
playfram 0x22 # frame set 2
playfram 0x11 # frame set 1
wait 1
playfram 0x00 # frame set 0
wait 1
goto CivilianGndAttkRpt
CivilianGndAttkRpt:
wait 1
nobrkcodestart
playsnd 10 # Misc\Explo1.wav
attackwith 1
playfram 0x55 # frame set 18
wait 1
playfram 0x44 # frame set 17
wait 1
nobrkcodeend
gotorepeatattk
ignorerest
CivilianGndAttkToIdle:
playfram 0x11 # frame set 17
wait 1
playfram 0x00 # frame set 0
wait 1
goto CivilianLocal00
Im obviously using the wrong frame set, its a little confusing to me...
None.
Your incorrect comments are throwing you off, this is a section of your code:
playfram 0x55 # frame set 18
wait 1
playfram 0x44 # frame set 17
frame 0x55
is not frame set 18! I think you're forgetting that anything after a pound (#) is a comment, and is ignored (this is so you can write things to help yourself out). Changing which frame the comment says has no effect on the code itself. There's 17 frames per frame set, so you need to take your frame set number, and multiply it by 17. Also, it may be easier to read in hex notation, in which there are 0x11 frames per frame, and you should multiply 0x11 by the frame number.
Also, having two frames play immediately after each other with no wait between is completely pointless, as seen in your init attack section:
playfram 0x22 # frame set 2
playfram 0x11 # frame set 1
None.