Staredit Network > Forums > Modding Assistance > Topic: Armed Civilian
Armed Civilian
Apr 12 2008, 10:00 pm
By: Pandut  

Apr 12 2008, 10:00 pm Pandut Post #1

I'm just a fish

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.

Apr 12 2008, 10:40 pm Hercanic Post #2

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?




Apr 12 2008, 11:32 pm Pandut Post #3

I'm just a fish

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.

Apr 13 2008, 4:03 am Hercanic Post #4

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.




Apr 13 2008, 2:59 pm Pandut Post #5

I'm just a fish

Ah i see. So now the armed civ will face its target but still wont attack...



None.

Apr 14 2008, 11:04 pm Laser Dude Post #6



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):

Code
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.

Apr 15 2008, 9:45 pm Pandut Post #7

I'm just a fish

Thanx Laser :D 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

Code
# ----------------------------------------------------------------------------- #
# 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.

Apr 16 2008, 5:13 am Laser Dude Post #8



Your incorrect comments are throwing you off, this is a section of your code:

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:

Code
      playfram 0x22 # frame set 2
      playfram 0x11 # frame set 1




None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[09:32 pm]
O)FaRTy1billion[MM] -- iirc the last byte in the TRIG is for more flags or something
[09:15 pm]
Wormer -- also, when I wear cartoon it turns off the dynamic lighting and doesn't turn it on when I switch back, maybe that kind of incompatibilities were the problem
[09:02 pm]
Suicidal Insanity -- Wormer
Wormer shouted: Pr0nogo THAT why it's impossible to switch that skin on the fly
My guess is GPU memory constraints
[09:02 pm]
Suicidal Insanity -- I think its 27 and padding
[09:01 pm]
Wormer -- Wormer
Wormer shouted: or the guide (http://www.starcraftai.com/wiki/CHK_Format#.22UNIT.22_-_Placed_Units) is wrong there and it should be u8[27] ?
the right link http://www.starcraftai.com/wiki/CHK_Format#.22TRIG.22_-_Triggers
[09:01 pm]
Wormer -- or the guide (http://www.starcraftai.com/wiki/CHK_Format#.22UNIT.22_-_Placed_Units) is wrong there and it should be u8[27] ?
[08:59 pm]
Wormer -- anybody knows why chk format has a list of 27 player group IDs (http://www.starcraftai.com/wiki/CHK_Format#List_of_Players.2FGroup_IDs), but TRIG section uses an array of 28 elements => suppose the last byte is padding as well?
[08:57 pm]
Wormer -- but it's actually possible to switch between cartoon and classic skin which is cool
[08:52 pm]
Wormer -- Pr0nogo
Pr0nogo shouted: they coded a new system in for it
THAT why it's impossible to switch that skin on the fly
[08:51 pm]
Pr0nogo -- i don't remember if it was because the old system was limited to only 2, or they didn't know how to increase it, or what
Please log in to shout.


Members Online: Roy, Pandut, DarkenedFantasies